Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cd /D "%~dp0"
for %%a in (%*) do set "%%a=1"
if not "%msvc%"=="1" if not "%clang%"=="1" set msvc=1
if not "%release%"=="1" set debug=1
if not "%arm64%"=="1" set x64=1
if "%debug%"=="1" set release=0 && echo [debug mode]
if "%release%"=="1" set debug=0 && echo [release mode]
if "%msvc%"=="1" set clang=0 && echo [msvc compile]
Expand Down Expand Up @@ -64,10 +65,11 @@ if "%msvc%"=="1" set only_compile=/c
if "%clang%"=="1" set only_compile=-c
if "%msvc%"=="1" set EHsc=/EHsc
if "%clang%"=="1" set EHsc=
if "%msvc%"=="1" set no_aslr=/DYNAMICBASE:NO
if "%clang%"=="1" set no_aslr=-Wl,/DYNAMICBASE:NO
if "%msvc%"=="1" if "%x64%"=="1" set no_aslr=/DYNAMICBASE:NO
if "%clang%"=="1" if "%x64%"=="1" set no_aslr=-Wl,/DYNAMICBASE:NO
if "%msvc%"=="1" set rc=call rc
if "%clang%"=="1" set rc=call llvm-rc
if "%arm64%"=="1" set no_aslr=

:: --- Choose Compile/Link Lines ----------------------------------------------
if "%msvc%"=="1" set compile_debug=%cl_debug%
Expand Down
12 changes: 8 additions & 4 deletions src/base/base_context_cracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
# define ARCH_X86 1
# elif defined(_M_ARM64)
# define ARCH_ARM64 1
# define USE_SOFT_INTRINSICS
# elif defined(_M_ARM)
# define ARCH_ARM32 1
# else
Expand Down Expand Up @@ -110,7 +111,7 @@
////////////////////////////////
//~ rjf: Arch Cracking

#if defined(ARCH_X64)
#if defined(ARCH_X64) || defined(ARCH_ARM64)
# define ARCH_64BIT 1
#elif defined(ARCH_X86)
# define ARCH_32BIT 1
Expand Down Expand Up @@ -238,10 +239,13 @@
//~ rjf: Unsupported Errors

#if ARCH_X86
# error You tried to build in x86 (32 bit) mode, but currently, only building in x64 (64 bit) mode is supported.
# error You tried to build in x86 (32 bit) mode, but currently, only building in x64 and arm64 (64 bit) mode is supported.
#endif
#if !ARCH_X64
# error You tried to build with an unsupported architecture. Currently, only building in x64 mode is supported.
#if ARCH_ARM32
# error You tried to build in arm32 (32 bit) mode, but currently, only building in x64 and arm64 (64 bit) mode is supported.
#endif
#if !defined(ARCH_X64) || !defined(ARCH_ARM64)
# error You tried to build with an unsupported architecture. Currently, only building in x64 and arm64 mode is supported.
#endif

#endif // BASE_CONTEXT_CRACKING_H
2 changes: 1 addition & 1 deletion src/base/base_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

#if COMPILER_MSVC
# include <intrin.h>
# if ARCH_X64
# if defined(ARCH_X64) || defined(ARCH_ARM64)
# define ins_atomic_u64_eval(x) *((volatile U64 *)(x))
# define ins_atomic_u64_inc_eval(x) InterlockedIncrement64((volatile __int64 *)(x))
# define ins_atomic_u64_dec_eval(x) InterlockedDecrement64((volatile __int64 *)(x))
Expand Down
3 changes: 3 additions & 0 deletions src/base/base_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
//~ rjf: Third Party Includes

#define STB_SPRINTF_DECORATE(name) raddbg_##name
#if ARCH_64BIT
#define stbsp__uintptr U64
#endif
#include "third_party/stb/stb_sprintf.h"

////////////////////////////////
Expand Down
175 changes: 175 additions & 0 deletions src/codeview/codeview.h
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,181 @@ typedef enum CV_Regx64Enum
}
CV_Regx64Enum;

