https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2204695f0a87741b9b622…
commit 2204695f0a87741b9b6224625a4707e59b9c9995
Author: Justin Miller <justinmiller100(a)gmail.com>
AuthorDate: Mon Dec 13 05:16:45 2021 -0800
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Thu Apr 7 19:50:43 2022 +0300
[SDK] Fix some arm64 stuff that was discovered during testing
Addendum to 6dfc13e4. CORE-17518
---
CMakeLists.txt | 2 ++
sdk/include/crt/crtdefs.h | 2 +-
sdk/include/crt/vadefs.h | 6 ++--
sdk/include/ndk/asm.h | 2 +-
sdk/include/ndk/rtltypes.h | 2 ++
sdk/include/xdk/ketypes.h | 2 +-
sdk/include/xdk/ntbasedef.h | 2 +-
sdk/include/xdk/winnt_old.h | 70 +++++++++++++++++++++++--------------------
sdk/lib/runtmchk/rtcapi.c | 3 +-
sdk/tools/rsym/CMakeLists.txt | 2 ++
sdk/tools/rsym/rsym64.h | 1 +
11 files changed, 53 insertions(+), 41 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7dfcb64a841..2168dcb2422 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -280,6 +280,8 @@ Enable this if the module uses typeid or dynamic_cast. You will
probably need to
add_compile_definitions(USE_COMPILER_EXCEPTIONS)
elseif(ARCH STREQUAL "arm")
add_compile_definitions(USE_COMPILER_EXCEPTIONS)
+ elseif(ARCH STREQUAL "arm64")
+ add_compile_definitions(USE_COMPILER_EXCEPTIONS)
endif()
# Activate support for assembly source files
diff --git a/sdk/include/crt/crtdefs.h b/sdk/include/crt/crtdefs.h
index 582ae24edb2..bf01188fe9f 100644
--- a/sdk/include/crt/crtdefs.h
+++ b/sdk/include/crt/crtdefs.h
@@ -138,7 +138,7 @@
#endif
#ifndef UNALIGNED
-#if defined(__ia64__) || defined(__x86_64) || defined(__arm__)
+#if defined(__ia64__) || defined(__x86_64) || defined(__arm__) || defined(__arm64__)
#define UNALIGNED __unaligned
#else
#define UNALIGNED
diff --git a/sdk/include/crt/vadefs.h b/sdk/include/crt/vadefs.h
index 17ab6f61b59..bee42c465c0 100644
--- a/sdk/include/crt/vadefs.h
+++ b/sdk/include/crt/vadefs.h
@@ -72,12 +72,12 @@ extern "C" {
#define __va_copy(d,s) ((void)((d) = (s)))
#elif defined(_M_ARM64)
extern void __cdecl __va_start(va_list*, ...);
-#define __crt_va_start(ap,v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v),
__alignof(v), _ADDRESSOF(v))))
-#define __crt_va_arg(ap, t) \
+#define _crt_va_start(ap,v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v),
__alignof(v), _ADDRESSOF(v))))
+#define _crt_va_arg(ap, t) \
((sizeof(t) > (2 * sizeof(__int64))) \
? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \
: *(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t)))
-#define __crt_va_end(ap) ((void)(ap = (va_list)0))
+#define _crt_va_end(ap) ((void)(ap = (va_list)0))
#define __va_copy(d,s) ((void)((d) = (s)))
#else //if defined(_M_IA64) || defined(_M_CEE)
#error Please implement me
diff --git a/sdk/include/ndk/asm.h b/sdk/include/ndk/asm.h
index feb0ea4441d..ce2ada8cd1f 100644
--- a/sdk/include/ndk/asm.h
+++ b/sdk/include/ndk/asm.h
@@ -20,7 +20,7 @@ Author:
#include <i386/asm.h>
#elif defined(_M_AMD64)
#include <amd64/asm.h>
-#elif defined(_M_ARM) || defined(_M_PPC)
+#elif defined(_M_ARM) || defined(_M_PPC) || defined(_M_ARM64)
//
// ARM and PPC ports don't use asm.h
//
diff --git a/sdk/include/ndk/rtltypes.h b/sdk/include/ndk/rtltypes.h
index 0799bcce4cb..62bca65bee1 100644
--- a/sdk/include/ndk/rtltypes.h
+++ b/sdk/include/ndk/rtltypes.h
@@ -196,6 +196,8 @@ C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF);
#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARM
#elif defined(_M_AMD64)
#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_AMD64
+#elif defined(_M_ARM64)
+#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARM64
#else
#error Define these please!
#endif
diff --git a/sdk/include/xdk/ketypes.h b/sdk/include/xdk/ketypes.h
index 2b0c99a867f..fdeee0904a3 100644
--- a/sdk/include/xdk/ketypes.h
+++ b/sdk/include/xdk/ketypes.h
@@ -980,7 +980,7 @@ typedef struct _XSTATE_SAVE {
struct _KTHREAD* Thread;
UCHAR Level;
XSTATE_CONTEXT XStateContext;
-#elif defined(_IA64_) || defined(_ARM_)
+#elif defined(_IA64_) || defined(_ARM_) || defined(_ARM64_)
ULONG Dummy;
#elif defined(_X86_)
_ANONYMOUS_UNION union {
diff --git a/sdk/include/xdk/ntbasedef.h b/sdk/include/xdk/ntbasedef.h
index 753bfd0f1b5..2cb40d0ee17 100644
--- a/sdk/include/xdk/ntbasedef.h
+++ b/sdk/include/xdk/ntbasedef.h
@@ -68,7 +68,7 @@
#pragma strict_gs_check(push, on)
#endif
-#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) ||
defined(_M_AMD64) || defined(_M_ARM)
+#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) ||
defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)
#define ALIGNMENT_MACHINE
#define UNALIGNED __unaligned
#if defined(_WIN64)
diff --git a/sdk/include/xdk/winnt_old.h b/sdk/include/xdk/winnt_old.h
index c554bafa12e..b043574a15d 100644
--- a/sdk/include/xdk/winnt_old.h
+++ b/sdk/include/xdk/winnt_old.h
@@ -2192,39 +2192,39 @@ typedef struct _CONTEXT {
DWORD Cpsr;
union {
- struct {
- DWORD64 X0;
- DWORD64 X1;
- DWORD64 X2;
- DWORD64 X3;
- DWORD64 X4;
- DWORD64 X5;
- DWORD64 X6;
- DWORD64 X7;
- DWORD64 X8;
- DWORD64 X9;
- DWORD64 X10;
- DWORD64 X11;
- DWORD64 X12;
- DWORD64 X13;
- DWORD64 X14;
- DWORD64 X15;
- DWORD64 X16;
- DWORD64 X17;
- DWORD64 X18;
- DWORD64 X19;
- DWORD64 X20;
- DWORD64 X21;
- DWORD64 X22;
- DWORD64 X23;
- DWORD64 X24;
- DWORD64 X25;
- DWORD64 X26;
- DWORD64 X27;
- DWORD64 X28;
- DWORD64 Fp;
- DWORD64 Lr;
- } DUMMYSTRUCTNAME;
+ struct {
+ DWORD64 X0;
+ DWORD64 X1;
+ DWORD64 X2;
+ DWORD64 X3;
+ DWORD64 X4;
+ DWORD64 X5;
+ DWORD64 X6;
+ DWORD64 X7;
+ DWORD64 X8;
+ DWORD64 X9;
+ DWORD64 X10;
+ DWORD64 X11;
+ DWORD64 X12;
+ DWORD64 X13;
+ DWORD64 X14;
+ DWORD64 X15;
+ DWORD64 X16;
+ DWORD64 X17;
+ DWORD64 X18;
+ DWORD64 X19;
+ DWORD64 X20;
+ DWORD64 X21;
+ DWORD64 X22;
+ DWORD64 X23;
+ DWORD64 X24;
+ DWORD64 X25;
+ DWORD64 X26;
+ DWORD64 X27;
+ DWORD64 X28;
+ DWORD64 Fp;
+ DWORD64 Lr;
+ } DUMMYSTRUCTNAME;
DWORD64 X[31];
} DUMMYUNIONNAME;
@@ -4440,6 +4440,8 @@ FORCEINLINE PVOID GetFiberData(void)
#define PreFetchCacheLine(l, a)
#elif defined(_M_ARM)
#define PreFetchCacheLine(l, a)
+#elif defined(_M_ARM64)
+#define PreFetchCacheLine(l, a)
#else
#error Unknown architecture
#endif
@@ -4470,6 +4472,8 @@ MemoryBarrier(VOID)
#define MemoryBarrier()
#elif defined(_M_ARM)
#define MemoryBarrier()
+#elif defined(_M_ARM64)
+#define MemoryBarrier()
#else
#error Unknown architecture
#endif
diff --git a/sdk/lib/runtmchk/rtcapi.c b/sdk/lib/runtmchk/rtcapi.c
index 82d4cd45da0..20e3a5b4b3b 100644
--- a/sdk/lib/runtmchk/rtcapi.c
+++ b/sdk/lib/runtmchk/rtcapi.c
@@ -16,7 +16,7 @@
#endif
// Provide a fallback memset for libraries like kbdrost.dll
-#if defined(_M_ARM)
+#if defined(_M_ARM) || defined(_M_ARM64)
void* __cdecl memset_fallback(void* src, int val, size_t count)
{
char *char_src = (char *)src;
@@ -29,6 +29,7 @@ void* __cdecl memset_fallback(void* src, int val, size_t count)
return src;
}
#pragma comment(linker, "/alternatename:memset=memset_fallback")
+#pragma comment(linker, "/alternatename:__RTC_memset=memset_fallback")
#endif
int
diff --git a/sdk/tools/rsym/CMakeLists.txt b/sdk/tools/rsym/CMakeLists.txt
index 6d3c8ed443c..493278ecfd6 100644
--- a/sdk/tools/rsym/CMakeLists.txt
+++ b/sdk/tools/rsym/CMakeLists.txt
@@ -9,6 +9,8 @@ elseif(ARCH STREQUAL "amd64")
add_host_tool(rsym rsym64.c)
elseif(ARCH STREQUAL "arm")
add_executable(rsym rsym64.c)
+elseif(ARCH STREQUAL "arm64")
+ add_executable(rsym rsym64.c)
endif()
target_link_libraries(rsym PRIVATE host_includes rsym_common dbghelphost unicode)
diff --git a/sdk/tools/rsym/rsym64.h b/sdk/tools/rsym/rsym64.h
index 4000a42d577..a167159fd95 100644
--- a/sdk/tools/rsym/rsym64.h
+++ b/sdk/tools/rsym/rsym64.h
@@ -12,6 +12,7 @@ typedef uint64_t ULONG64;
#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_AMD64 0x8664
+#define IMAGE_FILE_MACHINE_ARM64 0xaa64
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3