[ARMDDK]: Use the same KPCR structure on ARM as on x86.

[ARMDDK]: Use the same addresses for KPCR and KUSER_SHARED_DATA on ARM as on x86. On ARM however, since there are no "segments", the KPCR is also mapped in user-mode, read-only, to have a static structure that can point to the current TEB.

svn path=/trunk/; revision=45511
This commit is contained in:
Sir Richard 2010-02-09 02:08:24 +00:00
parent 4deb6d8bf4
commit ba3bc4340e

View file

@ -28,10 +28,10 @@
// //
// FIXME: mmtypes.h? // FIXME: mmtypes.h?
// //
#define KIPCR 0xFFFFF000 #define KIP0PCRADDRESS 0xFFDFF000
#define KI_USER_SHARED_DATA 0xFFFFE000 #define KI_USER_SHARED_DATA 0xFFDF0000
#define USPCR 0x7FFF0000 #define USPCR 0x7FFF0000
#define PCR ((volatile KPCR * const)KIPCR) #define PCR ((KPCR * const)KIP0PCRADDRESS)
#define USERPCR ((volatile KPCR * const)USPCR) #define USERPCR ((volatile KPCR * const)USPCR)
#define KeGetPcr() PCR #define KeGetPcr() PCR
#ifndef _WINNT_H #ifndef _WINNT_H
@ -47,25 +47,13 @@ extern ULONG_PTR MmUserProbeAddress;
#define MM_SYSTEM_RANGE_START MmSystemRangeStart #define MM_SYSTEM_RANGE_START MmSystemRangeStart
#define MM_USER_PROBE_ADDRESS MmUserProbeAddress #define MM_USER_PROBE_ADDRESS MmUserProbeAddress
#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC1400000 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
// //
// Maximum IRQs // Maximum IRQs
// //
#define MAXIMUM_VECTOR 16 #define MAXIMUM_VECTOR 16
//
// Just read it from the PCR
//
#define KeGetCurrentProcessorNumber() (int)PCR->Number
#define KeGetCurrentIrql() PCR->CurrentIrql
#define _KeGetCurrentThread() PCR->CurrentThread
#define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
#define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
#define KeGetCurrentThread() _KeGetCurrentThread()
#define KeGetPreviousMode() _KeGetPreviousMode()
#define KeGetDcacheFillSize() PCR->DcacheFillSize
// //
// Used to contain PFNs and PFN counts // Used to contain PFNs and PFN counts
@ -132,7 +120,6 @@ typedef struct _CONTEXT {
// //
// Processor Control Region // Processor Control Region
// On ARM, it's actually readable from user-mode, much like KUSER_SHARED_DATA
// //
#ifdef _WINNT_H #ifdef _WINNT_H
typedef typedef
@ -141,60 +128,36 @@ VOID
#endif #endif
typedef struct _KPCR typedef struct _KPCR
{ {
ULONG MinorVersion; union
ULONG MajorVersion; {
PKINTERRUPT_ROUTINE InterruptRoutine[32]; NT_TIB NtTib;
PVOID XcodeDispatch; struct
ULONG FirstLevelDcacheSize; {
ULONG FirstLevelDcacheFillSize; struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList; // Unused
ULONG FirstLevelIcacheSize; PVOID Used_StackBase; // Unused
ULONG FirstLevelIcacheFillSize; PVOID PerfGlobalGroupMask;
ULONG SecondLevelDcacheSize; PVOID TssCopy; // Unused
ULONG SecondLevelDcacheFillSize; ULONG ContextSwitches;
ULONG SecondLevelIcacheSize; KAFFINITY SetMemberCopy; // Unused
ULONG SecondLevelIcacheFillSize; PVOID Used_Self;
};
};
struct _KPCR *Self;
struct _KPRCB *Prcb; struct _KPRCB *Prcb;
struct _TEB *Teb; KIRQL Irql;
PVOID TlsArray; ULONG IRR; // Unused
ULONG DcacheFillSize; ULONG IrrActive; // Unused
ULONG IcacheAlignment; ULONG IDR; // Unused
ULONG IcacheFillSize; PVOID KdVersionBlock;
ULONG ProcessorId; PVOID IDT; // Unused
ULONG ProfileInterval; PVOID GDT; // Unused
ULONG ProfileCount; PVOID TSS; // Unused
ULONG StallExecutionCount; USHORT MajorVersion;
ULONG StallScaleFactor; USHORT MinorVersion;
CCHAR Number;
PVOID DataBusError;
PVOID InstructionBusError;
ULONG CachePolicy;
ULONG AlignedCachePolicy;
UCHAR IrqlMask[32];
ULONG IrqlTable[32];
UCHAR CurrentIrql;
KAFFINITY SetMember; KAFFINITY SetMember;
struct _KTHREAD *CurrentThread; ULONG StallScaleFactor;
ULONG ReservedVectors; UCHAR SpareUnused;
KAFFINITY NotMember; UCHAR Number;
ULONG SystemReserved[6];
ULONG DcacheAlignment;
ULONG HalReserved[64];
BOOLEAN FirstLevelActive;
BOOLEAN DpcRoutineActive;
ULONG CurrentPid;
BOOLEAN OnInterruptStack;
PVOID SavedInitialStack;
PVOID SavedStackLimit;
PVOID SystemServiceDispatchStart;
PVOID SystemServiceDispatchEnd;
PVOID InterruptStack;
PVOID PanicStack;
PVOID BadVaddr;
PVOID InitialStack;
PVOID StackLimit;
ULONG QuantumEnd;
PVOID PerfGlobalGroupMask;
ULONG ContextSwitches;
} KPCR, *PKPCR; } KPCR, *PKPCR;
// //
@ -203,7 +166,7 @@ typedef struct _KPCR
FORCEINLINE FORCEINLINE
struct _TEB* NtCurrentTeb(VOID) struct _TEB* NtCurrentTeb(VOID)
{ {
return (struct _TEB*)USERPCR->Teb; return (struct _TEB*)USERPCR->Used_Self;
} }
#ifndef _WINNT_H #ifndef _WINNT_H