mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
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 svn path=/trunk/; revision=43455
This commit is contained in:
commit
af3f2d5454
7 changed files with 1461 additions and 2 deletions
352
reactos/include/ndk/amd64/asm.h
Normal file
352
reactos/include/ndk/amd64/asm.h
Normal file
|
@ -0,0 +1,352 @@
|
|||
/*++ NDK Version: 0095
|
||||
|
||||
Copyright (c) Timo Kreuzer. All rights reserved.
|
||||
|
||||
Header Name:
|
||||
|
||||
amd64/asm.h
|
||||
|
||||
Abstract:
|
||||
|
||||
ASM Offsets for dealing with de-referencing structures in registers.
|
||||
|
||||
Author:
|
||||
|
||||
Timo Kreuzer (timo.kreuzer@reactos.org) 06-Sep-2008
|
||||
|
||||
--*/
|
||||
#ifndef _ASM_AMD64_H
|
||||
#define _ASM_AMD64_H
|
||||
|
||||
|
||||
#define SIZEOF_FX_SAVE_AREA 528 // HACK
|
||||
|
||||
//
|
||||
// CPU Modes
|
||||
//
|
||||
#define KernelMode 0x0
|
||||
#define UserMode 0x1
|
||||
|
||||
//
|
||||
// CPU Types
|
||||
//
|
||||
#define CPU_INTEL 0x1
|
||||
#define CPU_AMD 0x2
|
||||
|
||||
//
|
||||
// KTSS Offsets
|
||||
//
|
||||
#define KTSS64_RSP0 0x04
|
||||
#define KTSS64_RSP1 0x0c
|
||||
#define KTSS64_RSP2 0x14
|
||||
#define KTSS64_IST 0x1c
|
||||
#define KTSS64_IO_MAP_BASE 0x66
|
||||
|
||||
//
|
||||
// KTHREAD Offsets
|
||||
//
|
||||
#define KTHREAD_DEBUG_ACTIVE 0x03
|
||||
#define KTHREAD_INITIAL_STACK 0x28
|
||||
#define KTHREAD_STACK_LIMIT 0x30
|
||||
#define KTHREAD_WAIT_IRQL 0x156
|
||||
|
||||
//
|
||||
// KPRCB Offsets
|
||||
//
|
||||
#define KPRCB_CurrentThread 0x08
|
||||
|
||||
|
||||
//
|
||||
// KPCR Offsets
|
||||
//
|
||||
#define KPCR_TSS_BASE 0x08
|
||||
#define KPCR_SELF 0x18
|
||||
#define KPCR_STALL_SCALE_FACTOR 0x64
|
||||
#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
|
||||
//
|
||||
#define CR0_PE 0x1
|
||||
#define CR0_MP 0x2
|
||||
#define CR0_EM 0x4
|
||||
#define CR0_TS 0x8
|
||||
#define CR0_ET 0x10
|
||||
#define CR0_NE 0x20
|
||||
#define CR0_WP 0x10000
|
||||
#define CR0_AM 0x40000
|
||||
#define CR0_NW 0x20000000
|
||||
#define CR0_CD 0x40000000
|
||||
#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! ***********************************************/
|
||||
|
||||
#ifdef __ASM__
|
||||
|
||||
//
|
||||
// PCR Access
|
||||
//
|
||||
#define PCR gs:
|
||||
|
||||
//
|
||||
// EFLAGS
|
||||
//
|
||||
#define EFLAGS_TF 0x100
|
||||
#define EFLAGS_INTERRUPT_MASK 0x200
|
||||
#define EFLAGS_NESTED_TASK 0x4000
|
||||
#define EFLAGS_V86_MASK 0x20000
|
||||
#define EFLAGS_ALIGN_CHECK 0x40000
|
||||
#define EFLAGS_VIF 0x80000
|
||||
#define EFLAGS_VIP 0x100000
|
||||
#define EFLAG_SIGN 0x8000
|
||||
#define EFLAG_ZERO 0x4000
|
||||
#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
|
||||
//
|
||||
#define PASSIVE_LEVEL 0
|
||||
#define LOW_LEVEL 0
|
||||
#define APC_LEVEL 1
|
||||
#define DISPATCH_LEVEL 2
|
||||
#define CLOCK_LEVEL 13
|
||||
#define IPI_LEVEL 14
|
||||
#define POWER_LEVEL 14
|
||||
#define PROFILE_LEVEL 15
|
||||
#define HIGH_LEVEL 15
|
||||
|
||||
//
|
||||
// Quantum Decrements
|
||||
//
|
||||
#define CLOCK_QUANTUM_DECREMENT 0x3
|
||||
|
||||
//
|
||||
// Machine types
|
||||
//
|
||||
#define MACHINE_TYPE_ISA 0x0000
|
||||
#define MACHINE_TYPE_EISA 0x0001
|
||||
#define MACHINE_TYPE_MCA 0x0002
|
||||
|
||||
//
|
||||
// Kernel Feature Bits
|
||||
//
|
||||
#define KF_RDTSC 0x00000002
|
||||
|
||||
//
|
||||
// Kernel Stack Size
|
||||
//
|
||||
#define KERNEL_STACK_SIZE 0x6000
|
||||
|
||||
#endif // __ASM__
|
||||
|
||||
#endif // !_ASM_AMD64_H
|
||||
|
81
reactos/include/ndk/amd64/asmmacro.S
Normal file
81
reactos/include/ndk/amd64/asmmacro.S
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Kernel
|
||||
* FILE: ntoskrnl/include/amd64/asmmacro.S
|
||||
* PURPOSE: Macros for x64 assembly
|
||||
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
.intel_syntax noprefix
|
||||
.code64
|
||||
|
||||
/* Macros for x64 stack unwind OPs */
|
||||
|
||||
.macro .proc name
|
||||
.func name
|
||||
.global _\name
|
||||
_\name:
|
||||
.cfi_startproc
|
||||
.equ cfa_current_offset, -8
|
||||
.endm
|
||||
|
||||
.macro .endproc
|
||||
.cfi_endproc
|
||||
.endfunc
|
||||
.endm
|
||||
|
||||
.macro .allocstack size
|
||||
.cfi_adjust_cfa_offset \size
|
||||
.set cfa_current_offset, cfa_current_offset - \size
|
||||
.endm
|
||||
|
||||
.macro .pushframe code
|
||||
.if (\code == 0)
|
||||
.cfi_adjust_cfa_offset 0x28
|
||||
.set cfa_current_offset, cfa_current_offset - 0x28
|
||||
.else
|
||||
.cfi_adjust_cfa_offset 0x30
|
||||
.set cfa_current_offset, cfa_current_offset - 0x30
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.macro .pushreg reg
|
||||
.cfi_adjust_cfa_offset 8
|
||||
.equ cfa_current_offset, cfa_current_offset - 8
|
||||
.cfi_offset \reg, cfa_current_offset
|
||||
.endm
|
||||
|
||||
.macro .savereg reg, offset
|
||||
// checkme!!!
|
||||
.cfi_offset \reg, \offset
|
||||
.endm
|
||||
|
||||
.macro .savexmm128 reg, offset
|
||||
// checkme!!!
|
||||
.cfi_offset \reg, \offset
|
||||
.endm
|
||||
|
||||
.macro .setframe reg, offset
|
||||
.cfi_def_cfa reg, \offset
|
||||
.equ cfa_current_offset, \offset
|
||||
.endm
|
||||
|
||||
.macro .endprolog
|
||||
.endm
|
||||
|
||||
.macro UNIMPLEMENTED2 file, line, func
|
||||
jmp 3f
|
||||
.equ expr, 12
|
||||
1: .asciz "\func"
|
||||
2: .asciz "\file"
|
||||
3:
|
||||
sub rsp, 0x20
|
||||
lea rcx, _MsgUnimplemented[rip]
|
||||
lea rdx, 1b[rip]
|
||||
lea r8, 2b[rip]
|
||||
mov r9, \line
|
||||
call _DbgPrint
|
||||
add rsp, 0x20
|
||||
.endm
|
||||
#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__,
|
||||
|
823
reactos/include/ndk/amd64/ketypes.h
Normal file
823
reactos/include/ndk/amd64/ketypes.h
Normal file
|
@ -0,0 +1,823 @@
|
|||
/*++ NDK Version: 0098
|
||||
|
||||
Copyright (c) Alex Ionescu. All rights reserved.
|
||||
Copyright (c) Timo Kreuzer. All rights reserved.
|
||||
|
||||
Header Name:
|
||||
|
||||
ketypes.h (AMD64)
|
||||
|
||||
Abstract:
|
||||
|
||||
amd64 Type definitions for the Kernel services.
|
||||
|
||||
Author:
|
||||
|
||||
Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
|
||||
Timo Kreuzer (timo.kreuzer@reactos.org) - Updated - 14-Aug-2008
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _AMD64_KETYPES_H
|
||||
#define _AMD64_KETYPES_H
|
||||
|
||||
//
|
||||
// Dependencies
|
||||
//
|
||||
|
||||
//
|
||||
// KPCR Access for non-IA64 builds
|
||||
//
|
||||
//#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
|
||||
//
|
||||
#define MACHINE_TYPE_ISA 0x0000
|
||||
#define MACHINE_TYPE_EISA 0x0001
|
||||
#define MACHINE_TYPE_MCA 0x0002
|
||||
|
||||
//
|
||||
// X86 80386 Segment Types
|
||||
//
|
||||
#define I386_TASK_GATE 0x5
|
||||
#define I386_TSS 0x9
|
||||
#define I386_ACTIVE_TSS 0xB
|
||||
#define I386_CALL_GATE 0xC
|
||||
#define I386_INTERRUPT_GATE 0xE
|
||||
#define I386_TRAP_GATE 0xF
|
||||
|
||||
//
|
||||
// Selector Names
|
||||
//
|
||||
#define RPL_MASK 0x0003
|
||||
#define MODE_MASK 0x0001
|
||||
#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
|
||||
//
|
||||
#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
|
||||
|
||||
//
|
||||
// EFlags
|
||||
//
|
||||
#define EFLAGS_CF 0x01L
|
||||
#define EFLAGS_ZF 0x40L
|
||||
#define EFLAGS_TF 0x100L
|
||||
#define EFLAGS_INTERRUPT_MASK 0x200L
|
||||
#define EFLAGS_DF 0x400L
|
||||
#define EFLAGS_NESTED_TASK 0x4000L
|
||||
#define EFLAGS_V86_MASK 0x20000
|
||||
#define EFLAGS_ALIGN_CHECK 0x40000
|
||||
#define EFLAGS_VIF 0x80000
|
||||
#define EFLAGS_VIP 0x100000
|
||||
#define EFLAGS_USER_SANITIZE 0x3F4DD7
|
||||
#define EFLAG_SIGN 0x8000
|
||||
#define EFLAG_ZERO 0x4000
|
||||
|
||||
//
|
||||
// IPI Types
|
||||
//
|
||||
#define IPI_APC 1
|
||||
#define IPI_DPC 2
|
||||
#define IPI_FREEZE 4
|
||||
#define IPI_PACKET_READY 8
|
||||
#define IPI_SYNCH_REQUEST 16
|
||||
|
||||
//
|
||||
// PRCB Flags
|
||||
//
|
||||
#define PRCB_MAJOR_VERSION 1
|
||||
#define PRCB_BUILD_DEBUG 1
|
||||
#define PRCB_BUILD_UNIPROCESSOR 2
|
||||
|
||||
//
|
||||
// HAL Variables
|
||||
//
|
||||
#define INITIAL_STALL_COUNT 0x64
|
||||
|
||||
//
|
||||
// IOPM Definitions
|
||||
//
|
||||
#define IO_ACCESS_MAP_NONE 0
|
||||
#define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
|
||||
#define KiComputeIopmOffset(MapNumber) \
|
||||
(MapNumber == IO_ACCESS_MAP_NONE) ? \
|
||||
(USHORT)(sizeof(KTSS)) : \
|
||||
(USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
|
||||
|
||||
//
|
||||
// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
|
||||
//
|
||||
#define KSEG0_BASE 0xfffff80000000000ULL
|
||||
|
||||
//
|
||||
// Synchronization-level IRQL
|
||||
//
|
||||
#ifndef CONFIG_SMP
|
||||
#define SYNCH_LEVEL DISPATCH_LEVEL
|
||||
#else
|
||||
#define SYNCH_LEVEL (IPI_LEVEL - 2)
|
||||
#endif
|
||||
|
||||
//
|
||||
// Trap Frame Definition
|
||||
//
|
||||
typedef struct _KTRAP_FRAME
|
||||
{
|
||||
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
|
||||
{
|
||||
UINT64 DebugControl;
|
||||
UINT64 LastBranchToRip;
|
||||
UINT64 LastBranchFromRip;
|
||||
UINT64 LastExceptionToRip;
|
||||
UINT64 LastExceptionFromRip;
|
||||
};
|
||||
struct
|
||||
{
|
||||
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 union _KGDTENTRY64
|
||||
{
|
||||
struct
|
||||
{
|
||||
USHORT LimitLow;
|
||||
USHORT BaseLow;
|
||||
union
|
||||
{
|
||||
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
|
||||
//
|
||||
typedef struct _KIDT_ACCESS
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Reserved;
|
||||
UCHAR SegmentType:4;
|
||||
UCHAR SystemSegmentFlag:1;
|
||||
UCHAR Dpl:2;
|
||||
UCHAR Present:1;
|
||||
};
|
||||
USHORT Value;
|
||||
};
|
||||
} KIDT_ACCESS, *PKIDT_ACCESS;
|
||||
|
||||
//
|
||||
// IDT Entry Definition
|
||||
//
|
||||
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;
|
||||
PVOID Base;
|
||||
} KDESCRIPTOR, *PKDESCRIPTOR;
|
||||
|
||||
#ifndef NTOS_MODE_USER
|
||||
|
||||
//
|
||||
// Special Registers Structure (outside of CONTEXT)
|
||||
//
|
||||
typedef struct _KSPECIAL_REGISTERS
|
||||
{
|
||||
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 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;
|
||||
|
||||
//
|
||||
// Processor State Data
|
||||
//
|
||||
typedef struct _KPROCESSOR_STATE
|
||||
{
|
||||
KSPECIAL_REGISTERS SpecialRegisters;
|
||||
CONTEXT ContextFrame;
|
||||
} 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
|
||||
//
|
||||
#pragma pack(push,4)
|
||||
typedef struct _KPRCB
|
||||
{
|
||||
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;
|
||||
#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;
|
||||
#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;
|
||||
#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;
|
||||
LONG LookasideIrpFloat;
|
||||
#else
|
||||
LONG LookasideIrpFloat;
|
||||
ULONG KeSystemCalls;
|
||||
#endif
|
||||
LONG IoReadOperationCount;
|
||||
LONG IoWriteOperationCount;
|
||||
LONG IoOtherOperationCount;
|
||||
LARGE_INTEGER IoReadTransferCount;
|
||||
LARGE_INTEGER IoWriteTransferCount;
|
||||
LARGE_INTEGER IoOtherTransferCount;
|
||||
#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;
|
||||
ULONG CcMapDataNoWait;
|
||||
ULONG CcMapDataWait;
|
||||
ULONG CcPinMappedDataCount;
|
||||
ULONG CcPinReadNoWait;
|
||||
ULONG CcPinReadWait;
|
||||
ULONG CcMdlReadNoWait;
|
||||
ULONG CcMdlReadWait;
|
||||
ULONG CcLazyWriteHotSpots;
|
||||
ULONG CcLazyWriteIos;
|
||||
ULONG CcLazyWritePages;
|
||||
ULONG CcDataFlushes;
|
||||
ULONG CcDataPages;
|
||||
ULONG CcLostDelayedWrites;
|
||||
ULONG CcFastReadResourceMiss;
|
||||
ULONG CcCopyReadWaitMiss;
|
||||
ULONG CcFastMdlReadResourceMiss;
|
||||
ULONG CcMapDataNoWaitMiss;
|
||||
ULONG CcMapDataWaitMiss;
|
||||
ULONG CcPinReadNoWaitMiss;
|
||||
ULONG CcPinReadWaitMiss;
|
||||
ULONG CcMdlReadNoWaitMiss;
|
||||
ULONG CcMdlReadWaitMiss;
|
||||
ULONG CcReadAheadIos;
|
||||
LONG MmCacheTransitionCount;
|
||||
LONG MmCacheReadCount;
|
||||
LONG MmCacheIoCount;
|
||||
ULONG PrcbPad91[3];
|
||||
PROCESSOR_POWER_STATE PowerState;
|
||||
ULONG KeAlignmentFixupCount;
|
||||
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;
|
||||
PVOID WheaInfo;
|
||||
PVOID EtwSupport;
|
||||
SLIST_HEADER InterruptObjectPool;
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
KPRCB, *PKPRCB;
|
||||
|
||||
//
|
||||
// Processor Control Region
|
||||
//
|
||||
typedef struct _KIPCR
|
||||
{
|
||||
union
|
||||
{
|
||||
NT_TIB NtTib;
|
||||
struct
|
||||
{
|
||||
union _KGDTENTRY64 *GdtBase;
|
||||
struct _KTSS64 *TssBase;
|
||||
ULONG64 UserRsp;
|
||||
struct _KPCR *Self;
|
||||
struct _KPRCB *CurrentPrcb;
|
||||
PKSPIN_LOCK_QUEUE LockArray;
|
||||
PVOID Used_Self;
|
||||
};
|
||||
};
|
||||
union _KIDTENTRY64 *IdtBase;
|
||||
ULONG64 Unused[2];
|
||||
KIRQL Irql;
|
||||
UCHAR SecondLevelCacheAssociativity;
|
||||
UCHAR ObsoleteNumber;
|
||||
UCHAR Fill0;
|
||||
ULONG Unused0[3];
|
||||
USHORT MajorVersion;
|
||||
USHORT MinorVersion;
|
||||
ULONG StallScaleFactor;
|
||||
PVOID Unused1[3];
|
||||
ULONG KernelReserved[15];
|
||||
ULONG SecondLevelCacheSize;
|
||||
ULONG HalReserved[16];
|
||||
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)
|
||||
|
||||
//
|
||||
// TSS Definition
|
||||
//
|
||||
typedef struct _KiIoAccessMap
|
||||
{
|
||||
UCHAR DirectionMap[32];
|
||||
UCHAR IoMap[8196];
|
||||
} KIIO_ACCESS_MAP;
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
//
|
||||
// Inline function to get current KPRCB
|
||||
//
|
||||
FORCEINLINE
|
||||
struct _KPRCB *
|
||||
KeGetCurrentPrcb(VOID)
|
||||
{
|
||||
return (struct _KPRCB *)__readgsqword(FIELD_OFFSET(KIPCR, CurrentPrcb));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
198
reactos/include/ndk/amd64/mmtypes.h
Normal file
198
reactos/include/ndk/amd64/mmtypes.h
Normal file
|
@ -0,0 +1,198 @@
|
|||
/*++ NDK Version: 0095
|
||||
|
||||
Copyright (c) Alex Ionescu. All rights reserved.
|
||||
Copyright (c) Timo Kreuzer All rights reserved.
|
||||
|
||||
Header Name:
|
||||
|
||||
mmtypes.h (AMD64)
|
||||
|
||||
Abstract:
|
||||
|
||||
AMD64 Type definitions for the Memory Manager
|
||||
|
||||
Author:
|
||||
|
||||
Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
|
||||
Timo Kreuzer (timo.kreuzer@reactos.com) 15-Aug-2008
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _AMD64_MMTYPES_H
|
||||
#define _AMD64_MMTYPES_H
|
||||
|
||||
//
|
||||
// Dependencies
|
||||
//
|
||||
|
||||
//
|
||||
// Page-related Macros
|
||||
//
|
||||
#define PAGE_SIZE 0x1000
|
||||
#define PAGE_SHIFT 12L
|
||||
#define MM_ALLOCATION_GRANULARITY 0x10000
|
||||
#define MM_ALLOCATION_GRANULARITY_SHIFT 16L
|
||||
|
||||
//
|
||||
// Sanity checks for Paging Macros
|
||||
//
|
||||
#ifdef C_ASSERT
|
||||
C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
|
||||
C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT));
|
||||
C_ASSERT(MM_ALLOCATION_GRANULARITY &&
|
||||
!(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1)));
|
||||
C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Page Table Entry Definitions
|
||||
//
|
||||
typedef struct _HARDWARE_PTE
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
ULONG64 Valid:1;
|
||||
ULONG64 Unused0:4;
|
||||
ULONG64 Protection:5;
|
||||
ULONG64 Prototype:1;
|
||||
ULONG64 Unused1:5;
|
||||
LONG64 SubsectionAddress:48;
|
||||
} MMPTE_SUBSECTION;
|
||||
|
||||
typedef struct _MMPTE_LIST
|
||||
{
|
||||
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;
|
||||
|
||||
typedef struct _MMPTE_HARDWARE
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
#endif // !AMD64_MMTYPES_H
|
|
@ -24,6 +24,8 @@ Author:
|
|||
//
|
||||
#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)
|
||||
|
|
|
@ -16,7 +16,9 @@ Author:
|
|||
Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
|
||||
|
||||
--*/
|
||||
|
||||
#ifdef _M_AMD64
|
||||
# include "amd64/asm.h"
|
||||
#else
|
||||
#ifndef _ASM_H
|
||||
#define _ASM_H
|
||||
|
||||
|
@ -639,5 +641,6 @@ Author:
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1077,7 +1077,7 @@ typedef struct _ETHREAD
|
|||
#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;
|
||||
|
|
Loading…
Reference in a new issue