[SDK] Fix some arm64 stuff that was discovered during testing

Addendum to 6dfc13e4. CORE-17518
This commit is contained in:
Justin Miller 2021-12-13 05:16:45 -08:00 committed by Stanislav Motylkov
parent 3cee1f718b
commit 2204695f0a
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92
11 changed files with 53 additions and 41 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
//

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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