8 #define PAGE_SIZE 0x1000
15 #define PASSIVE_LEVEL 0
18 #define DISPATCH_LEVEL 2
19 #define SYNCH_LEVEL DISPATCH_LEVEL
20 #define PROFILE_LEVEL 27
21 #define CLOCK1_LEVEL 28
22 #define CLOCK2_LEVEL 28
24 #define POWER_LEVEL 30
31 #define KIP0PCRADDRESS 0xFFDFF000
32 #define KI_USER_SHARED_DATA 0xFFDF0000
33 #define USPCR 0x7FFF0000
34 #define PCR ((KPCR * const)KIP0PCRADDRESS)
35 #define USERPCR ((volatile KPCR * const)USPCR)
36 #define KeGetPcr() PCR
38 #define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
41 // Address space layout
43 extern PVOID MmHighestUserAddress
;
44 extern PVOID MmSystemRangeStart
;
45 extern ULONG_PTR MmUserProbeAddress
;
46 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
47 #define MM_SYSTEM_RANGE_START MmSystemRangeStart
48 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress
49 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
50 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
55 #define MAXIMUM_VECTOR 16
57 #define KERNEL_STACK_SIZE 12288
58 #define KERNEL_LARGE_STACK_SIZE 61440
59 #define KERNEL_LARGE_STACK_COMMIT 12288
62 // Used to contain PFNs and PFN counts
64 //typedef ULONG PFN_COUNT;
65 //typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
66 //typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
71 typedef struct _KFLOATING_SAVE
74 } KFLOATING_SAVE
, *PKFLOATING_SAVE
;
76 /* The following flags control the contents of the CONTEXT structure. */
77 #define CONTEXT_ARM 0x0000040
78 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
79 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
80 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
82 typedef struct _CONTEXT
{
83 /* The flags values within this flag control the contents of
86 If the context record is used as an input parameter, then
87 for each portion of the context record controlled by a flag
88 whose value is set, it is assumed that that portion of the
89 context record contains valid context. If the context record
90 is being used to modify a thread's context, then only that
91 portion of the threads context will be modified.
93 If the context record is used as an IN OUT parameter to capture
94 the context of a thread, then only those portions of the thread's
95 context corresponding to set flags will be returned.
97 The context record is never used as an OUT only parameter. */
101 /* This section is specified/returned if the ContextFlags word contains
102 the flag CONTEXT_INTEGER. */
125 // Processor Control Region
131 typedef struct _NT_TIB_KPCR
{
132 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
136 _ANONYMOUS_UNION
union {
140 PVOID ArbitraryUserPointer
;
141 struct _NT_TIB_KPCR
*Self
;
142 } NT_TIB_KPCR
,*PNT_TIB_KPCR
;
151 struct _EXCEPTION_REGISTRATION_RECORD
*Used_ExceptionList
; // Unused
152 PVOID Used_StackBase
; // Unused
153 PVOID PerfGlobalGroupMask
;
154 PVOID TssCopy
; // Unused
155 ULONG ContextSwitches
;
156 KAFFINITY SetMemberCopy
; // Unused
164 ULONG IrrActive
; // Unused
166 PVOID KdVersionBlock
;
173 ULONG StallScaleFactor
;
179 // Get the current TEB
182 struct _TEB
* NtCurrentTeb(VOID
)
184 return (struct _TEB
*)USERPCR
->Used_Self
;
190 KeGetCurrentThread(VOID
);
194 // IRQL Support on ARM is similar to MIPS/ALPHA
207 KeRaiseIrqlToSynchLevel(
212 KeRaiseIrqlToDpcLevel(
216 #define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql)
217 #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql)
220 // Cache clean and flush
236 #define InterlockedDecrement _InterlockedDecrement
237 #define InterlockedIncrement _InterlockedIncrement
238 #define InterlockedExchange _InterlockedExchange