Fix amd64 definitions of SYNCH_LEVEL, DISPATCH_LENGTH, KINTERRUPT, KTHREAD, KPROCESS, EPROCESS
- add MM_SHARED_USER_DATA_VA
- Add PsGetProcessSessionId prototype
- Remove duplicated RtlWow64Get/SetThreadContext prototypes

svn path=/trunk/; revision=55418
This commit is contained in:
Timo Kreuzer 2012-02-04 21:16:52 +00:00
parent 5a51670178
commit eb594c7610
8 changed files with 117 additions and 57 deletions

View file

@ -1033,7 +1033,11 @@ typedef struct _KWAIT_BLOCK {
struct _KWAIT_BLOCK *NextWaitBlock;
USHORT WaitKey;
UCHAR WaitType;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
volatile UCHAR BlockState;
#else
UCHAR SpareByte;
#endif
#if defined(_WIN64)
LONG SpareLong;
#endif
@ -1875,7 +1879,7 @@ FORCEINLINE
VOID
KeLowerIrql(IN KIRQL NewIrql)
{
//ASSERT(KeGetCurrentIrql() >= NewIrql);
ASSERT((KIRQL)__readcr8() >= NewIrql);
__writecr8(NewIrql);
}
@ -1886,7 +1890,7 @@ KfRaiseIrql(IN KIRQL NewIrql)
KIRQL OldIrql;
OldIrql = (KIRQL)__readcr8();
//ASSERT(OldIrql <= NewIrql);
ASSERT(OldIrql <= NewIrql);
__writecr8(NewIrql);
return OldIrql;
}

View file

@ -184,11 +184,7 @@ Author:
//
// Synchronization-level IRQL
//
#ifndef CONFIG_SMP
#define SYNCH_LEVEL DISPATCH_LEVEL
#else
#define SYNCH_LEVEL (IPI_LEVEL - 2)
#endif
#define SYNCH_LEVEL 12
#define NMI_STACK_SIZE 0x2000

View file

@ -33,6 +33,11 @@ Author:
#define MM_ALLOCATION_GRANULARITY 0x10000
#define MM_ALLOCATION_GRANULARITY_SHIFT 16L
//
// Address of the shared user page
//
#define MM_SHARED_USER_DATA_VA 0x7FFE0000ULL
//
// Sanity checks for Paging Macros
//

View file

