7 #define PASSIVE_LEVEL 0
10 #define DISPATCH_LEVEL 2
11 #define SYNCH_LEVEL DISPATCH_LEVEL
12 #define PROFILE_LEVEL 27
13 #define CLOCK1_LEVEL 28
14 #define CLOCK2_LEVEL 28
16 #define POWER_LEVEL 30
22 #define KIPCR 0xFFFFF000
23 #define KI_USER_SHARED_DATA 0xFFFFE000
24 #define USPCR 0x7FFF0000
25 #define PCR ((volatile KPCR * const)KIPCR)
26 #define USERPCR ((volatile KPCR * const)USPCR)
31 #define MAXIMUM_VECTOR 16
34 // Just read it from the PCR
36 #define KeGetCurrentProcessorNumber() (int)PCR->Number
37 #define KeGetCurrentIrql() PCR->CurrentIrql
38 #define _KeGetCurrentThread() PCR->CurrentThread
39 #define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
40 #define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
41 #define KeGetCurrentThread() _KeGetCurrentThread()
42 #define KeGetPreviousMode() _KeGetPreviousMode()
43 #define KeGetDcacheFillSize() PCR->DcacheFillSize
47 // Types to use to contain PFNs and their counts.
49 typedef ULONG PFN_COUNT
;
50 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
51 typedef LONG SPFN_NUMBER
, *PSPFN_NUMBER
;
56 typedef struct _KFLOATING_SAVE
59 } KFLOATING_SAVE
, *PKFLOATING_SAVE
;
61 /* The following flags control the contents of the CONTEXT structure. */
62 #define CONTEXT_ARM 0x0000040
63 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
64 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
65 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
67 typedef struct _CONTEXT
{
68 /* The flags values within this flag control the contents of
71 If the context record is used as an input parameter, then
72 for each portion of the context record controlled by a flag
73 whose value is set, it is assumed that that portion of the
74 context record contains valid context. If the context record
75 is being used to modify a thread's context, then only that
76 portion of the threads context will be modified.
78 If the context record is used as an IN OUT parameter to capture
79 the context of a thread, then only those portions of the thread's
80 context corresponding to set flags will be returned.
82 The context record is never used as an OUT only parameter. */
86 /* This section is specified/returned if the ContextFlags word contains
87 the flag CONTEXT_INTEGER. */
109 // Processor Control Region
110 // On ARM, it's actually readable from user-mode, much like KUSER_SHARED_DATA
115 (*PKINTERRUPT_ROUTINE
)(VOID
);
121 PKINTERRUPT_ROUTINE InterruptRoutine
[MAXIMUM_VECTOR
];
123 ULONG FirstLevelDcacheSize
;
124 ULONG FirstLevelDcacheFillSize
;
125 ULONG FirstLevelIcacheSize
;
126 ULONG FirstLevelIcacheFillSize
;
127 ULONG SecondLevelDcacheSize
;
128 ULONG SecondLevelDcacheFillSize
;
129 ULONG SecondLevelIcacheSize
;
130 ULONG SecondLevelIcacheFillSize
;
134 ULONG DcacheFillSize
;
135 ULONG IcacheAlignment
;
136 ULONG IcacheFillSize
;
138 ULONG ProfileInterval
;
140 ULONG StallExecutionCount
;
141 ULONG StallScaleFactor
;
144 PVOID InstructionBusError
;
146 ULONG AlignedCachePolicy
;
147 UCHAR IrqlMask
[HIGH_LEVEL
+ 1];
148 ULONG IrqlTable
[HIGH_LEVEL
+ 1];
151 struct _KTHREAD
*CurrentThread
;
152 ULONG ReservedVectors
;
154 ULONG SystemReserved
[6];
155 ULONG DcacheAlignment
;
156 ULONG HalReserved
[64];
157 BOOLEAN FirstLevelActive
;
158 BOOLEAN DpcRoutineActive
;
160 BOOLEAN OnInterruptStack
;
161 PVOID SavedInitialStack
;
162 PVOID SavedStackLimit
;
163 PVOID SystemServiceDispatchStart
;
164 PVOID SystemServiceDispatchEnd
;
165 PVOID InterruptStack
;
171 PVOID PerfGlobalGroupMask
;
172 ULONG ContextSwitches
;
176 // Get the current TEB
179 struct _TEB
* NtCurrentTeb(VOID
)
181 return (struct _TEB
*)USERPCR
->Teb
;
185 // IRQL Support on ARM is similar to MIPS/ALPHA
198 KeRaiseIrqlToSynchLevel(
203 KeRaiseIrqlToDpcLevel(
207 #define KeLowerIrql(NewIrql) KfLowerIrql(NewIrql)
208 #define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KfRaiseIrql(NewIrql)
211 // Cache clean and flush