Post · 1 min read· pp. 1257–1258

KSPECIAL_REGISTERS (amd64)

The KSPECIAL_REGISTERS (formally _KSPECIAL_REGISTERS) is a structure for recording processor state that is not ordinarily needed in a CONTEXT structure. It is necessarily highly specific to the processor architecture. Public symbols for the kernel starting with Windows 8 confirm that Microsoft defines the structure separately (in different headers) for different processors. This page concerns itself only with the KSPECIAL_REGISTERS in 64-bit Windows for the processor architecture that’s variously named amd64 or x64. The x86 KSPECIAL_REGISTERS is presented separately.

The KSPECIAL_REGISTERS is 0xD8 bytes before version 6.2 and is then 0xE0 bytes.

OffsetDefinitionVersions
0x00ULONG64 Cr0;all
0x08ULONG64 Cr2;all
0x10ULONG64 Cr3;all
0x18ULONG64 Cr4;all
0x20ULONG64 KernelDr0;all
0x28ULONG64 KernelDr1;all
0x30ULONG64 KernelDr2;all
0x38ULONG64 KernelDr3;all
0x40ULONG64 KernelDr6;all
0x48ULONG64 KernelDr7;all
0x50KDESCRIPTOR Gdtr;all
0x60KDESCRIPTOR Idtr;all
0x70USHORT Tr;all
0x72USHORT Ldtr;all
0x74ULONG MxCsr;all
0x78ULONG64 DebugControl;all
0x80ULONG64 LastBranchToRip;all
0x88ULONG64 LastBranchFromRip;all
0x90ULONG64 LastExceptionToRip;all
0x98ULONG64 LastExceptionFromRip;all
0xA0ULONG64 Cr8;all
0xA8ULONG64 MsrGsBase;all
0xB0ULONG64 MsrGsSwap;all
0xB8ULONG64 MsrStar;all
0xC0ULONG64 MsrLStar;all
0xC8ULONG64 MsrCStar;all
0xD0ULONG64 MsrSyscallMask;all
0xD8ULONG64 Xcr0;6.2 and higher