@ -112,7 +112,9 @@ Author:
//
// Number of dispatch codes supported by KINTERRUPT
//
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
#ifdef _M_AMD64
#define DISPATCH_LENGTH 4
#elif (NTDDI_VERSION >= NTDDI_LONGHORN)
#define DISPATCH_LENGTH 135
#else
#define DISPATCH_LENGTH 106
@ -647,6 +649,10 @@ typedef struct _KINTERRUPT
ULONG DispatchCount;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
ULONGLONG Rsvd1;
#endif
#ifdef _M_AMD64
PKTRAP_FRAME TrapFrame;
PVOID Reserved;
#endif
ULONG DispatchCode[DISPATCH_LENGTH];
} KINTERRUPT;
@ -690,7 +696,7 @@ typedef struct _KTHREAD
LIST_ENTRY MutantListHead;
#endif
PVOID InitialStack;
ULONG_PTR StackLimit;
ULONG_PTR StackLimit; // FIXME: PVOID
PVOID KernelStack;
KSPIN_LOCK ThreadLock;
union
@ -698,7 +704,11 @@ typedef struct _KTHREAD
KAPC_STATE ApcState;
struct
{
#ifdef _M_AMD64
UCHAR ApcStateFill[43]; // 23 / 43
#else
UCHAR ApcStateFill[23];
#endif
UCHAR ApcQueueable;
volatile UCHAR NextProcessor;
volatile UCHAR DeferredProcessor;
@ -707,11 +717,13 @@ typedef struct _KTHREAD
};
};
KSPIN_LOCK ApcQueueLock;
#ifndef _M_AMD64
ULONG ContextSwitches;
volatile UCHAR State;
UCHAR NpxState;
KIRQL WaitIrql;
KPROCESSOR_MODE WaitMode;
#endif
LONG_PTR WaitStatus;
union
{
@ -749,6 +761,7 @@ typedef struct _KTHREAD
SINGLE_LIST_ENTRY SwapListEntry;
};
PKQUEUE Queue;
#ifndef _M_AMD64
ULONG WaitTime;
union
{
@ -759,13 +772,14 @@ typedef struct _KTHREAD
};
ULONG CombinedApcDisable;
};
#endif
struct _TEB *Teb;
union
{
KTIMER Timer;
struct
{
UCHAR TimerFill[40];
UCHAR TimerFill[FIELD_OFFSET(KTIMER, Period) + sizeof(LONG)]; // 40 / 60
union
{
struct
@ -790,7 +804,7 @@ typedef struct _KTHREAD
KWAIT_BLOCK WaitBlock[THREAD_WAIT_OBJECTS + 1];
struct
{
UCHAR WaitBlockFill0[23];
UCHAR WaitBlockFill0[FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 32bit = 23, 64bit = 43
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
UCHAR IdealProcessor;
#else
@ -799,19 +813,52 @@ typedef struct _KTHREAD
};
struct
{
UCHAR WaitBlockFill1[47];
UCHAR WaitBlockFill1[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 47 / 91
CCHAR PreviousMode;
};
struct
{
UCHAR WaitBlockFill2[71];
UCHAR WaitBlockFill2[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 71 / 139
UCHAR ResourceIndex;
};
struct
{
UCHAR WaitBlockFill3[95];
UCHAR WaitBlockFill3[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 95 / 187
UCHAR LargeStack;
};
#ifdef _M_AMD64
struct
{
UCHAR WaitBlockFill4[FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
ULONG ContextSwitches;
};
struct
{
UCHAR WaitBlockFill5[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
UCHAR State;
UCHAR NpxState;
UCHAR WaitIrql;
CHAR WaitMode;
};
struct
{
UCHAR WaitBlockFill6[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
ULONG WaitTime;
};
struct
{
UCHAR WaitBlockFill7[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
union
{
struct
{
SHORT KernelApcDisable;
SHORT SpecialApcDisable;
};
ULONG CombinedApcDisable;
};
};
#endif
};
LIST_ENTRY QueueListEntry;
PKTRAP_FRAME TrapFrame;
@ -820,6 +867,9 @@ typedef struct _KTHREAD
#endif
PVOID CallbackStack;
PVOID ServiceTable;
#ifdef _M_AMD64
ULONG KernelLimit;
#endif
UCHAR ApcStateIndex;
#if (NTDDI_VERSION < NTDDI_LONGHORN)
UCHAR IdealProcessor;
@ -829,6 +879,10 @@ typedef struct _KTHREAD
BOOLEAN CalloutActive;
#else
BOOLEAN ProcessReadyQueue;
#ifdef _M_AMD64
PVOID Win32kTable;
ULONG Win32kLimit;
#endif
BOOLEAN KernelStackResident;
#endif
SCHAR BasePriority;
@ -847,7 +901,7 @@ typedef struct _KTHREAD
KAPC_STATE SavedApcState;
struct
{
UCHAR SavedApcStateFill[23];
UCHAR SavedApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1]; // 23 / 43
CCHAR FreezeCount;
CCHAR SuspendCount;
UCHAR UserIdealProcessor;
@ -890,7 +944,7 @@ typedef struct _KTHREAD
};
struct
{
UCHAR SuspendApcFill3[36];
UCHAR SuspendApcFill3[FIELD_OFFSET(KAPC, SystemArgument1)];
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
PKPRCB WaitPrcb;
#else
@ -899,12 +953,12 @@ typedef struct _KTHREAD
};
struct
{
UCHAR SuspendApcFill4[40];
UCHAR SuspendApcFill4[FIELD_OFFSET(KAPC, SystemArgument2)]; // 40 / 72
PVOID LegoData;
};
struct
{
UCHAR SuspendApcFill5[47];
UCHAR SuspendApcFill5[FIELD_OFFSET(KAPC, Inserted) + 1]; // 47 / 83
UCHAR PowerState;
ULONG UserTime;
};
@ -914,7 +968,7 @@ typedef struct _KTHREAD
KSEMAPHORE SuspendSemaphore;
struct
{
UCHAR SuspendSemaphorefill[20];
UCHAR SuspendSemaphorefill[FIELD_OFFSET(KSEMAPHORE, Limit) + 4]; // 20 / 28
ULONG SListFaultCount;
};
};
@ -926,6 +980,14 @@ typedef struct _KTHREAD
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
PVOID MdlForLockedteb;
#endif
#ifdef _M_AMD64
LONG64 ReadOperationCount;
LONG64 WriteOperationCount;
LONG64 OtherOperationCount;
LONG64 ReadTransferCount;
LONG64 WriteTransferCount;
LONG64 OtherTransferCount;
#endif
} KTHREAD;
#define ASSERT_THREAD(object) \
@ -947,7 +1009,9 @@ typedef struct _KPROCESS
#if defined(_M_IX86)
KGDTENTRY LdtDescriptor;
KIDTENTRY Int21Descriptor;
#endif
USHORT IopmOffset;
#if defined(_M_IX86)
UCHAR Iopl;
UCHAR Unused;
#endif

View file

@ -192,6 +192,12 @@ PsGetProcessExitStatus(
PEPROCESS Process
);
HANDLE
NTAPI
PsGetProcessSessionId(
IN PEPROCESS Process
);
NTKERNELAPI
BOOLEAN
NTAPI

View file

@ -1056,11 +1056,11 @@ typedef struct _EPROCESS
EX_RUNDOWN_REF RundownProtect;
HANDLE UniqueProcessId;
LIST_ENTRY ActiveProcessLinks;
ULONG QuotaUsage[3]; /* 0=PagedPool, 1=NonPagedPool, 2=Pagefile */
ULONG QuotaPeak[3]; /* ditto */
ULONG CommitCharge;
ULONG PeakVirtualSize;
ULONG VirtualSize;
SIZE_T QuotaUsage[3]; /* 0=PagedPool, 1=NonPagedPool, 2=Pagefile */
SIZE_T QuotaPeak[3]; /* ditto */
SIZE_T CommitCharge;
SIZE_T PeakVirtualSize;
SIZE_T VirtualSize;
LIST_ENTRY SessionProcessLinks;
PVOID DebugPort;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
@ -1075,7 +1075,7 @@ typedef struct _EPROCESS
#endif
PHANDLE_TABLE ObjectTable;
EX_FAST_REF Token;
ULONG WorkingSetPage;
PFN_NUMBER WorkingSetPage;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
EX_PUSH_LOCK AddressCreationLock;
PETHREAD RotateInProgress;
@ -1084,11 +1084,11 @@ typedef struct _EPROCESS
KSPIN_LOCK HyperSpaceLock;
#endif
PETHREAD ForkInProgress;
ULONG HardwareTrigger;
ULONG_PTR HardwareTrigger;
PMM_AVL_TABLE PhysicalVadRoot;
PVOID CloneRoot;
ULONG NumberOfPrivatePages;
ULONG NumberOfLockedPages;
PFN_NUMBER NumberOfPrivatePages;
PFN_NUMBER NumberOfLockedPages;
PVOID *Win32Process;
struct _EJOB *Job;
PVOID SectionObject;
@ -1112,7 +1112,7 @@ typedef struct _EPROCESS
HARDWARE_PTE PageDirectoryPte;
ULONGLONG Filler;
};
ULONG Session;
ULONG Session; // FIXME: PVOID
CHAR ImageFileName[16];
LIST_ENTRY JobLinks;
PVOID LockedPagesList;
@ -1135,12 +1135,16 @@ typedef struct _EPROCESS
LARGE_INTEGER ReadTransferCount;
LARGE_INTEGER WriteTransferCount;
LARGE_INTEGER OtherTransferCount;
ULONG CommitChargeLimit;
ULONG CommitChargePeak;
SIZE_T CommitChargeLimit;
SIZE_T CommitChargePeak;
PVOID AweInfo;
SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;
MMSUPPORT Vm;
#ifdef _M_AMD64
ULONG Spares[2];
#else
LIST_ENTRY MmProcessLinks;
#endif
ULONG ModifiedPageCount;
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
union

View file

@ -2090,25 +2090,6 @@ RtlPrefixString(
BOOLEAN CaseInsensitive
);
#ifdef _M_X64
NTSYSAPI
NTSTATUS
NTAPI
RtlWow64GetThreadContext(
IN HANDLE ThreadHandle,
IN OUT PWOW64_CONTEXT ThreadContext
);
NTSYSAPI
NTSTATUS
NTAPI
RtlWow64SetThreadContext(
IN HANDLE ThreadHandle,
IN PWOW64_CONTEXT ThreadContext
);
#endif
NTSYSAPI
BOOLEAN
NTAPI

View file

@ -1,6 +1,6 @@
..\..\output-i386\tools\hpp\hpp.exe wdm.template.h wdm.h
..\..\output-i386\tools\hpp\hpp.exe ntddk.template.h ntddk.h
..\..\output-i386\tools\hpp\hpp.exe ntifs.template.h ntifs.h
..\..\output-i386\tools\hpp\hpp.exe devioctl.template.h devioctl.h
hpp.exe wdm.template.h wdm.h
hpp.exe ntddk.template.h ntddk.h
hpp.exe ntifs.template.h ntifs.h
hpp.exe devioctl.template.h devioctl.h