[SDK] Small SDK fixes for ARM64 - Prepping for GCC work (#8458)

* [SDK] add ARM64 entry to ioaccess.h
* [SDK] Add arm64 target to win64 spec2def entry
* [SDK] Implement NtCurrentTeb for ARM64
CORE-18200

Co-authored-by: Laura Konopinska <[email protected]>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <[email protected]>
This commit is contained in:
Justin Miller
2025-11-17 05:47:53 -08:00
committed by GitHub
co-authored by Laura Konopinska Hermès BÉLUSCA - MAÏTO
parent 0f9cdb395a
commit 5a36dd6006
8 changed files with 18 additions and 7 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ extern "C" {
#define MEMORY_BARRIER()
#elif defined(_PPC_) || defined(_MIPS_) || defined(_ARM_)
#elif defined(_PPC_) || defined(_MIPS_) || defined(_ARM_) || defined(_ARM64_)
#define READ_REGISTER_UCHAR(r) (*(volatile UCHAR * const)(r))
#define READ_REGISTER_USHORT(r) (*(volatile USHORT * const)(r))
+5
View File
@@ -54,6 +54,11 @@ extern "C" {
//
#define DOUBLE_FAULT_STACK_SIZE 0x8000
//
// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
//
#define KSEG0_BASE 0xfffff80000000000ULL
//
// Structure for CPUID info
//
+1 -2
View File
@@ -427,8 +427,7 @@ FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
// return (struct _TEB *)KeGetPcr()->Used_Self;
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW);
#elif defined (_M_ARM64)
//UNIMPLEMENTED;
return 0;
return (struct _TEB *)__getReg(18);
// #elif defined(_M_PPC)
// return (struct _TEB *)_read_teb_dword(0x18);
#else
+4
View File
@@ -1007,6 +1007,10 @@ int _isunorderedf(float, float);
#endif /* _M_ARM */
#ifdef _M_ARM64
unsigned __int64 __getReg(int);
#endif
#if defined(_M_CEE_PURE)
long _InterlockedCompareExchange(_Interlocked_operand_ long volatile * _Destination, long _Exchange, long _Comparand);
+4
View File
@@ -380,6 +380,10 @@ void _sgdt(void *Destination);
#pragma intrinsic(__sev)
#endif
#if defined(_M_ARM64)
#pragma intrinsic(__getReg)
#endif
/** Secure virtual machine **/
#if defined(_M_IX86) || defined(_M_AMD64)
#pragma intrinsic(__svm_clgi)
+1 -2
View File
@@ -4579,8 +4579,7 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
#elif defined (_M_ARM64)
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
{
//UNIMPLEMENTED;
return 0;
return (struct _TEB *)__getReg(18);
}
FORCEINLINE PVOID GetCurrentFiber(VOID)
{
+1 -1
View File
@@ -48,7 +48,7 @@ list(APPEND SOURCE
add_library(freetype ${SOURCE})
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND ARCH STREQUAL "amd64")
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND (ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64"))
# error C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size
remove_target_compile_option(freetype "/we4312")
endif()
+1 -1
View File
@@ -1619,7 +1619,7 @@ int main(int argc, char *argv[])
else if (strcasecmp(pszArchString, "arm64") == 0) giArch = ARCH_ARM64;
else if (strcasecmp(pszArchString, "ppc") == 0) giArch = ARCH_PPC;
if ((giArch == ARCH_AMD64) || (giArch == ARCH_IA64))
if ((giArch == ARCH_AMD64) || (giArch == ARCH_IA64) || (giArch == ARCH_ARM64))
{
pszArchString2 = "win64";
}