Author: tkreuzer
Date: Wed Oct 14 18:45:35 2009
New Revision: 43455
URL:
http://svn.reactos.org/svn/reactos?rev=43455&view=rev
Log:
Merge amd64 NDK from amd64 branch:
34711, 34712, 34842, 34925, 34967, 34970, 35323, 35324, 35347, 35348, 35361, 35436, 35509,
35588, 35739, 35823, 35952, 35966, 36360, 37323, 37434, 37472, 37536, 37820, 37821, 37869,
37990, 38013, 38014, 43426, 43454
Added:
trunk/reactos/include/ndk/amd64/ (props changed)
- copied from r34711, branches/ros-amd64-bringup/reactos/include/ndk/amd64/
trunk/reactos/include/ndk/amd64/asm.h
- copied, changed from r35966,
branches/ros-amd64-bringup/reactos/include/ndk/amd64/asm.h
trunk/reactos/include/ndk/amd64/asmmacro.S (contents, props changed)
- copied, changed from r37472,
branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S
Modified:
trunk/reactos/ (props changed)
trunk/reactos/include/ndk/amd64/ketypes.h
trunk/reactos/include/ndk/amd64/mmtypes.h
trunk/reactos/include/ndk/arch/ketypes.h
trunk/reactos/include/ndk/asm.h
trunk/reactos/include/ndk/pstypes.h
Propchange: trunk/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 18:45:35 2009
@@ -1,1 +1,1 @@
-/branches/ros-amd64-bringup/reactos:34743,34812,34839,34917,35515,35746,35771,35789,35902,35904-35906,35942,35947-35949,35953,36013,36388-36389,36570,36614,36930,37873,37991,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
+/branches/ros-amd64-bringup/reactos:34711-34712,34743,34812,34839,34842,34917,35323-35324,35347-35348,35361,35436,35509,35515,35588,35739,35746,35771,35789,35823,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36360,36388-36389,36570,36614,36930,37323,37434,37472,37475,37536,37820-37821,37869,37873,37990-37991,38013-38014,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080,43426,43454
Propchange: trunk/reactos/include/ndk/amd64/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Oct 14 18:45:35 2009
@@ -1,0 +1,1 @@
+/branches/ros-amd64-bringup/reactos/include/ndk/amd64:34925,34967,34970,35323-35324,35347-35348,35361,35436,35509,35588,35739,35823,35952,35966,36360,37323,37434,37472,37475,37536,37820-37821,37869,37990,38013-38014,43426,43454
Copied: trunk/reactos/include/ndk/amd64/asm.h (from r35966,
branches/ros-amd64-bringup/reactos/include/ndk/amd64/asm.h)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/asm.h?p2…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/ndk/amd64/asm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/asm.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -50,6 +50,11 @@
#define KTHREAD_STACK_LIMIT 0x30
#define KTHREAD_WAIT_IRQL 0x156
+//
+// KPRCB Offsets
+//
+#define KPRCB_CurrentThread 0x08
+
//
// KPCR Offsets
@@ -57,12 +62,145 @@
#define KPCR_TSS_BASE 0x08
#define KPCR_SELF 0x18
#define KPCR_STALL_SCALE_FACTOR 0x64
-
-//
-// Trap Frame Offsets
-//
+#define KPCR_PRCB 0x180
+
+//
+// KTRAP_FRAME Offsets
+//
+#define KTRAP_FRAME_P1Home 0x00
+#define KTRAP_FRAME_P2Home 0x08
+#define KTRAP_FRAME_P3Home 0x10
+#define KTRAP_FRAME_P4Home 0x18
+#define KTRAP_FRAME_P5 0x20
+#define KTRAP_FRAME_PreviousMode 0x28
+#define KTRAP_FRAME_PreviousIrql 0x29
+#define KTRAP_FRAME_FaultIndicator 0x2A
+#define KTRAP_FRAME_ExceptionActive 0x2B
+#define KTRAP_FRAME_MxCsr 0x2C
+#define KTRAP_FRAME_Rax 0x30
+#define KTRAP_FRAME_Rcx 0x38
+#define KTRAP_FRAME_Rdx 0x40
+#define KTRAP_FRAME_R8 0x48
+#define KTRAP_FRAME_R9 0x50
+#define KTRAP_FRAME_R10 0x58
+#define KTRAP_FRAME_R11 0x60
+#define KTRAP_FRAME_GsBase 0x68
+#define KTRAP_FRAME_Xmm0 0x70
+#define KTRAP_FRAME_Xmm1 0x80
+#define KTRAP_FRAME_Xmm2 0x90
+#define KTRAP_FRAME_Xmm3 0xA0
+#define KTRAP_FRAME_Xmm4 0xB0
+#define KTRAP_FRAME_Xmm5 0xC0
+#define KTRAP_FRAME_FaultAddress 0xD0
+#define KTRAP_FRAME_Dr0 0xD8
+#define KTRAP_FRAME_Dr1 0xE0
+#define KTRAP_FRAME_Dr2 0xE8
+#define KTRAP_FRAME_Dr3 0xF0
+#define KTRAP_FRAME_Dr6 0xF8
+#define KTRAP_FRAME_Dr7 0x100
+#define KTRAP_FRAME_DebugControl 0x108
+#define KTRAP_FRAME_LastBranchToRip 0x110
+#define KTRAP_FRAME_LastBranchFromRip 0x118
+#define KTRAP_FRAME_LastExceptionToRip 0x120
+#define KTRAP_FRAME_LastExceptionFromRip 0x128
+#define KTRAP_FRAME_SegDs 0x130
+#define KTRAP_FRAME_SegEs 0x132
+#define KTRAP_FRAME_SegFs 0x134
+#define KTRAP_FRAME_SegGs 0x136
+#define KTRAP_FRAME_TrapFrame 0x138
+#define KTRAP_FRAME_Rbx 0x140
+#define KTRAP_FRAME_Rdi 0x148
+#define KTRAP_FRAME_Rsi 0x150
+#define KTRAP_FRAME_Rbp 0x158
+#define KTRAP_FRAME_ErrorCode 0x160
+#define KTRAP_FRAME_Rip 0x168
+#define KTRAP_FRAME_SegCs 0x170
+#define KTRAP_FRAME_Logging 0x173
+#define KTRAP_FRAME_EFlags 0x178
+#define KTRAP_FRAME_Rsp 0x180
+#define KTRAP_FRAME_SegSs 0x188
+#define KTRAP_FRAME_CodePatchCycle 0x18c
+#define SIZE_KTRAP_FRAME 0x190
#define KTRAP_FRAME_ALIGN 0x10
#define KTRAP_FRAME_LENGTH 0x190
+
+//
+// CONTEXT Offsets
+//
+#define CONTEXT_P1Home 0
+#define CONTEXT_P2Home 0x08
+#define CONTEXT_P3Home 0x10
+#define CONTEXT_P4Home 0x18
+#define CONTEXT_P5Home 0x20
+#define CONTEXT_P6Home 0x28
+#define CONTEXT_ContextFlags 0x30
+#define CONTEXT_MxCsr 0x34
+#define CONTEXT_SegCs 0x38
+#define CONTEXT_SegDs 0x3a
+#define CONTEXT_SegEs 0x3c
+#define CONTEXT_SegFs 0x3e
+#define CONTEXT_SegGs 0x40
+#define CONTEXT_SegSs 0x42
+#define CONTEXT_EFlags 0x44
+#define CONTEXT_Dr0 0x48
+#define CONTEXT_Dr1 0x50
+#define CONTEXT_Dr2 0x58
+#define CONTEXT_Dr3 0x60
+#define CONTEXT_Dr6 0x68
+#define CONTEXT_Dr7 0x70
+#define CONTEXT_Rax 0x78
+#define CONTEXT_Rcx 0x80
+#define CONTEXT_Rdx 0x88
+#define CONTEXT_Rbx 0x90
+#define CONTEXT_Rsp 0x98
+#define CONTEXT_Rbp 0xa0
+#define CONTEXT_Rsi 0xa8
+#define CONTEXT_Rdi 0xb0
+#define CONTEXT_R8 0xb8
+#define CONTEXT_R9 0xc0
+#define CONTEXT_R10 0xc8
+#define CONTEXT_R11 0xd0
+#define CONTEXT_R12 0xd8
+#define CONTEXT_R13 0xe0
+#define CONTEXT_R14 0xe8
+#define CONTEXT_R15 0xf0
+#define CONTEXT_Rip 0xf8
+#define CONTEXT_Header 0x100
+#define CONTEXT_Legacy 0x120
+#define CONTEXT_Xmm0 0x1a0
+#define CONTEXT_Xmm1 0x1b0
+#define CONTEXT_Xmm2 0x1c0
+#define CONTEXT_Xmm3 0x1d0
+#define CONTEXT_Xmm4 0x1e0
+#define CONTEXT_Xmm5 0x1f0
+#define CONTEXT_Xmm6 0x200
+#define CONTEXT_Xmm7 0x210
+#define CONTEXT_Xmm8 0x220
+#define CONTEXT_Xmm9 0x230
+#define CONTEXT_Xmm10 0x240
+#define CONTEXT_Xmm11 0x250
+#define CONTEXT_Xmm12 0x260
+#define CONTEXT_Xmm13 0x270
+#define CONTEXT_Xmm14 0x280
+#define CONTEXT_Xmm15 0x290
+#define CONTEXT_VectorRegister 0x300
+#define CONTEXT_VectorControl 0x4a0
+#define CONTEXT_DebugControl 0x4a8
+#define CONTEXT_LastBranchToRip 0x4b0
+#define CONTEXT_LastBranchFromRip 0x4b8
+#define CONTEXT_LastExceptionToRip 0x4c0
+#define CONTEXT_LastExceptionFromRip 0x4c8
+
+//
+// EXCEPTION_RECORD Offsets
+//
+#define EXCEPTION_RECORD_ExceptionCode 0x00
+#define EXCEPTION_RECORD_ExceptionFlags 0x04
+#define EXCEPTION_RECORD_ExceptionRecord 0x08
+#define EXCEPTION_RECORD_ExceptionAddress 0x10
+#define EXCEPTION_RECORD_NumberParameters 0x18
+#define EXCEPTION_RECORD_ExceptionInformation 0x20
+#define SIZE_EXCEPTION_RECORD 0x98
//
// CR0
@@ -80,10 +218,35 @@
#define CR0_PG 0x80000000
//
+// CR4
+//
+#define CR4_VME 0x1
+#define CR4_PVI 0x2
+#define CR4_TSD 0x4
+#define CR4_DE 0x8
+#define CR4_PSE 0x10
+#define CR4_PAE 0x20
+#define CR4_MCE 0x40
+#define CR4_PGE 0x80
+#define CR4_FXSR 0x200
+#define CR4_XMMEXCPT 0x400
+
+//
// Generic Definitions
//
#define PRIMARY_VECTOR_BASE 0x30
#define MAXIMUM_IDTVECTOR 0xFF
+
+//
+// Usermode callout frame definitions
+//
+#define CBSTACK_STACK 0x0
+#define CBSTACK_TRAP_FRAME 0x8
+#define CBSTACK_CALLBACK_STACK 0x10
+#define CBSTACK_RBP 0x18
+#define CBSTACK_RESULT 0x20
+#define CBSTACK_RESULT_LENGTH 0x28
+#define CBSTACK_FRAME_POINTER CBSTACK_RBP
/* Following ones are ASM only! ***********************************************/
@@ -110,6 +273,43 @@
#define EFLAG_SELECT (EFLAG_SIGN + EFLAG_ZERO)
#define EFLAGS_USER_SANITIZE 0x3F4DD7
+//
+// NTSTATUS and Bugcheck Codes
+//
+#define STATUS_ACCESS_VIOLATION 0xC0000005
+#define STATUS_IN_PAGE_ERROR 0xC0000006
+#define STATUS_GUARD_PAGE_VIOLATION 0x80000001
+#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
+#define STATUS_STACK_OVERFLOW 0xC00000FD
+#define KI_EXCEPTION_ACCESS_VIOLATION 0x10000004
+#define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
+#define STATUS_NO_CALLBACK_ACTIVE 0xC0000258
+#define STATUS_CALLBACK_POP_STACK 0xC0000423
+#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
+#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
+#define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
+#define STATUS_BREAKPOINT 0x80000003
+#define STATUS_SINGLE_STEP 0x80000004
+#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
+#define STATUS_INTEGER_OVERFLOW 0xC0000095
+#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
+#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
+#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
+#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
+#define STATUS_FLOAT_OVERFLOW 0xC0000091
+#define STATUS_FLOAT_STACK_CHECK 0xC0000092
+#define STATUS_FLOAT_UNDERFLOW 0xC0000093
+#define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
+#define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
+#define APC_INDEX_MISMATCH 0x01
+#define IRQL_NOT_GREATER_OR_EQUAL 0x09
+#define IRQL_NOT_LESS_OR_EQUAL 0x0A
+#define TRAP_CAUSE_UNKNOWN 0x12
+#define KMODE_EXCEPTION_NOT_HANDLED 0x13
+#define IRQL_GT_ZERO_AT_SYSTEM_SERVICE 0x4A
+#define UNEXPECTED_KERNEL_MODE_TRAP 0x7F
+#define ATTEMPTED_SWITCH_FROM_DPC 0xB8
+#define HARDWARE_INTERRUPT_STORM 0xF2
//
// IRQL Levels
Copied: trunk/reactos/include/ndk/amd64/asmmacro.S (from r37472,
branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/asmmacro…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S [iso-8859-1]
(original)
+++ trunk/reactos/include/ndk/amd64/asmmacro.S [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -63,11 +63,11 @@
.macro .endprolog
.endm
-.macro UNIMPLEMENTED2 line, func
+.macro UNIMPLEMENTED2 file, line, func
jmp 3f
.equ expr, 12
1: .asciz "\func"
-2: .asciz __FILE__
+2: .asciz "\file"
3:
sub rsp, 0x20
lea rcx, _MsgUnimplemented[rip]
@@ -77,5 +77,5 @@
call _DbgPrint
add rsp, 0x20
.endm
-#define UNIMPLEMENTED UNIMPLEMENTED2 __LINE__,
+#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__,
Propchange: trunk/reactos/include/ndk/amd64/asmmacro.S
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/include/ndk/amd64/asmmacro.S
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Oct 14 18:45:35 2009
@@ -1,0 +1,1 @@
+/branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S:37475,37536,37820-37821,37869,37990,38013-38014,43426,43454
Modified: trunk/reactos/include/ndk/amd64/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/ketypes.…
==============================================================================
--- trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -1,23 +1,25 @@
/*++ NDK Version: 0098
Copyright (c) Alex Ionescu. All rights reserved.
+Copyright (c) Timo Kreuzer. All rights reserved.
Header Name:
- ketypes.h (X86)
+ ketypes.h (AMD64)
Abstract:
- i386 Type definitions for the Kernel services.
+ amd64 Type definitions for the Kernel services.
Author:
Alex Ionescu (alexi(a)tinykrnl.org) - Updated - 27-Feb-2006
+ Timo Kreuzer (timo.kreuzer(a)reactos.org) - Updated - 14-Aug-2008
--*/
-#ifndef _I386_KETYPES_H
-#define _I386_KETYPES_H
+#ifndef _AMD64_KETYPES_H
+#define _AMD64_KETYPES_H
//
// Dependencies
@@ -26,12 +28,13 @@
//
// KPCR Access for non-IA64 builds
//
-#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
-#define PCR ((volatile KPCR * const)K0IPCR)
-#if defined(CONFIG_SMP) || defined(NT_BUILD)
-#undef KeGetPcr
-#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
-#endif
+//#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
+//#define PCR ((volatile KPCR * const)K0IPCR)
+#define PCR ((volatile KPCR * const)__readgsqword(FIELD_OFFSET(KPCR, Self)))
+//#if defined(CONFIG_SMP) || defined(NT_BUILD)
+//#undef KeGetPcr
+//#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
+//#endif
//
// Machine Types
@@ -55,16 +58,13 @@
//
#define RPL_MASK 0x0003
#define MODE_MASK 0x0001
-#define KGDT_R0_CODE 0x8
-#define KGDT_R0_DATA 0x10
-#define KGDT_R3_CODE 0x18
-#define KGDT_R3_DATA 0x20
-#define KGDT_TSS 0x28
-#define KGDT_R0_PCR 0x30
-#define KGDT_R3_TEB 0x38
-#define KGDT_LDT 0x48
-#define KGDT_DF_TSS 0x50
-#define KGDT_NMI_TSS 0x58
+#define KGDT_64_R0_CODE 0x0010
+#define KGDT_64_R0_SS 0x0018
+#define KGDT_64_DATA 0x0028 // 2b
+#define KGDT_64_R3_CODE 0x0030 // 33
+#define KGDT_TSS 0x0040
+#define KGDT_32_R3_TEB 0x0050 // 53
+
//
// CR4
@@ -131,7 +131,7 @@
//
// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
//
-#define KSEG0_BASE 0x80000000
+#define KSEG0_BASE 0xfffff80000000000ULL
//
// Synchronization-level IRQL
@@ -139,7 +139,7 @@
#ifndef CONFIG_SMP
#define SYNCH_LEVEL DISPATCH_LEVEL
#else
-#define SYNCH_LEVEL (IPI_LEVEL - 1)
+#define SYNCH_LEVEL (IPI_LEVEL - 2)
#endif
//
@@ -147,109 +147,134 @@
//
typedef struct _KTRAP_FRAME
{
- ULONG DbgEbp;
- ULONG DbgEip;
- ULONG DbgArgMark;
- ULONG DbgArgPointer;
- ULONG TempSegCs;
- ULONG TempEsp;
- ULONG Dr0;
- ULONG Dr1;
- ULONG Dr2;
- ULONG Dr3;
- ULONG Dr6;
- ULONG Dr7;
- ULONG SegGs;
- ULONG SegEs;
- ULONG SegDs;
- ULONG Edx;
- ULONG Ecx;
- ULONG Eax;
- ULONG PreviousPreviousMode;
- struct _EXCEPTION_REGISTRATION_RECORD FAR *ExceptionList;
- ULONG SegFs;
- ULONG Edi;
- ULONG Esi;
- ULONG Ebx;
- ULONG Ebp;
- ULONG ErrCode;
- ULONG Eip;
- ULONG SegCs;
- ULONG EFlags;
- ULONG HardwareEsp;
- ULONG HardwareSegSs;
- ULONG V86Es;
- ULONG V86Ds;
- ULONG V86Fs;
- ULONG V86Gs;
-} KTRAP_FRAME, *PKTRAP_FRAME;
-
-//
-// LDT Entry Definition
-//
-#ifndef _LDT_ENTRY_DEFINED
-#define _LDT_ENTRY_DEFINED
-typedef struct _LDT_ENTRY
-{
- USHORT LimitLow;
- USHORT BaseLow;
+ UINT64 P1Home;
+ UINT64 P2Home;
+ UINT64 P3Home;
+ UINT64 P4Home;
+ UINT64 P5;
+ CHAR PreviousMode;
+ UCHAR PreviousIrql;
+ UCHAR FaultIndicator;
+ UCHAR ExceptionActive;
+ ULONG MxCsr;
+ UINT64 Rax;
+ UINT64 Rcx;
+ UINT64 Rdx;
+ UINT64 R8;
+ UINT64 R9;
+ UINT64 R10;
+ UINT64 R11;
+ union
+ {
+ UINT64 GsBase;
+ UINT64 GsSwap;
+ };
+ M128A Xmm0;
+ M128A Xmm1;
+ M128A Xmm2;
+ M128A Xmm3;
+ M128A Xmm4;
+ M128A Xmm5;
+ union
+ {
+ UINT64 FaultAddress;
+ UINT64 ContextRecord;
+ UINT64 TimeStampCKCL;
+ };
+ UINT64 Dr0;
+ UINT64 Dr1;
+ UINT64 Dr2;
+ UINT64 Dr3;
+ UINT64 Dr6;
+ UINT64 Dr7;
union
{
struct
{
- UCHAR BaseMid;
- UCHAR Flags1;
- UCHAR Flags2;
- UCHAR BaseHi;
- } Bytes;
+ UINT64 DebugControl;
+ UINT64 LastBranchToRip;
+ UINT64 LastBranchFromRip;
+ UINT64 LastExceptionToRip;
+ UINT64 LastExceptionFromRip;
+ };
struct
{
- ULONG BaseMid:8;
- ULONG Type:5;
- ULONG Dpl:2;
- ULONG Pres:1;
- ULONG LimitHi:4;
- ULONG Sys:1;
- ULONG Reserved_0:1;
- ULONG Default_Big:1;
- ULONG Granularity:1;
- ULONG BaseHi:8;
- } Bits;
- } HighWord;
-} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
-#endif
+ UINT64 LastBranchControl;
+ ULONG LastBranchMSR;
+ };
+ };
+ USHORT SegDs;
+ USHORT SegEs;
+ USHORT SegFs;
+ USHORT SegGs;
+ UINT64 TrapFrame;
+ UINT64 Rbx;
+ UINT64 Rdi;
+ UINT64 Rsi;
+ UINT64 Rbp;
+ union
+ {
+ UINT64 ErrorCode;
+ UINT64 ExceptionFrame;
+ UINT64 TimeStampKlog;
+ };
+ UINT64 Rip;
+ USHORT SegCs;
+ UCHAR Fill0;
+ UCHAR Logging;
+ USHORT Fill1[2];
+ ULONG EFlags;
+ ULONG Fill2;
+ UINT64 Rsp;
+ USHORT SegSs;
+ USHORT Fill3;
+ LONG CodePatchCycle;
+} KTRAP_FRAME, *PKTRAP_FRAME;
+
+//
+// Dummy LDT_ENTRY
+//
+typedef ULONG LDT_ENTRY;
//
// GDT Entry Definition
//
-typedef struct _KGDTENTRY
-{
- USHORT LimitLow;
- USHORT BaseLow;
- union
- {
- struct
+typedef union _KGDTENTRY64
+{
+ struct
+ {
+ USHORT LimitLow;
+ USHORT BaseLow;
+ union
{
- UCHAR BaseMid;
- UCHAR Flags1;
- UCHAR Flags2;
- UCHAR BaseHi;
- } Bytes;
- struct
- {
- ULONG BaseMid:8;
- ULONG Type:5;
- ULONG Dpl:2;
- ULONG Pres:1;
- ULONG LimitHi:4;
- ULONG Sys:1;
- ULONG Reserved_0:1;
- ULONG Default_Big:1;
- ULONG Granularity:1;
- ULONG BaseHi:8;
- } Bits;
- } HighWord;
-} KGDTENTRY, *PKGDTENTRY;
+ struct
+ {
+ UCHAR BaseMiddle;
+ UCHAR Flags1;
+ UCHAR Flags2;
+ UCHAR BaseHigh;
+ } Bytes;
+ struct
+ {
+ ULONG BaseMiddle:8;
+ ULONG Type:5;
+ ULONG Dpl:2;
+ ULONG Present:1;
+ ULONG LimitHigh:4;
+ ULONG System:1;
+ ULONG LongMode:1;
+ ULONG DefaultBig:1;
+ ULONG Granularity:1;
+ ULONG BaseHigh:8;
+ } Bits;
+ };
+ ULONG BaseUpper;
+ ULONG MustBeZero;
+ };
+ UINT64 Alignment;
+} KGDTENTRY64, *PKGDTENTRY64;
+#define KGDTENTRY KGDTENTRY64
+#define PKGDTENTRY PKGDTENTRY64
//
// IDT Entry Access Definition
@@ -273,96 +298,67 @@
//
// IDT Entry Definition
//
-typedef struct _KIDTENTRY
-{
- USHORT Offset;
- USHORT Selector;
- USHORT Access;
- USHORT ExtendedOffset;
-} KIDTENTRY, *PKIDTENTRY;
-
-typedef struct _DESCRIPTOR
-{
- USHORT Pad;
+typedef union _KIDTENTRY64
+{
+ struct
+ {
+ USHORT OffsetLow;
+ USHORT Selector;
+ USHORT IstIndex:3;
+ USHORT Reserved0:5;
+ USHORT Type:5;
+ USHORT Dpl:2;
+ USHORT Present:1;
+ USHORT OffsetMiddle;
+ ULONG OffsetHigh;
+ ULONG Reserved1;
+ };
+ UINT64 Alignment;
+} KIDTENTRY64, *PKIDTENTRY64;
+#define KIDTENTRY KIDTENTRY64
+#define PKIDTENTRY PKIDTENTRY64
+
+typedef struct _KDESCRIPTOR
+{
+ USHORT Pad[3];
USHORT Limit;
- ULONG Base;
+ PVOID Base;
} KDESCRIPTOR, *PKDESCRIPTOR;
#ifndef NTOS_MODE_USER
-//
-// Macro to get current KPRCB
-//
-FORCEINLINE
-struct _KPRCB *
-KeGetCurrentPrcb(VOID)
-{
- return (struct _KPRCB *)(ULONG_PTR)__readfsdword(FIELD_OFFSET(KPCR, Prcb));
-}
-
-//
-// FN/FX (FPU) Save Area Structures
-//
-typedef struct _FNSAVE_FORMAT
-{
- ULONG ControlWord;
- ULONG StatusWord;
- ULONG TagWord;
- ULONG ErrorOffset;
- ULONG ErrorSelector;
- ULONG DataOffset;
- ULONG DataSelector;
- UCHAR RegisterArea[80];
-} FNSAVE_FORMAT, *PFNSAVE_FORMAT;
-
-typedef struct _FXSAVE_FORMAT
-{
- USHORT ControlWord;
- USHORT StatusWord;
- USHORT TagWord;
- USHORT ErrorOpcode;
- ULONG ErrorOffset;
- ULONG ErrorSelector;
- ULONG DataOffset;
- ULONG DataSelector;
- ULONG MXCsr;
- ULONG MXCsrMask;
- UCHAR RegisterArea[128];
- UCHAR Reserved3[128];
- UCHAR Reserved4[224];
- UCHAR Align16Byte[8];
-} FXSAVE_FORMAT, *PFXSAVE_FORMAT;
-
-typedef struct _FX_SAVE_AREA
-{
- union
- {
- FNSAVE_FORMAT FnArea;
- FXSAVE_FORMAT FxArea;
- } U;
- ULONG NpxSavedCpu;
- ULONG Cr0NpxState;
-} FX_SAVE_AREA, *PFX_SAVE_AREA;
//
// Special Registers Structure (outside of CONTEXT)
//
typedef struct _KSPECIAL_REGISTERS
{
- ULONG Cr0;
- ULONG Cr2;
- ULONG Cr3;
- ULONG Cr4;
- ULONG KernelDr0;
- ULONG KernelDr1;
- ULONG KernelDr2;
- ULONG KernelDr3;
- ULONG KernelDr6;
- ULONG KernelDr7;
- KDESCRIPTOR Gdtr;
- KDESCRIPTOR Idtr;
+ UINT64 Cr0;
+ UINT64 Cr2;
+ UINT64 Cr3;
+ UINT64 Cr4;
+ UINT64 KernelDr0;
+ UINT64 KernelDr1;
+ UINT64 KernelDr2;
+ UINT64 KernelDr3;
+ UINT64 KernelDr6;
+ UINT64 KernelDr7;
+ struct _KDESCRIPTOR Gdtr;
+ struct _KDESCRIPTOR Idtr;
USHORT Tr;
USHORT Ldtr;
- ULONG Reserved[6];
+ ULONG MxCsr;
+ UINT64 DebugControl;
+ UINT64 LastBranchToRip;
+ UINT64 LastBranchFromRip;
+ UINT64 LastExceptionToRip;
+ UINT64 LastExceptionFromRip;
+ UINT64 Cr8;
+ UINT64 MsrGsBase;
+ UINT64 MsrGsSwap;
+ UINT64 MsrStar;
+ UINT64 MsrLStar;
+ UINT64 MsrCStar;
+ UINT64 MsrSyscallMask;
} KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS;
//
@@ -370,9 +366,70 @@
//
typedef struct _KPROCESSOR_STATE
{
+ KSPECIAL_REGISTERS SpecialRegisters;
CONTEXT ContextFrame;
- KSPECIAL_REGISTERS SpecialRegisters;
} KPROCESSOR_STATE, *PKPROCESSOR_STATE;
+
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+typedef struct _GENERAL_LOOKASIDE_POOL
+{
+ union
+ {
+ SLIST_HEADER ListHead;
+ SINGLE_LIST_ENTRY SingleListHead;
+ };
+ USHORT Depth;
+ USHORT MaximumDepth;
+ ULONG TotalAllocates;
+ union
+ {
+ ULONG AllocateMisses;
+ ULONG AllocateHits;
+ };
+ union
+ {
+ ULONG TotalFrees;
+ ULONG FreeMisses;
+ };
+ ULONG FreeHits;
+ POOL_TYPE Type;
+ ULONG Tag;
+ ULONG Size;
+ union
+ {
+ PVOID AllocateEx;
+ PVOID Allocate;
+ };
+ union
+ {
+ PVOID FreeEx;
+ PVOID Free;
+ };
+ LIST_ENTRY ListEntry;
+ ULONG LastTotalAllocates;
+ union
+ {
+ ULONG LastAllocateMisses;
+ ULONG LastAllocateHits;
+ };
+ ULONG Future[2];
+} GENERAL_LOOKASIDE_POOL, *PGENERAL_LOOKASIDE_POOL;
+#else
+#define GENERAL_LOOKASIDE_POOL PP_LOOKASIDE_LIST
+#endif
+
+typedef struct _KREQUEST_PACKET
+{
+ PVOID CurrentPacket[3];
+ PVOID WorkerRoutine;
+} KREQUEST_PACKET, *PKREQUEST_PACKET;
+
+typedef struct _REQUEST_MAILBOX
+{
+ INT64 RequestSummary;
+ KREQUEST_PACKET RequestPacket;
+ PVOID Virtual[7];
+} REQUEST_MAILBOX, *PREQUEST_MAILBOX;
//
// Processor Region Control Block
@@ -380,89 +437,214 @@
#pragma pack(push,4)
typedef struct _KPRCB
{
- USHORT MinorVersion;
- USHORT MajorVersion;
+ ULONG MxCsr;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ USHORT Number;
+#else
+ UCHAR Number;
+ UCHAR NestingLevel;
+#endif
+ UCHAR InterruptRequest;
+ UCHAR IdleHalt;
struct _KTHREAD *CurrentThread;
struct _KTHREAD *NextThread;
struct _KTHREAD *IdleThread;
- UCHAR Number;
- UCHAR Reserved;
- USHORT BuildType;
- KAFFINITY SetMember;
- UCHAR CpuType;
- UCHAR CpuID;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UCHAR NestingLevel;
+ UCHAR Group;
+ UCHAR PrcbPad00[6];
+#else
+ UINT64 UserRsp;
+#endif
+ UINT64 RspBase;
+ UINT64 PrcbLock;
+ UINT64 SetMember;
+ KPROCESSOR_STATE ProcessorState;
+ CHAR CpuType;
+ CHAR CpuID;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ union
+ {
+ USHORT CpuStep;
+ struct
+ {
+ UCHAR CpuStepping;
+ UCHAR CpuModel;
+ };
+ };
+#else
USHORT CpuStep;
- KPROCESSOR_STATE ProcessorState;
- ULONG KernelReserved[16];
- ULONG HalReserved[16];
+#endif
+ ULONG MHz;
+ UINT64 HalReserved[8];
+ USHORT MinorVersion;
+ USHORT MajorVersion;
+ UCHAR BuildType;
+ UCHAR CpuVendor;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UCHAR CoresPerPhysicalProcessor;
+ UCHAR LogicalProcessorsPerCore;
+#else
+ UCHAR InitialApicId;
+ UCHAR LogicalProcessorsPerPhysicalProcessor;
+#endif
+ ULONG ApicMask;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
ULONG CFlushSize;
- UCHAR PrcbPad0[88];
-#else
- UCHAR PrcbPad0[92];
-#endif
- KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock];
- struct _KTHREAD *NpxThread;
- ULONG InterruptCount;
- ULONG KernelTime;
- ULONG UserTime;
- ULONG DpcTime;
- ULONG DebugDpcTime;
- ULONG InterruptTime;
- ULONG AdjustDpcThreshold;
- ULONG PageColor;
- UCHAR SkipTick;
- UCHAR DebuggerSavedIRQL;
-#if (NTDDI_VERSION >= NTDDI_WS03)
- UCHAR NodeColor;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- UCHAR PollSlot;
-#else
- UCHAR Spare1;
-#endif
- ULONG NodeShiftedColor;
-#else
- UCHAR Spare1[6];
-#endif
- struct _KNODE *ParentNode;
- ULONG MultiThreadProcessorSet;
- struct _KPRCB *MultiThreadSetMaster;
-#if (NTDDI_VERSION >= NTDDI_WS03)
- ULONG SecondaryColorMask;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- ULONG DpcTimeLimit;
-#else
- LONG Sleeping;
-#endif
-#else
- ULONG ThreadStartCount[2];
-#endif
+#else
+ UCHAR CFlushSize;
+ UCHAR PrcbPad0x[3];
+#endif
+ PVOID AcpiReserved;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG InitialApicId;
+ ULONG Stride;
+ UINT64 PrcbPad01[3];
+#else
+ UINT64 PrcbPad00[4];
+#endif
+ KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock]; // 2003: 33, vista:49
+ PP_LOOKASIDE_LIST PPLookasideList[16];
+ GENERAL_LOOKASIDE_POOL PPNPagedLookasideList[32];
+ GENERAL_LOOKASIDE_POOL PPPagedLookasideList[32];
+ UINT64 PacketBarrier;
+ SINGLE_LIST_ENTRY DeferredReadyListHead;
+ LONG MmPageFaultCount;
+ LONG MmCopyOnWriteCount;
+ LONG MmTransitionCount;
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
+ LONG MmCacheTransitionCount;
+#endif
+ LONG MmDemandZeroCount;
+ LONG MmPageReadCount;
+ LONG MmPageReadIoCount;
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
+ LONG MmCacheReadCount;
+ LONG MmCacheIoCount;
+#endif
+ LONG MmDirtyPagesWriteCount;
+ LONG MmDirtyWriteIoCount;
+ LONG MmMappedPagesWriteCount;
+ LONG MmMappedWriteIoCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG KeSystemCalls;
+ ULONG KeContextSwitches;
ULONG CcFastReadNoWait;
ULONG CcFastReadWait;
ULONG CcFastReadNotPossible;
ULONG CcCopyReadNoWait;
ULONG CcCopyReadWait;
ULONG CcCopyReadNoWaitMiss;
-#if (NTDDI_VERSION < NTDDI_LONGHORN)
- ULONG KeAlignmentFixupCount;
-#endif
- ULONG SpareCounter0;
-#if (NTDDI_VERSION < NTDDI_LONGHORN)
- ULONG KeDcacheFlushCount;
- ULONG KeExceptionDispatchCount;
- ULONG KeFirstLevelTbFills;
- ULONG KeFloatingEmulationCount;
- ULONG KeIcacheFlushCount;
- ULONG KeSecondLevelTbFills;
+ LONG LookasideIrpFloat;
+#else
+ LONG LookasideIrpFloat;
ULONG KeSystemCalls;
#endif
- volatile ULONG IoReadOperationCount;
- volatile ULONG IoWriteOperationCount;
- volatile ULONG IoOtherOperationCount;
+ LONG IoReadOperationCount;
+ LONG IoWriteOperationCount;
+ LONG IoOtherOperationCount;
LARGE_INTEGER IoReadTransferCount;
LARGE_INTEGER IoWriteTransferCount;
LARGE_INTEGER IoOtherTransferCount;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
+ ULONG KeContextSwitches;
+ UCHAR PrcbPad2[12];
+#endif
+ UINT64 TargetSet;
+ ULONG IpiFrozen;
+ UCHAR PrcbPad3[116];
+ REQUEST_MAILBOX RequestMailbox[64];
+ UINT64 SenderSummary;
+ UCHAR PrcbPad4[120];
+ KDPC_DATA DpcData[2];
+ PVOID DpcStack;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ PVOID SparePtr0;
+#else
+ PVOID SavedRsp;
+#endif
+ LONG MaximumDpcQueueDepth;
+ ULONG DpcRequestRate;
+ ULONG MinimumDpcRate;
+ UCHAR DpcInterruptRequested;
+ UCHAR DpcThreadRequested;
+ UCHAR DpcRoutineActive;
+ UCHAR DpcThreadActive;
+ UINT64 TimerHand;
+ UINT64 TimerRequest;
+ LONG TickOffset;
+ LONG MasterOffset;
+ ULONG DpcLastCount;
+ UCHAR ThreadDpcEnable;
+ UCHAR QuantumEnd;
+ UCHAR PrcbPad50;
+ UCHAR IdleSchedule;
+ LONG DpcSetEventRequest;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG KeExceptionDispatchCount;
+#else
+ LONG PrcbPad40;
+ PVOID DpcThread;
+#endif
+ KEVENT DpcEvent;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ PVOID PrcbPad51;
+#endif
+ KDPC CallDpc;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ LONG ClockKeepAlive;
+ UCHAR ClockCheckSlot;
+ UCHAR ClockPollCycle;
+ UCHAR PrcbPad6[2];
+ LONG DpcWatchdogPeriod;
+ LONG DpcWatchdogCount;
+ UINT64 PrcbPad70[2];
+#else
+ UINT64 PrcbPad7[4];
+#endif
+ LIST_ENTRY WaitListHead;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UINT64 WaitLock;
+#endif
+ ULONG ReadySummary;
+ ULONG QueueIndex;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UINT64 PrcbPad71[12];
+#endif
+ LIST_ENTRY DispatcherReadyListHead[32];
+ ULONG InterruptCount;
+ ULONG KernelTime;
+ ULONG UserTime;
+ ULONG DpcTime;
+ ULONG InterruptTime;
+ ULONG AdjustDpcThreshold;
+ UCHAR SkipTick;
+ UCHAR DebuggerSavedIRQL;
+ UCHAR PollSlot;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UCHAR PrcbPad80[5];
+ ULONG DpcTimeCount;
+ ULONG DpcTimeLimit;
+ ULONG PeriodicCount;
+ ULONG PeriodicBias;
+ UINT64 PrcbPad81[2];
+#else
+ UCHAR PrcbPad8[13];
+#endif
+ struct _KNODE *ParentNode;
+ UINT64 MultiThreadProcessorSet;
+ struct _KPRCB *MultiThreadSetMaster;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UINT64 StartCycles;
+ LONG MmSpinLockOrdering;
+ ULONG PageColor;
+ ULONG NodeColor;
+ ULONG NodeShiftedColor;
+ ULONG SecondaryColorMask;
+#endif
+ LONG Sleeping;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UINT64 CycleTime;
ULONG CcFastMdlReadNoWait;
ULONG CcFastMdlReadWait;
ULONG CcFastMdlReadNotPossible;
@@ -489,137 +671,65 @@
ULONG CcMdlReadNoWaitMiss;
ULONG CcMdlReadWaitMiss;
ULONG CcReadAheadIos;
+ LONG MmCacheTransitionCount;
+ LONG MmCacheReadCount;
+ LONG MmCacheIoCount;
+ ULONG PrcbPad91[3];
+ PROCESSOR_POWER_STATE PowerState;
ULONG KeAlignmentFixupCount;
- ULONG KeExceptionDispatchCount;
- ULONG KeSystemCalls;
- ULONG PrcbPad1[3];
-#else
- ULONG SpareCounter1[8];
-#endif
- PP_LOOKASIDE_LIST PPLookasideList[16];
- PP_LOOKASIDE_LIST PPNPagedLookasideList[32];
- PP_LOOKASIDE_LIST PPPagedLookasideList[32];
- volatile ULONG PacketBarrier;
- volatile ULONG ReverseStall;
- PVOID IpiFrame;
- UCHAR PrcbPad2[52];
- volatile PVOID CurrentPacket[3];
- volatile ULONG TargetSet;
- volatile PKIPI_WORKER WorkerRoutine;
- volatile ULONG IpiFrozen;
- UCHAR PrcbPad3[40];
- volatile ULONG RequestSummary;
- volatile struct _KPRCB *SignalDone;
- UCHAR PrcbPad4[56];
- struct _KDPC_DATA DpcData[2];
- PVOID DpcStack;
- ULONG MaximumDpcQueueDepth;
- ULONG DpcRequestRate;
- ULONG MinimumDpcRate;
- volatile UCHAR DpcInterruptRequested;
- volatile UCHAR DpcThreadRequested;
- volatile UCHAR DpcRoutineActive;
- volatile UCHAR DpcThreadActive;
- ULONG PrcbLock;
- ULONG DpcLastCount;
- volatile ULONG TimerHand;
- volatile ULONG TimerRequest;
- PVOID DpcThread;
- KEVENT DpcEvent;
- UCHAR ThreadDpcEnable;
- volatile BOOLEAN QuantumEnd;
- UCHAR PrcbPad50;
- volatile UCHAR IdleSchedule;
- LONG DpcSetEventRequest;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- LONG Sleeping;
- ULONG PeriodicCount;
- ULONG PeriodicBias;
- UCHAR PrcbPad5[6];
-#else
- UCHAR PrcbPad5[18];
-#endif
- LONG TickOffset;
- KDPC CallDpc;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- LONG ClockKeepAlive;
- UCHAR ClockCheckSlot;
- UCHAR ClockPollCycle;
- UCHAR PrcbPad6[2];
- LONG DpcWatchdogPeriod;
- LONG DpcWatchDogCount;
- LONG ThreadWatchdogPeriod;
- LONG ThreadWatchDogCount;
- ULONG PrcbPad70[2];
-#else
- ULONG PrcbPad7[8];
-#endif
- LIST_ENTRY WaitListHead;
- ULONG ReadySummary;
- ULONG QueueIndex;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- SINGLE_LIST_ENTRY DeferredReadyListHead;
- ULONGLONG StartCycles;
- ULONGLONG CycleTime;
- ULONGLONG PrcbPad71[3];
- LIST_ENTRY DispatcherReadyListHead[32];
-#else
- LIST_ENTRY DispatcherReadyListHead[32];
- SINGLE_LIST_ENTRY DeferredReadyListHead;
- ULONG PrcbPad72[11];
-#endif
- PVOID ChainedInterruptList;
- LONG LookasideIrpFloat;
- volatile LONG MmPageFaultCount;
- volatile LONG MmCopyOnWriteCount;
- volatile LONG MmTransitionCount;
- volatile LONG MmCacheTransitionCount;
- volatile LONG MmDemandZeroCount;
- volatile LONG MmPageReadCount;
- volatile LONG MmPageReadIoCount;
- volatile LONG MmCacheReadCount;
- volatile LONG MmCacheIoCount;
- volatile LONG MmDirtyPagesWriteCount;
- volatile LONG MmDirtyWriteIoCount;
- volatile LONG MmMappedPagesWriteCount;
- volatile LONG MmMappedWriteIoCount;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ UCHAR VendorString[13];
+ UCHAR PrcbPad10[3];
+ ULONG FeatureBits;
+ LARGE_INTEGER UpdateSignature;
+ KDPC DpcWatchdogDpc;
+ KTIMER DpcWatchdogTimer;
+ CACHE_DESCRIPTOR Cache[5];
+ ULONG CacheCount;
ULONG CachedCommit;
ULONG CachedResidentAvailable;
PVOID HyperPte;
- UCHAR CpuVendor;
- UCHAR PrcbPad9[3];
-#else
- ULONG SpareFields0[1];
-#endif
- CHAR VendorString[13];
- UCHAR InitialApicId;
- UCHAR LogicalProcessorsPerPhysicalProcessor;
- ULONG MHz;
- ULONG FeatureBits;
- LARGE_INTEGER UpdateSignature;
- volatile LARGE_INTEGER IsrTime;
- LARGE_INTEGER SpareField1;
- FX_SAVE_AREA NpxSaveArea;
- PROCESSOR_POWER_STATE PowerState;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
- KDPC DpcWatchdogDoc;
- KTIMER DpcWatchdogTimer;
PVOID WheaInfo;
PVOID EtwSupport;
SLIST_HEADER InterruptObjectPool;
- LARGE_INTEGER HyperCallPagePhysical;
- LARGE_INTEGER HyperCallPageVirtual;
+ SLIST_HEADER HypercallPageList;
+ PVOID HypercallPageVirtual;
+ PVOID VirtualApicAssist;
+ UINT64* StatisticsPage;
PVOID RateControl;
+ UINT64 CacheProcessorMask[5];
+ UINT64 PackageProcessorSet;
+ UINT64 CoreProcessorSet;
+#else
+ ULONG PrcbPad90[1];
+ ULONG DebugDpcTime;
+ ULONG PageColor;
+ ULONG NodeColor;
+ ULONG NodeShiftedColor;
+ ULONG SecondaryColorMask;
+ UCHAR PrcbPad9[12];
+ ULONG CcFastReadNoWait;
+ ULONG CcFastReadWait;
+ ULONG CcFastReadNotPossible;
+ ULONG CcCopyReadNoWait;
+ ULONG CcCopyReadWait;
+ ULONG CcCopyReadNoWaitMiss;
+ ULONG KeAlignmentFixupCount;
+ ULONG KeDcacheFlushCount;
+ ULONG KeExceptionDispatchCount;
+ ULONG KeFirstLevelTbFills;
+ ULONG KeFloatingEmulationCount;
+ ULONG KeIcacheFlushCount;
+ ULONG KeSecondLevelTbFills;
+ UCHAR VendorString[13];
+ UCHAR PrcbPad10[2];
+ ULONG FeatureBits;
+ LARGE_INTEGER UpdateSignature;
+ PROCESSOR_POWER_STATE PowerState;
CACHE_DESCRIPTOR Cache[5];
ULONG CacheCount;
- ULONG CacheProcessorMask[5];
- UCHAR LogicalProcessorsPerCore;
- UCHAR PrcbPad8[3];
- ULONG PackageProcessorSet;
- ULONG CoreProcessorSet;
-#endif
-} KPRCB, *PKPRCB;
+#endif
+}
+ KPRCB, *PKPRCB;
//
// Processor Control Region
@@ -631,41 +741,40 @@
NT_TIB NtTib;
struct
{
- struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
- PVOID Used_StackBase;
- PVOID PerfGlobalGroupMask;
- PVOID TssCopy;
- ULONG ContextSwitches;
- KAFFINITY SetMemberCopy;
+ union _KGDTENTRY64 *GdtBase;
+ struct _KTSS64 *TssBase;
+ ULONG64 UserRsp;
+ struct _KPCR *Self;
+ struct _KPRCB *CurrentPrcb;
+ PKSPIN_LOCK_QUEUE LockArray;
PVOID Used_Self;
};
};
- struct _KPCR *Self;
- struct _KPRCB *Prcb;
+ union _KIDTENTRY64 *IdtBase;
+ ULONG64 Unused[2];
KIRQL Irql;
- ULONG IRR;
- ULONG IrrActive;
- ULONG IDR;
- PVOID KdVersionBlock;
- PKIDTENTRY IDT;
- PKGDTENTRY GDT;
- struct _KTSS *TSS;
+ UCHAR SecondLevelCacheAssociativity;
+ UCHAR ObsoleteNumber;
+ UCHAR Fill0;
+ ULONG Unused0[3];
USHORT MajorVersion;
USHORT MinorVersion;
- KAFFINITY SetMember;
ULONG StallScaleFactor;
- UCHAR SparedUnused;
- UCHAR Number;
- UCHAR Reserved;
- UCHAR L2CacheAssociativity;
- ULONG VdmAlert;
- ULONG KernelReserved[14];
+ PVOID Unused1[3];
+ ULONG KernelReserved[15];
ULONG SecondLevelCacheSize;
ULONG HalReserved[16];
- ULONG InterruptMode;
- UCHAR Spare1;
- ULONG KernelReserved2[17];
- KPRCB PrcbData;
+ ULONG Unused2;
+ ULONG Fill1;
+ PVOID KdVersionBlock; // 0x108
+ PVOID Unused3;
+ ULONG PcrAlign1[24];
+ ULONG Fill2[2]; // 0x178
+ KPRCB Prcb; // 0x180
+
+ // hack:
+ ULONG ContextSwitches;
+
} KIPCR, *PKIPCR;
#pragma pack(pop)
@@ -678,48 +787,37 @@
UCHAR IoMap[8196];
} KIIO_ACCESS_MAP;
-typedef struct _KTSS
-{
- USHORT Backlink;
- USHORT Reserved0;
- ULONG Esp0;
- USHORT Ss0;
- USHORT Reserved1;
- ULONG NotUsed1[4];
- ULONG CR3;
- ULONG Eip;
- ULONG EFlags;
- ULONG Eax;
- ULONG Ecx;
- ULONG Edx;
- ULONG Ebx;
- ULONG Esp;
- ULONG Ebp;
- ULONG Esi;
- ULONG Edi;
- USHORT Es;
- USHORT Reserved2;
- USHORT Cs;
- USHORT Reserved3;
- USHORT Ss;
- USHORT Reserved4;
- USHORT Ds;
- USHORT Reserved5;
- USHORT Fs;
- USHORT Reserved6;
- USHORT Gs;
- USHORT Reserved7;
- USHORT LDT;
- USHORT Reserved8;
- USHORT Flags;
- USHORT IoMapBase;
- KIIO_ACCESS_MAP IoMaps[1];
- UCHAR IntDirectionMap[32];
-} KTSS, *PKTSS;
+
+#pragma pack(push,4)
+typedef struct _KTSS64
+{
+ /* 000 */ ULONG Reserved0;
+ /* 004 */ UINT64 Rsp0;
+ /* 00c */ UINT64 Rsp1;
+ /* 014 */ UINT64 Rsp2;
+ /* 01c */ UINT64 Ist[8];
+ /* 05c */ UINT64 Reserved1;
+ /* 064 */ USHORT Reserved2;
+ /* 066 */ USHORT IoMapBase;
+} KTSS64, *PKTSS64;
+#pragma pack(pop)
+#define KTSS KTSS64
+#define PKTSS PKTSS64
//
// i386 CPUs don't have exception frames
//
typedef struct _KEXCEPTION_FRAME KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
-#endif
-#endif
+
+//
+// Inline function to get current KPRCB
+//
+FORCEINLINE
+struct _KPRCB *
+KeGetCurrentPrcb(VOID)
+{
+ return (struct _KPRCB *)__readgsqword(FIELD_OFFSET(KIPCR, CurrentPrcb));
+}
+
+#endif
+#endif
Modified: trunk/reactos/include/ndk/amd64/mmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/mmtypes.…
==============================================================================
--- trunk/reactos/include/ndk/amd64/mmtypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/mmtypes.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -1,18 +1,20 @@
/*++ NDK Version: 0095
Copyright (c) Alex Ionescu. All rights reserved.
+Copyright (c) Timo Kreuzer All rights reserved.
Header Name:
- mmtypes.h (X86)
+ mmtypes.h (AMD64)
Abstract:
- i386 Type definitions for the Memory Manager
+ AMD64 Type definitions for the Memory Manager
Author:
Alex Ionescu (alex.ionescu(a)reactos.com) 06-Oct-2004
+ Timo Kreuzer (timo.kreuzer(a)reactos.com) 15-Aug-2008
--*/
@@ -43,127 +45,154 @@
#endif
//
-// PAE SEG0 Base?
-//
-#define KSEG0_BASE_PAE 0xE0000000
-
-//
// Page Table Entry Definitions
//
-typedef struct _HARDWARE_PTE_X86
+typedef struct _HARDWARE_PTE
{
- ULONG Valid:1;
- ULONG Write:1;
- ULONG Owner:1;
- ULONG WriteThrough:1;
- ULONG CacheDisable:1;
- ULONG Accessed:1;
- ULONG Dirty:1;
- ULONG LargePage:1;
- ULONG Global:1;
- ULONG CopyOnWrite:1;
- ULONG Prototype: 1;
- ULONG reserved: 1;
- ULONG PageFrameNumber:20;
-} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+ ULONG64 Valid:1;
+ ULONG64 Write:1;
+ ULONG64 Owner:1;
+ ULONG64 WriteThrough:1;
+ ULONG64 CacheDisable:1;
+ ULONG64 Accessed:1;
+ ULONG64 Dirty:1;
+ ULONG64 LargePage:1;
+ ULONG64 Global:1;
+ ULONG64 CopyOnWrite:1;
+ ULONG64 Prototype:1;
+ ULONG64 reserved0:1;
+ ULONG64 PageFrameNumber:28;
+ ULONG64 reserved1:12;
+ ULONG64 SoftwareWsIndex:11;
+ ULONG64 NoExecute:1;
+} HARDWARE_PTE, *PHARDWARE_PTE;
typedef struct _MMPTE_SOFTWARE
{
- ULONG Valid:1;
- ULONG PageFileLow:4;
- ULONG Protection:5;
- ULONG Prototype:1;
- ULONG Transition:1;
- ULONG PageFileHigh:20;
-} MMPTE_SOFTWARE;
+ ULONG64 Valid:1;
+ ULONG64 PageFileLow:4;
+ ULONG64 Protection:5;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 UsedPageTableEntries:10;
+ ULONG64 Reserved:10;
+ ULONG64 PageFileHigh:32;
+} MMPTE_SOFTWARE, *PMMPTE_SOFTWARE;
typedef struct _MMPTE_TRANSITION
{
- ULONG Valid:1;
- ULONG Write:1;
- ULONG Owner:1;
- ULONG WriteThrough:1;
- ULONG CacheDisable:1;
- ULONG Protection:5;
- ULONG Prototype:1;
- ULONG Transition:1;
- ULONG PageFrameNumber:20;
+ ULONG64 Valid:1;
+ ULONG64 Write:1;
+ ULONG64 Owner:1;
+ ULONG64 WriteThrough:1;
+ ULONG64 CacheDisable:1;
+ ULONG64 Protection:5;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG64 PageFrameNumber:36;
+ ULONG64 Unused:16;
+#else
+ ULONG64 PageFrameNumber:28;
+ ULONG64 Unused:24;
+#endif
} MMPTE_TRANSITION;
typedef struct _MMPTE_PROTOTYPE
{
- ULONG Valid:1;
- ULONG ProtoAddressLow:7;
- ULONG ReadOnly:1;
- ULONG WhichPool:1;
- ULONG Prototype:1;
- ULONG ProtoAddressHigh:21;
+ ULONG64 Valid:1;
+ ULONG64 Unused0:7;
+ ULONG64 ReadOnly:1;
+ ULONG64 Unused1:1;
+ ULONG64 Prototype:1;
+ ULONG64 Protection:5;
+ LONG64 ProtoAddress:48;
} MMPTE_PROTOTYPE;
typedef struct _MMPTE_SUBSECTION
{
- ULONG Valid:1;
- ULONG SubsectionAddressLow:4;
- ULONG Protection:5;
- ULONG Prototype:1;
- ULONG SubsectionAddressHigh:20;
- ULONG WhichPool:1;
+ ULONG64 Valid:1;
+ ULONG64 Unused0:4;
+ ULONG64 Protection:5;
+ ULONG64 Prototype:1;
+ ULONG64 Unused1:5;
+ LONG64 SubsectionAddress:48;
} MMPTE_SUBSECTION;
typedef struct _MMPTE_LIST
{
- ULONG Valid:1;
- ULONG OneEntry:1;
- ULONG filler0:8;
- ULONG NextEntry:20;
- ULONG Prototype:1;
- ULONG filler1:1;
+ ULONG64 Valid:1;
+ ULONG64 OneEntry:1;
+ ULONG64 filler0:3;
+ ULONG64 Protection:5;
+ ULONG64 Prototype:1;
+ ULONG64 Transition:1;
+ ULONG64 filler1:20;
+ ULONG64 NextEntry:32;
} MMPTE_LIST;
-
-#ifndef CONFIG_SMP
typedef struct _MMPTE_HARDWARE
{
- ULONG Valid:1;
- ULONG Write:1;
- ULONG Owner:1;
- ULONG WriteThrough:1;
- ULONG CacheDisable:1;
- ULONG Accessed:1;
- ULONG Dirty:1;
- ULONG LargePage:1;
- ULONG Global:1;
- ULONG CopyOnWrite:1;
- ULONG Prototype:1;
- ULONG reserved:1;
- ULONG PageFrameNumber:20;
+ ULONG64 Valid:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG64 Dirty1:1;
+#else
+#ifdef CONFIG_SMP
+ ULONG64 Writable:1;
+#else
+ ULONG64 Write:1;
+#endif
+#endif
+ ULONG64 Owner:1;
+ ULONG64 WriteThrough:1;
+ ULONG64 CacheDisable:1;
+ ULONG64 Accessed:1;
+ ULONG64 Dirty:1;
+ ULONG64 LargePage:1;
+ ULONG64 Global:1;
+ ULONG64 CopyOnWrite:1;
+ ULONG64 Prototype:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG64 Write:1;
+ ULONG64 PageFrameNumber:36;
+ ULONG64 reserved1:4;
+#else
+#ifdef CONFIG_SMP
+ ULONG64 Write:1;
+#else
+ ULONG64 reserved0:1;
+#endif
+ ULONG64 PageFrameNumber:28;
+ ULONG64 reserved1:12;
+#endif
+ ULONG64 SoftwareWsIndex:11;
+ ULONG64 NoExecute:1;
} MMPTE_HARDWARE, *PMMPTE_HARDWARE;
+typedef struct _MMPTE_HARDWARE_LARGEPAGE
+{
+ ULONG64 Valid:1;
+ ULONG64 Write:1;
+ ULONG64 Owner:1;
+ ULONG64 WriteThrough:1;
+ ULONG64 CacheDisable:1;
+ ULONG64 Accessed:1;
+ ULONG64 Dirty:1;
+ ULONG64 LargePage:1;
+ ULONG64 Global:1;
+ ULONG64 CopyOnWrite:1;
+ ULONG64 Prototype:1;
+ ULONG64 reserved0:1;
+ ULONG64 PAT:1;
+ ULONG64 reserved1:8;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ ULONG64 PageFrameNumber:27;
+ ULONG64 reserved2:16;
#else
+ ULONG64 PageFrameNumber:19;
+ ULONG64 reserved2:24;
+#endif
+} MMPTE_HARDWARE_LARGEPAGE, *PMMPTE_HARDWARE_LARGEPAGE;
-typedef struct _MMPTE_HARDWARE
-{
- ULONG Valid:1;
- ULONG Writable:1;
- ULONG Owner:1;
- ULONG WriteThrough:1;
- ULONG CacheDisable:1;
- ULONG Accessed:1;
- ULONG Dirty:1;
- ULONG LargePage:1;
- ULONG Global:1;
- ULONG CopyOnWrite:1;
- ULONG Prototype:1;
- ULONG Write:1;
- ULONG PageFrameNumber:20;
-} MMPTE_HARDWARE, *PMMPTE_HARDWARE;
-#endif
-
-//
-// Use the right PTE structure
-//
-#define HARDWARE_PTE HARDWARE_PTE_X86
-#define PHARDWARE_PTE PHARDWARE_PTE_X86
-
-#endif
+#endif // !AMD64_MMTYPES_H
Modified: trunk/reactos/include/ndk/arch/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/arch/ketypes.h…
==============================================================================
--- trunk/reactos/include/ndk/arch/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/arch/ketypes.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -24,6 +24,8 @@
//
#ifdef _M_IX86
#include <i386/ketypes.h>
+#elif defined(_M_AMD64)
+#include <amd64/ketypes.h>
#elif defined(_M_PPC)
#include <powerpc/ketypes.h>
#elif defined(_M_ARM)
Modified: trunk/reactos/include/ndk/asm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/asm.h?rev=4345…
==============================================================================
--- trunk/reactos/include/ndk/asm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/asm.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -16,7 +16,9 @@
Alex Ionescu (alex.ionescu(a)reactos.com) 06-Oct-2004
--*/
-
+#ifdef _M_AMD64
+# include "amd64/asm.h"
+#else
#ifndef _ASM_H
#define _ASM_H
@@ -639,5 +641,6 @@
-
-
+#endif
+
+
Modified: trunk/reactos/include/ndk/pstypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/pstypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/pstypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/pstypes.h [iso-8859-1] Wed Oct 14 18:45:35 2009
@@ -1077,7 +1077,7 @@
#endif
PPS_IMPERSONATION_INFORMATION ImpersonationInfo;
LIST_ENTRY IrpList;
- ULONG TopLevelIrp;
+ ULONG_PTR TopLevelIrp;
PDEVICE_OBJECT DeviceToVerify;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
PPSP_RATE_APC RateControlApc;