// X(NAME, CODE, (RDI_RegisterCode_ARM64) NAME, BYTE_POS, BYTE_SIZE)
#define CV_Reg_ARM64_XList(X) \
X(NONE, 0, nil, 0, 0)\
X(W0, 10, x0, 0, 4)\
X(W1, 11, x1, 0, 4)\
X(W2, 12, x2, 0, 4)\
X(W3, 13, x3, 0, 4)\
X(W4, 14, x4, 0, 4)\
X(W5, 15, x5, 0, 4)\
X(W6, 16, x6, 0, 4)\
X(W7, 17, x7, 0, 4)\
X(W8, 18, x8, 0, 4)\
X(W9, 19, x9, 0, 4)\
X(W10, 20, x10, 0, 4)\
X(W11, 21, x11, 0, 4)\
X(W12, 22, x12, 0, 4)\
X(W13, 23, x13, 0, 4)\
X(W14, 24, x14, 0, 4)\
X(W15, 25, x15, 0, 4)\
X(W16, 26, x16, 0, 4)\
X(W17, 27, x17, 0, 4)\
X(W18, 28, x18, 0, 4)\
X(W19, 29, x19, 0, 4)\
X(W20, 30, x20, 0, 4)\
X(W21, 31, x21, 0, 4)\
X(W22, 32, x22, 0, 4)\
X(W23, 33, x23, 0, 4)\
X(W24, 34, x24, 0, 4)\
X(W25, 35, x25, 0, 4)\
X(W26, 36, x26, 0, 4)\
X(W27, 37, x27, 0, 4)\
X(W28, 38, x28, 0, 4)\
X(W29, 39, x29, 0, 4)\
X(W30, 40, x30, 0, 4)\
X(WZR, 41, x31, 0, 4)\
X(X0, 50, x0, 0, 8)\
X(X1, 51, x1, 0, 8)\
X(X2, 52, x2, 0, 8)\
X(X3, 53, x3, 0, 8)\
X(X4, 54, x4, 0, 8)\
X(X5, 55, x5, 0, 8)\
X(X6, 56, x6, 0, 8)\
X(X7, 57, x7, 0, 8)\
X(X8, 58, x8, 0, 8)\
X(X9, 59, x9, 0, 8)\
X(X10, 60, x10, 0, 8)\
X(X11, 61, x11, 0, 8)\
X(X12, 62, x12, 0, 8)\
X(X13, 63, x13, 0, 8)\
X(X14, 64, x14, 0, 8)\
X(X15, 65, x15, 0, 8)\
X(IP0, 66, x16, 0, 8)\
X(IP1, 67, x17, 0, 8)\
X(X18, 68, x18, 0, 8)\
X(X19, 69, x19, 0, 8)\
X(X20, 70, x20, 0, 8)\
X(X21, 71, x21, 0, 8)\
X(X22, 72, x22, 0, 8)\
X(X23, 73, x23, 0, 8)\
X(X24, 74, x24, 0, 8)\
X(X25, 75, x25, 0, 8)\
X(X26, 76, x26, 0, 8)\
X(X27, 77, x27, 0, 8)\
X(X28, 78, x28, 0, 8)\
X(FP, 79, x29, 0, 8)\
X(LR, 80, x30, 0, 8)\
X(SP, 81, x31, 0, 8)\
X(ZR, 82, x31, 0, 8)\
X(NZCV, 90, context_flags, 0, 4)\
X(S0, 100, v0, 0, 4)\
X(S1, 101, v1, 0, 4)\
X(S2, 102, v2, 0, 4)\
X(S3, 103, v3, 0, 4)\
X(S4, 104, v4, 0, 4)\
X(S5, 105, v5, 0, 4)\
X(S6, 106, v6, 0, 4)\
X(S7, 107, v7, 0, 4)\
X(S8, 108, v8, 0, 4)\
X(S9, 109, v9, 0, 4)\
X(S10, 110, v10, 0, 4)\
X(S11, 111, v11, 0, 4)\
X(S12, 112, v12, 0, 4)\
X(S13, 113, v13, 0, 4)\
X(S14, 114, v14, 0, 4)\
X(S15, 115, v15, 0, 4)\
X(S16, 116, v16, 0, 4)\
X(S17, 117, v17, 0, 4)\
X(S18, 118, v18, 0, 4)\
X(S19, 119, v19, 0, 4)\
X(S20, 120, v20, 0, 4)\
X(S21, 121, v21, 0, 4)\
X(S22, 122, v22, 0, 4)\
X(S23, 123, v23, 0, 4)\
X(S24, 124, v24, 0, 4)\
X(S25, 125, v25, 0, 4)\
X(S26, 126, v26, 0, 4)\
X(S27, 127, v27, 0, 4)\
X(S28, 128, v28, 0, 4)\
X(S29, 129, v29, 0, 4)\
X(S30, 130, v30, 0, 4)\
X(S31, 131, v31, 0, 4)\
X(D0, 140, v0, 0, 8)\
X(D1, 141, v1, 0, 8)\
X(D2, 142, v2, 0, 8)\
X(D3, 143, v3, 0, 8)\
X(D4, 144, v4, 0, 8)\
X(D5, 145, v5, 0, 8)\
X(D6, 146, v6, 0, 8)\
X(D7, 147, v7, 0, 8)\
X(D8, 148, v8, 0, 8)\
X(D9, 149, v9, 0, 8)\
X(D10, 150, v10, 0, 8)\
X(D11, 151, v11, 0, 8)\
X(D12, 152, v12, 0, 8)\
X(D13, 153, v13, 0, 8)\
X(D14, 154, v14, 0, 8)\
X(D15, 155, v15, 0, 8)\
X(D16, 156, v16, 0, 8)\
X(D17, 157, v17, 0, 8)\
X(D18, 158, v18, 0, 8)\
X(D19, 159, v19, 0, 8)\
X(D20, 160, v20, 0, 8)\
X(D21, 161, v21, 0, 8)\
X(D22, 162, v22, 0, 8)\
X(D23, 163, v23, 0, 8)\
X(D24, 164, v24, 0, 8)\
X(D25, 165, v25, 0, 8)\
X(D26, 166, v26, 0, 8)\
X(D27, 167, v27, 0, 8)\
X(D28, 168, v28, 0, 8)\
X(D29, 169, v29, 0, 8)\
X(D30, 170, v30, 0, 8)\
X(D31, 171, v31, 0, 8)\
X(Q0, 180, v0, 0, 16)\
X(Q1, 181, v1, 0, 16)\
X(Q2, 182, v2, 0, 16)\
X(Q3, 183, v3, 0, 16)\
X(Q4, 184, v4, 0, 16)\
X(Q5, 185, v5, 0, 16)\
X(Q6, 186, v6, 0, 16)\
X(Q7, 187, v7, 0, 16)\
X(Q8, 188, v8, 0, 16)\
X(Q9, 189, v9, 0, 16)\
X(Q10, 190, v10, 0, 16)\
X(Q11, 191, v11, 0, 16)\
X(Q12, 192, v12, 0, 16)\
X(Q13, 193, v13, 0, 16)\
X(Q14, 194, v14, 0, 16)\
X(Q15, 195, v15, 0, 16)\
X(Q16, 196, v16, 0, 16)\
X(Q17, 197, v17, 0, 16)\
X(Q18, 198, v18, 0, 16)\
X(Q19, 199, v19, 0, 16)\
X(Q20, 200, v20, 0, 16)\
X(Q21, 201, v21, 0, 16)\
X(Q22, 202, v22, 0, 16)\
X(Q23, 203, v23, 0, 16)\
X(Q24, 204, v24, 0, 16)\
X(Q25, 205, v25, 0, 16)\
X(Q26, 206, v26, 0, 16)\
X(Q27, 207, v27, 0, 16)\
X(Q28, 208, v28, 0, 16)\
X(Q29, 209, v29, 0, 16)\
X(Q30, 210, v30, 0, 16)\
X(Q31, 211, v31, 0, 16)\
X(FPSR, 220, fpsr, 0, 4)

typedef U16 CV_Regarm64;
typedef enum CV_Regarm64Enum
{
#define X(CVN,C,RDN,BP,BZ) CV_Regarm64_##CVN = C,
CV_Reg_ARM64_XList(X)
#undef X
}
CV_Regarm64Enum;

#define CV_SignatureXList(X) \
X(C6, 0) \
Expand Down
Loading