mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[XDK]
- add x86/ke.h(mm.h and amd64/mm.h - cleanup ntddk.template.h, moving stuff into approproate headers svn path=/branches/header-work/; revision=46364
This commit is contained in:
parent
0ce290c185
commit
83fc2214b9
10 changed files with 1079 additions and 1055 deletions
File diff suppressed because it is too large
Load diff
|
@ -552,7 +552,6 @@ typedef BOOLEAN
|
|||
* Kernel Types *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
typedef UCHAR KIRQL, *PKIRQL;
|
||||
typedef CCHAR KPROCESSOR_MODE;
|
||||
typedef LONG KPRIORITY;
|
||||
|
@ -7710,6 +7709,7 @@ typedef struct _KFLOATING_SAVE {
|
|||
extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
|
||||
|
||||
#define YieldProcessor _mm_pause
|
||||
#define PAUSE_PROCESSOR YieldProcessor();
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
|
@ -7820,6 +7820,8 @@ _KeQueryTickCount(
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
#elif defined(_M_AMD64)
|
||||
/** Kernel definitions for AMD64 **/
|
||||
|
||||
|
@ -7861,6 +7863,7 @@ typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
|
|||
#define KeGetDcacheFillSize() 1L
|
||||
|
||||
#define YieldProcessor _mm_pause
|
||||
#define PAUSE_PROCESSOR YieldProcessor();
|
||||
|
||||
FORCEINLINE
|
||||
KIRQL
|
||||
|
@ -7935,6 +7938,8 @@ KeGetCurrentThread(VOID)
|
|||
#define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000))
|
||||
extern volatile LARGE_INTEGER KeTickCount;
|
||||
|
||||
#define PAUSE_PROCESSOR __yield();
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
KeFlushWriteBuffer(VOID)
|
||||
|
|
|
@ -91,5 +91,166 @@ KeGetCurrentThread(VOID)
|
|||
|
||||
/* x86 and x64 performs a 0x2C interrupt */
|
||||
#define DbgRaiseAssertionFailure __int2c
|
||||
$endif
|
||||
|
||||
$endif /* _WDMDDK_ */
|
||||
$if (_NTDDK_)
|
||||
|
||||
#define PAUSE_PROCESSOR YieldProcessor();
|
||||
|
||||
#define KERNEL_STACK_SIZE 0x6000
|
||||
#define KERNEL_LARGE_STACK_SIZE 0x12000
|
||||
#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
|
||||
|
||||
#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
|
||||
|
||||
#define EXCEPTION_READ_FAULT 0
|
||||
#define EXCEPTION_WRITE_FAULT 1
|
||||
#define EXCEPTION_EXECUTE_FAULT 8
|
||||
|
||||
#if !defined(RC_INVOKED)
|
||||
|
||||
#define CONTEXT_AMD64 0x100000
|
||||
|
||||
#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
|
||||
#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
|
||||
#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
|
||||
#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
|
||||
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
|
||||
|
||||
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
|
||||
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
|
||||
|
||||
#define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L)
|
||||
|
||||
#define CONTEXT_EXCEPTION_ACTIVE 0x8000000
|
||||
#define CONTEXT_SERVICE_ACTIVE 0x10000000
|
||||
#define CONTEXT_EXCEPTION_REQUEST 0x40000000
|
||||
#define CONTEXT_EXCEPTION_REPORTING 0x80000000
|
||||
|
||||
#endif /* !defined(RC_INVOKED) */
|
||||
|
||||
#define INITIAL_MXCSR 0x1f80
|
||||
#define INITIAL_FPCSR 0x027f
|
||||
|
||||
typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
|
||||
ULONG64 P1Home;
|
||||
ULONG64 P2Home;
|
||||
ULONG64 P3Home;
|
||||
ULONG64 P4Home;
|
||||
ULONG64 P5Home;
|
||||
ULONG64 P6Home;
|
||||
ULONG ContextFlags;
|
||||
ULONG MxCsr;
|
||||
USHORT SegCs;
|
||||
USHORT SegDs;
|
||||
USHORT SegEs;
|
||||
USHORT SegFs;
|
||||
USHORT SegGs;
|
||||
USHORT SegSs;
|
||||
ULONG EFlags;
|
||||
ULONG64 Dr0;
|
||||
ULONG64 Dr1;
|
||||
ULONG64 Dr2;
|
||||
ULONG64 Dr3;
|
||||
ULONG64 Dr6;
|
||||
ULONG64 Dr7;
|
||||
ULONG64 Rax;
|
||||
ULONG64 Rcx;
|
||||
ULONG64 Rdx;
|
||||
ULONG64 Rbx;
|
||||
ULONG64 Rsp;
|
||||
ULONG64 Rbp;
|
||||
ULONG64 Rsi;
|
||||
ULONG64 Rdi;
|
||||
ULONG64 R8;
|
||||
ULONG64 R9;
|
||||
ULONG64 R10;
|
||||
ULONG64 R11;
|
||||
ULONG64 R12;
|
||||
ULONG64 R13;
|
||||
ULONG64 R14;
|
||||
ULONG64 R15;
|
||||
ULONG64 Rip;
|
||||
union {
|
||||
XMM_SAVE_AREA32 FltSave;
|
||||
struct {
|
||||
M128A Header[2];
|
||||
M128A Legacy[8];
|
||||
M128A Xmm0;
|
||||
M128A Xmm1;
|
||||
M128A Xmm2;
|
||||
M128A Xmm3;
|
||||
M128A Xmm4;
|
||||
M128A Xmm5;
|
||||
M128A Xmm6;
|
||||
M128A Xmm7;
|
||||
M128A Xmm8;
|
||||
M128A Xmm9;
|
||||
M128A Xmm10;
|
||||
M128A Xmm11;
|
||||
M128A Xmm12;
|
||||
M128A Xmm13;
|
||||
M128A Xmm14;
|
||||
M128A Xmm15;
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
M128A VectorRegister[26];
|
||||
ULONG64 VectorControl;
|
||||
ULONG64 DebugControl;
|
||||
ULONG64 LastBranchToRip;
|
||||
ULONG64 LastBranchFromRip;
|
||||
ULONG64 LastExceptionToRip;
|
||||
ULONG64 LastExceptionFromRip;
|
||||
} CONTEXT;
|
||||
|
||||
typedef struct _KPCR
|
||||
{
|
||||
_ANONYMOUS_UNION union
|
||||
{
|
||||
NT_TIB NtTib;
|
||||
_ANONYMOUS_STRUCT 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;
|
||||
PVOID KdVersionBlock;
|
||||
PVOID Unused3;
|
||||
ULONG PcrAlign1[24];
|
||||
} KPCR, *PKPCR;
|
||||
|
||||
FORCEINLINE
|
||||
PKPCR
|
||||
KeGetPcr(VOID)
|
||||
{
|
||||
return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
ULONG
|
||||
KeGetCurrentProcessorNumber(VOID)
|
||||
{
|
||||
return (ULONG)__readgsword(0x184);
|
||||
}
|
||||
|
||||
$endif /* _NTDDK_ */
|
||||
|
|
34
include/xdk/amd64/mm.h
Normal file
34
include/xdk/amd64/mm.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
$if (_NTDDK_)
|
||||
|
||||
#define PTI_SHIFT 12L
|
||||
#define PDI_SHIFT 21L
|
||||
#define PPI_SHIFT 30L
|
||||
#define PXI_SHIFT 39L
|
||||
#define PTE_PER_PAGE 512
|
||||
#define PDE_PER_PAGE 512
|
||||
#define PPE_PER_PAGE 512
|
||||
#define PXE_PER_PAGE 512
|
||||
#define PTI_MASK_AMD64 (PTE_PER_PAGE - 1)
|
||||
#define PDI_MASK_AMD64 (PDE_PER_PAGE - 1)
|
||||
#define PPI_MASK (PPE_PER_PAGE - 1)
|
||||
#define PXI_MASK (PXE_PER_PAGE - 1)
|
||||
|
||||
#define PXE_BASE 0xFFFFF6FB7DBED000ULL
|
||||
#define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL
|
||||
#define PPE_BASE 0xFFFFF6FB7DA00000ULL
|
||||
#define PDE_BASE 0xFFFFF6FB40000000ULL
|
||||
#define PTE_BASE 0xFFFFF68000000000ULL
|
||||
#define PXE_TOP 0xFFFFF6FB7DBEDFFFULL
|
||||
#define PPE_TOP 0xFFFFF6FB7DBFFFFFULL
|
||||
#define PDE_TOP 0xFFFFF6FB7FFFFFFFULL
|
||||
#define PTE_TOP 0xFFFFF6FFFFFFFFFFULL
|
||||
|
||||
#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
|
||||
#define MM_SYSTEM_RANGE_START MmSystemRangeStart
|
||||
#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
|
||||
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
|
||||
#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
|
||||
|
||||
$endif /* _NTDDK_ */
|
||||
|
|
@ -66,6 +66,34 @@ ExFreeToZone(
|
|||
#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
|
||||
#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
|
||||
#define ExReleaseResourceForThread ExReleaseResourceForThreadLite
|
||||
|
||||
typedef enum _INTERLOCKED_RESULT {
|
||||
ResultNegative = RESULT_NEGATIVE,
|
||||
ResultZero = RESULT_ZERO,
|
||||
ResultPositive = RESULT_POSITIVE
|
||||
} INTERLOCKED_RESULT;
|
||||
|
||||
#ifdef _X86_
|
||||
NTKERNELAPI
|
||||
INTERLOCKED_RESULT
|
||||
FASTCALL
|
||||
Exfi386InterlockedIncrementLong(
|
||||
IN OUT LONG volatile *Addend);
|
||||
|
||||
NTKERNELAPI
|
||||
INTERLOCKED_RESULT
|
||||
FASTCALL
|
||||
Exfi386InterlockedDecrementLong(
|
||||
IN PLONG Addend);
|
||||
|
||||
NTKERNELAPI
|
||||
ULONG
|
||||
FASTCALL
|
||||
Exfi386InterlockedExchangeUlong(
|
||||
IN PULONG Target,
|
||||
IN ULONG Value);
|
||||
#endif
|
||||
|
||||
$endif
|
||||
|
||||
$if (_WDMDDK_)
|
||||
|
|
|
@ -19,6 +19,8 @@ $if (_WDMDDK_)
|
|||
#define KI_USER_SHARED_DATA ((ULONG_PTR)(KADDRESS_BASE + 0xFFFE0000))
|
||||
extern volatile LARGE_INTEGER KeTickCount;
|
||||
|
||||
#define PAUSE_PROCESSOR __yield();
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
KeFlushWriteBuffer(VOID)
|
||||
|
|
|
@ -1,60 +1,8 @@
|
|||
/******************************************************************************
|
||||
* Kernel Types *
|
||||
******************************************************************************/
|
||||
|
||||
$if (_NTDDK_)
|
||||
typedef VOID
|
||||
(NTAPI *PEXPAND_STACK_CALLOUT)(
|
||||
IN PVOID Parameter OPTIONAL);
|
||||
|
||||
typedef VOID
|
||||
(NTAPI *PTIMER_APC_ROUTINE)(
|
||||
IN PVOID TimerContext,
|
||||
IN ULONG TimerLowValue,
|
||||
IN LONG TimerHighValue);
|
||||
|
||||
typedef enum _TIMER_SET_INFORMATION_CLASS {
|
||||
TimerSetCoalescableTimer,
|
||||
MaxTimerInfoClass
|
||||
} TIMER_SET_INFORMATION_CLASS;
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
|
||||
IN LARGE_INTEGER DueTime;
|
||||
IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
|
||||
IN PVOID TimerContext OPTIONAL;
|
||||
IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
|
||||
IN ULONG Period OPTIONAL;
|
||||
IN ULONG TolerableDelay;
|
||||
OUT PBOOLEAN PreviousState OPTIONAL;
|
||||
} TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
|
||||
#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
|
||||
|
||||
#define XSTATE_LEGACY_FLOATING_POINT 0
|
||||
#define XSTATE_LEGACY_SSE 1
|
||||
#define XSTATE_GSSE 2
|
||||
|
||||
#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT))
|
||||
#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
|
||||
#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
|
||||
#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
|
||||
|
||||
#define MAXIMUM_XSTATE_FEATURES 64
|
||||
|
||||
typedef struct _XSTATE_FEATURE {
|
||||
ULONG Offset;
|
||||
ULONG Size;
|
||||
} XSTATE_FEATURE, *PXSTATE_FEATURE;
|
||||
|
||||
typedef struct _XSTATE_CONFIGURATION {
|
||||
ULONG64 EnabledFeatures;
|
||||
ULONG Size;
|
||||
ULONG OptimizedSave:1;
|
||||
XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
|
||||
} XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
|
||||
$endif
|
||||
|
||||
$if (_WDMDDK_)
|
||||
|
||||
typedef UCHAR KIRQL, *PKIRQL;
|
||||
typedef CCHAR KPROCESSOR_MODE;
|
||||
typedef LONG KPRIORITY;
|
||||
|
@ -1049,5 +997,182 @@ extern NTSYSAPI CCHAR KeNumberProcessors;
|
|||
extern PCCHAR KeNumberProcessors;
|
||||
#endif
|
||||
|
||||
$endif
|
||||
$endif /* _WDMDDK_ */
|
||||
$if (_NTDDK_)
|
||||
|
||||
typedef VOID
|
||||
(NTAPI *PEXPAND_STACK_CALLOUT)(
|
||||
IN PVOID Parameter OPTIONAL);
|
||||
|
||||
typedef VOID
|
||||
(NTAPI *PTIMER_APC_ROUTINE)(
|
||||
IN PVOID TimerContext,
|
||||
IN ULONG TimerLowValue,
|
||||
IN LONG TimerHighValue);
|
||||
|
||||
typedef enum _TIMER_SET_INFORMATION_CLASS {
|
||||
TimerSetCoalescableTimer,
|
||||
MaxTimerInfoClass
|
||||
} TIMER_SET_INFORMATION_CLASS;
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
|
||||
IN LARGE_INTEGER DueTime;
|
||||
IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
|
||||
IN PVOID TimerContext OPTIONAL;
|
||||
IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
|
||||
IN ULONG Period OPTIONAL;
|
||||
IN ULONG TolerableDelay;
|
||||
OUT PBOOLEAN PreviousState OPTIONAL;
|
||||
} TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
|
||||
#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
|
||||
|
||||
#define XSTATE_LEGACY_FLOATING_POINT 0
|
||||
#define XSTATE_LEGACY_SSE 1
|
||||
#define XSTATE_GSSE 2
|
||||
|
||||
#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT))
|
||||
#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
|
||||
#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
|
||||
#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
|
||||
|
||||
#define MAXIMUM_XSTATE_FEATURES 64
|
||||
|
||||
typedef struct _XSTATE_FEATURE {
|
||||
ULONG Offset;
|
||||
ULONG Size;
|
||||
} XSTATE_FEATURE, *PXSTATE_FEATURE;
|
||||
|
||||
typedef struct _XSTATE_CONFIGURATION {
|
||||
ULONG64 EnabledFeatures;
|
||||
ULONG Size;
|
||||
ULONG OptimizedSave:1;
|
||||
XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
|
||||
} XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
|
||||
|
||||
#define MAX_WOW64_SHARED_ENTRIES 16
|
||||
|
||||
typedef struct _KUSER_SHARED_DATA {
|
||||
ULONG TickCountLowDeprecated;
|
||||
ULONG TickCountMultiplier;
|
||||
volatile KSYSTEM_TIME InterruptTime;
|
||||
volatile KSYSTEM_TIME SystemTime;
|
||||
volatile KSYSTEM_TIME TimeZoneBias;
|
||||
USHORT ImageNumberLow;
|
||||
USHORT ImageNumberHigh;
|
||||
WCHAR NtSystemRoot[260];
|
||||
ULONG MaxStackTraceDepth;
|
||||
ULONG CryptoExponent;
|
||||
ULONG TimeZoneId;
|
||||
ULONG LargePageMinimum;
|
||||
ULONG Reserved2[7];
|
||||
NT_PRODUCT_TYPE NtProductType;
|
||||
BOOLEAN ProductTypeIsValid;
|
||||
ULONG NtMajorVersion;
|
||||
ULONG NtMinorVersion;
|
||||
BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
|
||||
ULONG Reserved1;
|
||||
ULONG Reserved3;
|
||||
volatile ULONG TimeSlip;
|
||||
ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
|
||||
ULONG AltArchitecturePad[1];
|
||||
LARGE_INTEGER SystemExpirationDate;
|
||||
ULONG SuiteMask;
|
||||
BOOLEAN KdDebuggerEnabled;
|
||||
#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
|
||||
UCHAR NXSupportPolicy;
|
||||
#endif
|
||||
volatile ULONG ActiveConsoleId;
|
||||
volatile ULONG DismountCount;
|
||||
ULONG ComPlusPackage;
|
||||
ULONG LastSystemRITEventTickCount;
|
||||
ULONG NumberOfPhysicalPages;
|
||||
BOOLEAN SafeBootMode;
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
union {
|
||||
UCHAR TscQpcData;
|
||||
struct {
|
||||
UCHAR TscQpcEnabled:1;
|
||||
UCHAR TscQpcSpareFlag:1;
|
||||
UCHAR TscQpcShift:6;
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
UCHAR TscQpcPad[2];
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
union {
|
||||
ULONG SharedDataFlags;
|
||||
struct {
|
||||
ULONG DbgErrorPortPresent:1;
|
||||
ULONG DbgElevationEnabled:1;
|
||||
ULONG DbgVirtEnabled:1;
|
||||
ULONG DbgInstallerDetectEnabled:1;
|
||||
ULONG DbgSystemDllRelocated:1;
|
||||
ULONG DbgDynProcessorEnabled:1;
|
||||
ULONG DbgSEHValidationEnabled:1;
|
||||
ULONG SpareBits:25;
|
||||
} DUMMYSTRUCTNAME2;
|
||||
} DUMMYUNIONNAME2;
|
||||
#else
|
||||
ULONG TraceLogging;
|
||||
#endif
|
||||
ULONG DataFlagsPad[1];
|
||||
ULONGLONG TestRetInstruction;
|
||||
ULONG SystemCall;
|
||||
ULONG SystemCallReturn;
|
||||
ULONGLONG SystemCallPad[3];
|
||||
_ANONYMOUS_UNION union {
|
||||
volatile KSYSTEM_TIME TickCount;
|
||||
volatile ULONG64 TickCountQuad;
|
||||
_ANONYMOUS_STRUCT struct {
|
||||
ULONG ReservedTickCountOverlay[3];
|
||||
ULONG TickCountPad[1];
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME3;
|
||||
ULONG Cookie;
|
||||
ULONG CookiePad[1];
|
||||
#if (NTDDI_VERSION >= NTDDI_WS03)
|
||||
LONGLONG ConsoleSessionForegroundProcessId;
|
||||
ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
USHORT UserModeGlobalLogger[16];
|
||||
#else
|
||||
USHORT UserModeGlobalLogger[8];
|
||||
ULONG HeapTracingPid[2];
|
||||
ULONG CritSecTracingPid[2];
|
||||
#endif
|
||||
ULONG ImageFileExecutionOptions;
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTASP1)
|
||||
ULONG LangGenerationCount;
|
||||
#else
|
||||
/* 4 bytes padding */
|
||||
#endif
|
||||
ULONGLONG Reserved5;
|
||||
volatile ULONG64 InterruptTimeBias;
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
volatile ULONG64 TscQpcBias;
|
||||
volatile ULONG ActiveProcessorCount;
|
||||
volatile USHORT ActiveGroupCount;
|
||||
USHORT Reserved4;
|
||||
volatile ULONG AitSamplingValue;
|
||||
volatile ULONG AppCompatFlag;
|
||||
ULONGLONG SystemDllNativeRelocation;
|
||||
ULONG SystemDllWowRelocation;
|
||||
ULONG XStatePad[1];
|
||||
XSTATE_CONFIGURATION XState;
|
||||
#endif
|
||||
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
extern NTSYSAPI volatile CCHAR KeNumberProcessors;
|
||||
#elif (NTDDI_VERSION >= NTDDI_WINXP)
|
||||
extern NTSYSAPI CCHAR KeNumberProcessors;
|
||||
#else
|
||||
extern PCCHAR KeNumberProcessors;
|
||||
#endif
|
||||
|
||||
$endif /* _NTDDK_ */
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <excpt.h>
|
||||
#include <ntdef.h>
|
||||
#include <ntstatus.h>
|
||||
#include <mce.h>
|
||||
|
||||
/* FIXME
|
||||
#include <bugcodes.h>
|
||||
|
@ -92,200 +93,6 @@ typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
|
|||
|
||||
#endif /* _NTIMAGE_ */
|
||||
|
||||
#define PsGetCurrentProcess IoGetCurrentProcess
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
extern NTSYSAPI volatile CCHAR KeNumberProcessors;
|
||||
#elif (NTDDI_VERSION >= NTDDI_WINXP)
|
||||
extern NTSYSAPI CCHAR KeNumberProcessors;
|
||||
#else
|
||||
extern PCCHAR KeNumberProcessors;
|
||||
#endif
|
||||
|
||||
#include <mce.h>
|
||||
|
||||
#ifdef _X86_
|
||||
|
||||
#define KERNEL_STACK_SIZE 12288
|
||||
#define KERNEL_LARGE_STACK_SIZE 61440
|
||||
#define KERNEL_LARGE_STACK_COMMIT 12288
|
||||
|
||||
#define SIZE_OF_80387_REGISTERS 80
|
||||
|
||||
#if !defined(RC_INVOKED)
|
||||
|
||||
#define CONTEXT_i386 0x10000
|
||||
#define CONTEXT_i486 0x10000
|
||||
#define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
|
||||
#define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
|
||||
#define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
|
||||
#define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
|
||||
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
|
||||
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
|
||||
|
||||
#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
|
||||
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
|
||||
CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \
|
||||
CONTEXT_EXTENDED_REGISTERS)
|
||||
|
||||
#define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L)
|
||||
|
||||
#endif /* !defined(RC_INVOKED) */
|
||||
|
||||
typedef struct _FLOATING_SAVE_AREA {
|
||||
ULONG ControlWord;
|
||||
ULONG StatusWord;
|
||||
ULONG TagWord;
|
||||
ULONG ErrorOffset;
|
||||
ULONG ErrorSelector;
|
||||
ULONG DataOffset;
|
||||
ULONG DataSelector;
|
||||
UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
|
||||
ULONG Cr0NpxState;
|
||||
} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
|
||||
|
||||
#include "pshpack4.h"
|
||||
typedef struct _CONTEXT {
|
||||
ULONG ContextFlags;
|
||||
ULONG Dr0;
|
||||
ULONG Dr1;
|
||||
ULONG Dr2;
|
||||
ULONG Dr3;
|
||||
ULONG Dr6;
|
||||
ULONG Dr7;
|
||||
FLOATING_SAVE_AREA FloatSave;
|
||||
ULONG SegGs;
|
||||
ULONG SegFs;
|
||||
ULONG SegEs;
|
||||
ULONG SegDs;
|
||||
ULONG Edi;
|
||||
ULONG Esi;
|
||||
ULONG Ebx;
|
||||
ULONG Edx;
|
||||
ULONG Ecx;
|
||||
ULONG Eax;
|
||||
ULONG Ebp;
|
||||
ULONG Eip;
|
||||
ULONG SegCs;
|
||||
ULONG EFlags;
|
||||
ULONG Esp;
|
||||
ULONG SegSs;
|
||||
UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
|
||||
} CONTEXT;
|
||||
#include "poppack.h"
|
||||
|
||||
#endif /* _X86_ */
|
||||
|
||||
#ifdef _AMD64_
|
||||
|
||||
#define KERNEL_STACK_SIZE 0x6000
|
||||
#define KERNEL_LARGE_STACK_SIZE 0x12000
|
||||
#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
|
||||
|
||||
#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
|
||||
|
||||
#define EXCEPTION_READ_FAULT 0
|
||||
#define EXCEPTION_WRITE_FAULT 1
|
||||
#define EXCEPTION_EXECUTE_FAULT 8
|
||||
|
||||
#if !defined(RC_INVOKED)
|
||||
|
||||
#define CONTEXT_AMD64 0x100000
|
||||
|
||||
#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
|
||||
#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
|
||||
#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
|
||||
#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
|
||||
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
|
||||
|
||||
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
|
||||
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
|
||||
|
||||
#define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L)
|
||||
|
||||
#define CONTEXT_EXCEPTION_ACTIVE 0x8000000
|
||||
#define CONTEXT_SERVICE_ACTIVE 0x10000000
|
||||
#define CONTEXT_EXCEPTION_REQUEST 0x40000000
|
||||
#define CONTEXT_EXCEPTION_REPORTING 0x80000000
|
||||
|
||||
#endif /* !defined(RC_INVOKED) */
|
||||
|
||||
#define INITIAL_MXCSR 0x1f80
|
||||
#define INITIAL_FPCSR 0x027f
|
||||
|
||||
typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
|
||||
ULONG64 P1Home;
|
||||
ULONG64 P2Home;
|
||||
ULONG64 P3Home;
|
||||
ULONG64 P4Home;
|
||||
ULONG64 P5Home;
|
||||
ULONG64 P6Home;
|
||||
ULONG ContextFlags;
|
||||
ULONG MxCsr;
|
||||
USHORT SegCs;
|
||||
USHORT SegDs;
|
||||
USHORT SegEs;
|
||||
USHORT SegFs;
|
||||
USHORT SegGs;
|
||||
USHORT SegSs;
|
||||
ULONG EFlags;
|
||||
ULONG64 Dr0;
|
||||
ULONG64 Dr1;
|
||||
ULONG64 Dr2;
|
||||
ULONG64 Dr3;
|
||||
ULONG64 Dr6;
|
||||
ULONG64 Dr7;
|
||||
ULONG64 Rax;
|
||||
ULONG64 Rcx;
|
||||
ULONG64 Rdx;
|
||||
ULONG64 Rbx;
|
||||
ULONG64 Rsp;
|
||||
ULONG64 Rbp;
|
||||
ULONG64 Rsi;
|
||||
ULONG64 Rdi;
|
||||
ULONG64 R8;
|
||||
ULONG64 R9;
|
||||
ULONG64 R10;
|
||||
ULONG64 R11;
|
||||
ULONG64 R12;
|
||||
ULONG64 R13;
|
||||
ULONG64 R14;
|
||||
ULONG64 R15;
|
||||
ULONG64 Rip;
|
||||
union {
|
||||
XMM_SAVE_AREA32 FltSave;
|
||||
struct {
|
||||
M128A Header[2];
|
||||
M128A Legacy[8];
|
||||
M128A Xmm0;
|
||||
M128A Xmm1;
|
||||
M128A Xmm2;
|
||||
M128A Xmm3;
|
||||
M128A Xmm4;
|
||||
M128A Xmm5;
|
||||
M128A Xmm6;
|
||||
M128A Xmm7;
|
||||
M128A Xmm8;
|
||||
M128A Xmm9;
|
||||
M128A Xmm10;
|
||||
M128A Xmm11;
|
||||
M128A Xmm12;
|
||||
M128A Xmm13;
|
||||
M128A Xmm14;
|
||||
M128A Xmm15;
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
M128A VectorRegister[26];
|
||||
ULONG64 VectorControl;
|
||||
ULONG64 DebugControl;
|
||||
ULONG64 LastBranchToRip;
|
||||
ULONG64 LastBranchFromRip;
|
||||
ULONG64 LastExceptionToRip;
|
||||
ULONG64 LastExceptionFromRip;
|
||||
} CONTEXT;
|
||||
|
||||
#endif /* _AMD64_ */
|
||||
|
||||
$define (_NTDDK_)
|
||||
$include (extypes.h)
|
||||
$include (iotypes.h)
|
||||
|
@ -297,6 +104,24 @@ $include (pstypes.h)
|
|||
$include (rtltypes.h)
|
||||
$include (setypes.h)
|
||||
|
||||
#if defined(_M_IX86)
|
||||
$include(x86/ke.h)
|
||||
$include(x86/mm.h)
|
||||
#elif defined(_M_AMD64)
|
||||
$include(amd64/ke.h)
|
||||
$include(amd64/mm.h)
|
||||
#elif defined(_M_IA64)
|
||||
$include(ia64/ke.h)
|
||||
#elif defined(_M_PPC)
|
||||
$include(ppc/ke.h)
|
||||
#elif defined(_M_MIPS)
|
||||
$include(mips/ke.h)
|
||||
#elif defined(_M_ARM)
|
||||
$include(arm/ke.h)
|
||||
#else
|
||||
#error Unknown Architecture
|
||||
#endif
|
||||
|
||||
$include (exfuncs.h)
|
||||
$include (halfuncs.h)
|
||||
$include (iofuncs.h)
|
||||
|
@ -532,8 +357,6 @@ typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
|
|||
#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
|
||||
#define DRIVER_VERIFIER_IO_CHECKING 0x0010
|
||||
|
||||
#define MAX_WOW64_SHARED_ENTRIES 16
|
||||
|
||||
#define NX_SUPPORT_POLICY_ALWAYSOFF 0
|
||||
#define NX_SUPPORT_POLICY_ALWAYSON 1
|
||||
#define NX_SUPPORT_POLICY_OPTIN 2
|
||||
|
@ -573,120 +396,6 @@ typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
|
|||
#define EX_TEST_CLEAR_BIT(Flags, Bit) \
|
||||
InterlockedBitTestAndReset ((PLONG)(Flags), (Bit))
|
||||
|
||||
typedef struct _KUSER_SHARED_DATA {
|
||||
ULONG TickCountLowDeprecated;
|
||||
ULONG TickCountMultiplier;
|
||||
volatile KSYSTEM_TIME InterruptTime;
|
||||
volatile KSYSTEM_TIME SystemTime;
|
||||
volatile KSYSTEM_TIME TimeZoneBias;
|
||||
USHORT ImageNumberLow;
|
||||
USHORT ImageNumberHigh;
|
||||
WCHAR NtSystemRoot[260];
|
||||
ULONG MaxStackTraceDepth;
|
||||
ULONG CryptoExponent;
|
||||
ULONG TimeZoneId;
|
||||
ULONG LargePageMinimum;
|
||||
ULONG Reserved2[7];
|
||||
NT_PRODUCT_TYPE NtProductType;
|
||||
BOOLEAN ProductTypeIsValid;
|
||||
ULONG NtMajorVersion;
|
||||
ULONG NtMinorVersion;
|
||||
BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
|
||||
ULONG Reserved1;
|
||||
ULONG Reserved3;
|
||||
volatile ULONG TimeSlip;
|
||||
ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
|
||||
ULONG AltArchitecturePad[1];
|
||||
LARGE_INTEGER SystemExpirationDate;
|
||||
ULONG SuiteMask;
|
||||
BOOLEAN KdDebuggerEnabled;
|
||||
#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
|
||||
UCHAR NXSupportPolicy;
|
||||
#endif
|
||||
volatile ULONG ActiveConsoleId;
|
||||
volatile ULONG DismountCount;
|
||||
ULONG ComPlusPackage;
|
||||
ULONG LastSystemRITEventTickCount;
|
||||
ULONG NumberOfPhysicalPages;
|
||||
BOOLEAN SafeBootMode;
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
union {
|
||||
UCHAR TscQpcData;
|
||||
struct {
|
||||
UCHAR TscQpcEnabled:1;
|
||||
UCHAR TscQpcSpareFlag:1;
|
||||
UCHAR TscQpcShift:6;
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
UCHAR TscQpcPad[2];
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
union {
|
||||
ULONG SharedDataFlags;
|
||||
struct {
|
||||
ULONG DbgErrorPortPresent:1;
|
||||
ULONG DbgElevationEnabled:1;
|
||||
ULONG DbgVirtEnabled:1;
|
||||
ULONG DbgInstallerDetectEnabled:1;
|
||||
ULONG DbgSystemDllRelocated:1;
|
||||
ULONG DbgDynProcessorEnabled:1;
|
||||
ULONG DbgSEHValidationEnabled:1;
|
||||
ULONG SpareBits:25;
|
||||
} DUMMYSTRUCTNAME2;
|
||||
} DUMMYUNIONNAME2;
|
||||
#else
|
||||
ULONG TraceLogging;
|
||||
#endif
|
||||
ULONG DataFlagsPad[1];
|
||||
ULONGLONG TestRetInstruction;
|
||||
ULONG SystemCall;
|
||||
ULONG SystemCallReturn;
|
||||
ULONGLONG SystemCallPad[3];
|
||||
_ANONYMOUS_UNION union {
|
||||
volatile KSYSTEM_TIME TickCount;
|
||||
volatile ULONG64 TickCountQuad;
|
||||
_ANONYMOUS_STRUCT struct {
|
||||
ULONG ReservedTickCountOverlay[3];
|
||||
ULONG TickCountPad[1];
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME3;
|
||||
ULONG Cookie;
|
||||
ULONG CookiePad[1];
|
||||
#if (NTDDI_VERSION >= NTDDI_WS03)
|
||||
LONGLONG ConsoleSessionForegroundProcessId;
|
||||
ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTA)
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
USHORT UserModeGlobalLogger[16];
|
||||
#else
|
||||
USHORT UserModeGlobalLogger[8];
|
||||
ULONG HeapTracingPid[2];
|
||||
ULONG CritSecTracingPid[2];
|
||||
#endif
|
||||
ULONG ImageFileExecutionOptions;
|
||||
#if (NTDDI_VERSION >= NTDDI_VISTASP1)
|
||||
ULONG LangGenerationCount;
|
||||
#else
|
||||
/* 4 bytes padding */
|
||||
#endif
|
||||
ULONGLONG Reserved5;
|
||||
volatile ULONG64 InterruptTimeBias;
|
||||
#endif
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
volatile ULONG64 TscQpcBias;
|
||||
volatile ULONG ActiveProcessorCount;
|
||||
volatile USHORT ActiveGroupCount;
|
||||
USHORT Reserved4;
|
||||
volatile ULONG AitSamplingValue;
|
||||
volatile ULONG AppCompatFlag;
|
||||
ULONGLONG SystemDllNativeRelocation;
|
||||
ULONG SystemDllWowRelocation;
|
||||
ULONG XStatePad[1];
|
||||
XSTATE_CONFIGURATION XState;
|
||||
#endif
|
||||
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
|
||||
|
||||
#define CmResourceTypeMaximum 8
|
||||
|
||||
typedef struct _CM_PCCARD_DEVICE_DATA {
|
||||
|
@ -710,12 +419,6 @@ typedef struct _CM_PCCARD_DEVICE_DATA {
|
|||
#define PCCARD_DUP_LEGACY_BASE 0x06
|
||||
#define PCCARD_NO_CONTROLLERS 0x07
|
||||
|
||||
#if defined(_X86_) || defined(_AMD64_)
|
||||
#define PAUSE_PROCESSOR YieldProcessor();
|
||||
#elif defined(_IA64_)
|
||||
#define PAUSE_PROCESSOR __yield();
|
||||
#endif
|
||||
|
||||
#define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2))
|
||||
|
||||
/* Filesystem runtime library routines */
|
||||
|
@ -730,189 +433,6 @@ FsRtlIsTotalDeviceFailure(
|
|||
|
||||
/* FIXME : These definitions below doesn't belong to NTDDK */
|
||||
|
||||
#ifdef _X86_
|
||||
|
||||
extern NTKERNELAPI PVOID MmHighestUserAddress;
|
||||
extern NTKERNELAPI PVOID MmSystemRangeStart;
|
||||
extern NTKERNELAPI ULONG MmUserProbeAddress;
|
||||
|
||||
#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
|
||||
#define MM_SYSTEM_RANGE_START MmSystemRangeStart
|
||||
#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
|
||||
#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
|
||||
extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
|
||||
#else
|
||||
#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
|
||||
#endif
|
||||
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
|
||||
#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
|
||||
#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
|
||||
#if !defined (_X86PAE_)
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
|
||||
#else
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
|
||||
#endif
|
||||
|
||||
#define KeGetPcr() PCR
|
||||
|
||||
#define PCR_MINOR_VERSION 1
|
||||
#define PCR_MAJOR_VERSION 1
|
||||
|
||||
typedef struct _KPCR {
|
||||
union {
|
||||
NT_TIB NtTib;
|
||||
struct {
|
||||
struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
|
||||
PVOID Used_StackBase;
|
||||
PVOID Spare2;
|
||||
PVOID TssCopy;
|
||||
ULONG ContextSwitches;
|
||||
KAFFINITY SetMemberCopy;
|
||||
PVOID Used_Self;
|
||||
};
|
||||
};
|
||||
struct _KPCR *SelfPcr;
|
||||
struct _KPRCB *Prcb;
|
||||
KIRQL Irql;
|
||||
ULONG IRR;
|
||||
ULONG IrrActive;
|
||||
ULONG IDR;
|
||||
PVOID KdVersionBlock;
|
||||
struct _KIDTENTRY *IDT;
|
||||
struct _KGDTENTRY *GDT;
|
||||
struct _KTSS *TSS;
|
||||
USHORT MajorVersion;
|
||||
USHORT MinorVersion;
|
||||
KAFFINITY SetMember;
|
||||
ULONG StallScaleFactor;
|
||||
UCHAR SpareUnused;
|
||||
UCHAR Number;
|
||||
UCHAR Spare0;
|
||||
UCHAR SecondLevelCacheAssociativity;
|
||||
ULONG VdmAlert;
|
||||
ULONG KernelReserved[14];
|
||||
ULONG SecondLevelCacheSize;
|
||||
ULONG HalReserved[16];
|
||||
} KPCR, *PKPCR;
|
||||
|
||||
FORCEINLINE
|
||||
ULONG
|
||||
KeGetCurrentProcessorNumber(VOID)
|
||||
{
|
||||
return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
|
||||
}
|
||||
|
||||
typedef enum _INTERLOCKED_RESULT {
|
||||
ResultNegative = RESULT_NEGATIVE,
|
||||
ResultZero = RESULT_ZERO,
|
||||
ResultPositive = RESULT_POSITIVE
|
||||
} INTERLOCKED_RESULT;
|
||||
|
||||
NTKERNELAPI
|
||||
INTERLOCKED_RESULT
|
||||
FASTCALL
|
||||
Exfi386InterlockedIncrementLong(
|
||||
IN OUT LONG volatile *Addend);
|
||||
|
||||
NTKERNELAPI
|
||||
INTERLOCKED_RESULT
|
||||
FASTCALL
|
||||
Exfi386InterlockedDecrementLong(
|
||||
IN PLONG Addend);
|
||||
|
||||
NTKERNELAPI
|
||||
ULONG
|
||||
FASTCALL
|
||||
Exfi386InterlockedExchangeUlong(
|
||||
IN PULONG Target,
|
||||
IN ULONG Value);
|
||||
|
||||
#endif /* _X86_ */
|
||||
|
||||
#ifdef _AMD64_
|
||||
|
||||
#define PTI_SHIFT 12L
|
||||
#define PDI_SHIFT 21L
|
||||
#define PPI_SHIFT 30L
|
||||
#define PXI_SHIFT 39L
|
||||
#define PTE_PER_PAGE 512
|
||||
#define PDE_PER_PAGE 512
|
||||
#define PPE_PER_PAGE 512
|
||||
#define PXE_PER_PAGE 512
|
||||
#define PTI_MASK_AMD64 (PTE_PER_PAGE - 1)
|
||||
#define PDI_MASK_AMD64 (PDE_PER_PAGE - 1)
|
||||
#define PPI_MASK (PPE_PER_PAGE - 1)
|
||||
#define PXI_MASK (PXE_PER_PAGE - 1)
|
||||
|
||||
#define PXE_BASE 0xFFFFF6FB7DBED000ULL
|
||||
#define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL
|
||||
#define PPE_BASE 0xFFFFF6FB7DA00000ULL
|
||||
#define PDE_BASE 0xFFFFF6FB40000000ULL
|
||||
#define PTE_BASE 0xFFFFF68000000000ULL
|
||||
#define PXE_TOP 0xFFFFF6FB7DBEDFFFULL
|
||||
#define PPE_TOP 0xFFFFF6FB7DBFFFFFULL
|
||||
#define PDE_TOP 0xFFFFF6FB7FFFFFFFULL
|
||||
#define PTE_TOP 0xFFFFF6FFFFFFFFFFULL
|
||||
|
||||
#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
|
||||
#define MM_SYSTEM_RANGE_START MmSystemRangeStart
|
||||
#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
|
||||
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
|
||||
#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
|
||||
|
||||
typedef struct _KPCR
|
||||
{
|
||||
_ANONYMOUS_UNION union
|
||||
{
|
||||
NT_TIB NtTib;
|
||||
_ANONYMOUS_STRUCT 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;
|
||||
PVOID KdVersionBlock;
|
||||
PVOID Unused3;
|
||||
ULONG PcrAlign1[24];
|
||||
} KPCR, *PKPCR;
|
||||
|
||||
FORCEINLINE
|
||||
PKPCR
|
||||
KeGetPcr(VOID)
|
||||
{
|
||||
return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
ULONG
|
||||
KeGetCurrentProcessorNumber(VOID)
|
||||
{
|
||||
return (ULONG)__readgsword(0x184);
|
||||
}
|
||||
|
||||
#endif /* _AMD64_ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -154,6 +154,130 @@ _KeQueryTickCount(
|
|||
}
|
||||
#define KeQueryTickCount(CurrentCount) _KeQueryTickCount(CurrentCount)
|
||||
|
||||
$endif
|
||||
$endif /* _WDMDDK_ */
|
||||
$if (_NTDDK_)
|
||||
|
||||
#define PAUSE_PROCESSOR YieldProcessor();
|
||||
|
||||
#define KERNEL_STACK_SIZE 12288
|
||||
#define KERNEL_LARGE_STACK_SIZE 61440
|
||||
#define KERNEL_LARGE_STACK_COMMIT 12288
|
||||
|
||||
#define SIZE_OF_80387_REGISTERS 80
|
||||
|
||||
#if !defined(RC_INVOKED)
|
||||
|
||||
#define CONTEXT_i386 0x10000
|
||||
#define CONTEXT_i486 0x10000
|
||||
#define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
|
||||
#define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
|
||||
#define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
|
||||
#define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
|
||||
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
|
||||
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
|
||||
|
||||
#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
|
||||
#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
|
||||
CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \
|
||||
CONTEXT_EXTENDED_REGISTERS)
|
||||
|
||||
#define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L)
|
||||
|
||||
#endif /* !defined(RC_INVOKED) */
|
||||
|
||||
typedef struct _FLOATING_SAVE_AREA {
|
||||
ULONG ControlWord;
|
||||
ULONG StatusWord;
|
||||
ULONG TagWord;
|
||||
ULONG ErrorOffset;
|
||||
ULONG ErrorSelector;
|
||||
ULONG DataOffset;
|
||||
ULONG DataSelector;
|
||||
UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
|
||||
ULONG Cr0NpxState;
|
||||
} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
|
||||
|
||||
#include "pshpack4.h"
|
||||
typedef struct _CONTEXT {
|
||||
ULONG ContextFlags;
|
||||
ULONG Dr0;
|
||||
ULONG Dr1;
|
||||
ULONG Dr2;
|
||||
ULONG Dr3;
|
||||
ULONG Dr6;
|
||||
ULONG Dr7;
|
||||
FLOATING_SAVE_AREA FloatSave;
|
||||
ULONG SegGs;
|
||||
ULONG SegFs;
|
||||
ULONG SegEs;
|
||||
ULONG SegDs;
|
||||
ULONG Edi;
|
||||
ULONG Esi;
|
||||
ULONG Ebx;
|
||||
ULONG Edx;
|
||||
ULONG Ecx;
|
||||
ULONG Eax;
|
||||
ULONG Ebp;
|
||||
ULONG Eip;
|
||||
ULONG SegCs;
|
||||
ULONG EFlags;
|
||||
ULONG Esp;
|
||||
ULONG SegSs;
|
||||
UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
|
||||
} CONTEXT;
|
||||
#include "poppack.h"
|
||||
|
||||
#define KeGetPcr() PCR
|
||||
|
||||
#define PCR_MINOR_VERSION 1
|
||||
#define PCR_MAJOR_VERSION 1
|
||||
|
||||
typedef struct _KPCR {
|
||||
union {
|
||||
NT_TIB NtTib;
|
||||
struct {
|
||||
struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
|
||||
PVOID Used_StackBase;
|
||||
PVOID Spare2;
|
||||
PVOID TssCopy;
|
||||
ULONG ContextSwitches;
|
||||
KAFFINITY SetMemberCopy;
|
||||
PVOID Used_Self;
|
||||
};
|
||||
};
|
||||
struct _KPCR *SelfPcr;
|
||||
struct _KPRCB *Prcb;
|
||||
KIRQL Irql;
|
||||
ULONG IRR;
|
||||
ULONG IrrActive;
|
||||
ULONG IDR;
|
||||
PVOID KdVersionBlock;
|
||||
struct _KIDTENTRY *IDT;
|
||||
struct _KGDTENTRY *GDT;
|
||||
struct _KTSS *TSS;
|
||||
USHORT MajorVersion;
|
||||
USHORT MinorVersion;
|
||||
KAFFINITY SetMember;
|
||||
ULONG StallScaleFactor;
|
||||
UCHAR SpareUnused;
|
||||
UCHAR Number;
|
||||
UCHAR Spare0;
|
||||
UCHAR SecondLevelCacheAssociativity;
|
||||
ULONG VdmAlert;
|
||||
ULONG KernelReserved[14];
|
||||
ULONG SecondLevelCacheSize;
|
||||
ULONG HalReserved[16];
|
||||
} KPCR, *PKPCR;
|
||||
|
||||
FORCEINLINE
|
||||
ULONG
|
||||
KeGetCurrentProcessorNumber(VOID)
|
||||
{
|
||||
return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
|
||||
}
|
||||
|
||||
$endif /* _NTDDK_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
24
include/xdk/x86/mm.h
Normal file
24
include/xdk/x86/mm.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
$if (_NTDDK_)
|
||||
|
||||
extern NTKERNELAPI PVOID MmHighestUserAddress;
|
||||
extern NTKERNELAPI PVOID MmSystemRangeStart;
|
||||
extern NTKERNELAPI ULONG MmUserProbeAddress;
|
||||
|
||||
#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
|
||||
#define MM_SYSTEM_RANGE_START MmSystemRangeStart
|
||||
#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
|
||||
#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
|
||||
extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
|
||||
#else
|
||||
#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
|
||||
#endif
|
||||
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
|
||||
#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
|
||||
#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
|
||||
#if !defined (_X86PAE_)
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
|
||||
#else
|
||||
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
|
||||
#endif
|
||||
|
||||
$endif /* _NTDDK_ */
|
Loading…
Reference in a new issue