mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
352b7f6785
The definitions in the NDK inline_ntcurrentteb.h and psfuncs.h files are synced togther with those of winnt.h (in the winnt_old.h generator file). See commitsc1929445d
(r49627) and925c587c8
(r56318). IMPORTANT NOTE: The ARM64 definition does not exist yet in our headers!
31 lines
712 B
C
31 lines
712 B
C
#ifndef _INLINE_NT_CURRENTTEB_H_
|
|
#define _INLINE_NT_CURRENTTEB_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
|
|
{
|
|
#if defined(_M_IX86)
|
|
return (struct _TEB *)__readfsdword(0x18);
|
|
#elif defined(_M_AMD64)
|
|
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
|
|
#elif defined(_M_ARM)
|
|
// return (struct _TEB *)KeGetPcr()->Used_Self;
|
|
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW);
|
|
#elif defined (_M_ARM64)
|
|
//UNIMPLEMENTED;
|
|
return 0;
|
|
// #elif defined(_M_PPC)
|
|
// return (struct _TEB *)_read_teb_dword(0x18);
|
|
#else
|
|
#error Unsupported architecture
|
|
#endif
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _INLINE_NT_CURRENTTEB_H_
|