Skip to content

Commit 7f45488

Browse files
committed
[SDK][NTOSKRNL] Simple fixes
1 parent 0f58bbe commit 7f45488

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

ntoskrnl/include/ntoskrnl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
#endif
1818

1919
/* WDK hacks */
20+
#ifdef _M_ARM64
21+
#define IoAllocateAdapterChannel _IoAllocateAdapterChannel
22+
#define KeGetCurrentThread _KeGetCurrentThread
23+
#define RtlFillMemoryUlong _RtlFillMemoryUlong
24+
#endif
25+
2026
#ifdef _M_AMD64
2127
#define IoAllocateAdapterChannel _IoAllocateAdapterChannel
2228
#define KeGetCurrentThread _KeGetCurrentThread

sdk/include/ndk/psfuncs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
427427
// return (struct _TEB *)KeGetPcr()->Used_Self;
428428
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW);
429429
#elif defined (_M_ARM64)
430-
return (struct _TEB *)__getReg(18);
430+
return (struct _TEB *)__readx18qword(FIELD_OFFSET(NT_TIB, Self));
431431
#else
432432
#error Unsupported architecture
433433
#endif

sdk/include/xdk/winnt_old.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,12 +4612,15 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
46124612
#elif defined (_M_ARM64)
46134613
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
46144614
{
4615-
return (struct _TEB *)__getReg(18);
4615+
return (struct _TEB *)__readx18qword(FIELD_OFFSET(NT_TIB, Self));
46164616
}
46174617
FORCEINLINE PVOID GetCurrentFiber(VOID)
46184618
{
4619-
//UNIMPLEMENTED;
4620-
return 0;
4619+
#ifdef NONAMELESSUNION
4620+
return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, DUMMYUNIONNAME.FiberData));
4621+
#else
4622+
return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData));
4623+
#endif
46214624
}
46224625
#elif defined(_M_PPC)
46234626
FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)

sdk/lib/rtl/exception.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PRTLP_UNHANDLED_EXCEPTION_FILTER RtlpUnhandledExceptionFilter;
2222

2323
/* FUNCTIONS ***************************************************************/
2424

25-
#if !defined(_M_IX86) && !defined(_M_AMD64)
25+
#if !defined(_M_IX86) && !defined(_M_AMD64) && !defined(_M_ARM64)
2626

2727
/*
2828
* @implemented

sdk/lib/rtl/slist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ RtlInterlockedPushListSList(
208208
}
209209

210210

211-
#if !defined(_M_IX86) && !defined(_M_AMD64)
211+
#if !defined(_M_IX86) && !defined(_M_AMD64) && !defined(_M_ARM64)
212212

213213
_WARN("C based S-List functions can bugcheck, if not handled properly in kernel")
214214

0 commit comments

Comments
 (0)