ReactOS 0.4.15-dev-8102-g108db8f
ke.h
Go to the documentation of this file.
4/* Interrupt request levels */
5#define PASSIVE_LEVEL 0
6#define LOW_LEVEL 0
7#define APC_LEVEL 1
8#define DISPATCH_LEVEL 2
9#define CLOCK_LEVEL 13
10#define IPI_LEVEL 14
11#define DRS_LEVEL 14
12#define POWER_LEVEL 14
13#define PROFILE_LEVEL 15
14#define HIGH_LEVEL 15
15
16#define KIP0PCRADDRESS 0xFFDFF000
17#define KI_USER_SHARED_DATA 0xFFFF9000
18#define SharedUserData ((KUSER_SHARED_DATA * const)KI_USER_SHARED_DATA)
19
20#define PAGE_SIZE 0x1000
21#define PAGE_SHIFT 12L
22
23typedef struct _KFLOATING_SAVE
24{
27
29
31VOID
33 VOID)
34{
36 __yield();
37}
38
39#define MemoryBarrier() __dmb(_ARM_BARRIER_SY)
40#define PreFetchCacheLine(l,a) __prefetch((const void *) (a))
41#define PrefetchForWrite(p) __prefetch((const void *) (p))
42#define ReadForWriteAccess(p) (*(p))
43
45VOID
47 VOID)
48{
51}
52
53#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
54
61 VOID);
62
65VOID
69#define KeLowerIrql(a) KfLowerIrql(a)
70
79#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
80
88
93
100KIRQL
104#define KeAcquireSpinLock(a,b) *(b) = KfAcquireSpinLock(a)
105
110VOID
115#define KeReleaseSpinLock(a,b) KfReleaseSpinLock(a,b)
116
121VOID
125#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
126
131VOID
135#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
136
139NTAPI
141
150 _Out_ PKFLOATING_SAVE FloatSave)
151{
152 UNREFERENCED_PARAMETER(FloatSave);
153 return STATUS_SUCCESS;
154}
155
162 _In_ PKFLOATING_SAVE FloatSave)
163{
164 UNREFERENCED_PARAMETER(FloatSave);
165 return STATUS_SUCCESS;
166}
167
168VOID
170 _In_ PMDL Mdl,
171 _In_ BOOLEAN ReadOperation,
172 _In_ BOOLEAN DmaOperation);
173
174#define DbgRaiseAssertionFailure() __emit(0xdefc)
175
177VOID
179 OUT PLARGE_INTEGER CurrentCount)
180{
181 for (;;) {
182#ifdef NONAMELESSUNION
183 CurrentCount->s.HighPart = KeTickCount.High1Time;
184 CurrentCount->s.LowPart = KeTickCount.LowPart;
185 if (CurrentCount->s.HighPart == KeTickCount.High2Time) break;
186#else
187 CurrentCount->HighPart = KeTickCount.High1Time;
188 CurrentCount->LowPart = KeTickCount.LowPart;
189 if (CurrentCount->HighPart == KeTickCount.High2Time) break;
190#endif
192 }
193}
194#define KeQueryTickCount(CurrentCount) _KeQueryTickCount(CurrentCount)
195
196#define CP15_PMSELR 15, 0, 9, 12, 5 /* Event Counter Selection Register */
197#define CP15_PMXEVCNTR 15, 0, 9, 13, 2 /* Event Count Register */
198#define CP15_TPIDRURW 15, 0, 13, 0, 2 /* Software Thread ID Register, UsRW */
199#define CP15_TPIDRURO 15, 0, 13, 0, 3 /* Software Thread ID Register, UsRO */
200#define CP15_TPIDRPRW 15, 0, 13, 0, 4 /* Software Thread ID Register, Kernel */
201
203$if (_NTDDK_)
204
205#define PAUSE_PROCESSOR __yield();
206
207#define KERNEL_STACK_SIZE 0x3000
208#define KERNEL_LARGE_STACK_SIZE 0xF000
209#define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
210
211#define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
212
213#define EXCEPTION_READ_FAULT 0
214#define EXCEPTION_WRITE_FAULT 1
215#define EXCEPTION_EXECUTE_FAULT 8
216
217/* The following flags control the contents of the CONTEXT structure. */
218#define CONTEXT_ARM 0x200000L
219#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
220#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
221#define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
222#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
223#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
224
225typedef struct _NEON128
226{
230
231#define ARM_MAX_BREAKPOINTS 8
232#define ARM_MAX_WATCHPOINTS 1
233
234typedef struct _CONTEXT
235{
236 /* The flags values within this flag control the contents of
237 a CONTEXT record.
238
239 If the context record is used as an input parameter, then
240 for each portion of the context record controlled by a flag
241 whose value is set, it is assumed that that portion of the
242 context record contains valid context. If the context record
243 is being used to modify a thread's context, then only that
244 portion of the threads context will be modified.
245
246 If the context record is used as an IN OUT parameter to capture
247 the context of a thread, then only those portions of the thread's
248 context corresponding to set flags will be returned.
249
250 The context record is never used as an OUT only parameter. */
252
253 /* This section is specified/returned if the ContextFlags word contains
254 the flag CONTEXT_INTEGER. */
268
273
274 /* Floating Point/NEON Registers */
277 union
278 {
281 ULONG S[32];
283
284 /* Debug registers */
289
292
293#define PCR_MINOR_VERSION 1
294#define PCR_MAJOR_VERSION 1
295
296typedef struct _KPCR
297{
298 _ANONYMOUS_UNION union
299 {
301 _ANONYMOUS_STRUCT struct
302 {
305 struct _KPCR *Self;
306 struct _KPRCB *CurrentPrcb;
309 };
310 };
313 ULONG Unused0[3];
317 PVOID Unused1[3];
320 _ANONYMOUS_UNION union
321 {
322 USHORT SoftwareInterruptPending; // Software Interrupt Pending Flag
323 struct
324 {
325 UCHAR ApcInterrupt; // 0x01 if APC int pending
326 UCHAR DispatchInterrupt; // 0x01 if dispatch int pending
327 };
328 };
330 ULONG HalReserved[32];
333 ULONG PcrAlign1[8];
335
336#define CP15_PCR_RESERVED_MASK 0xFFF
337#define KIPCR() (((ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRPRW)) & ~CP15_PCR_RESERVED_MASK)
338
340PKPCR
342{
343 return (PKPCR)KIPCR();
344}
345
346#if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS)
348ULONG
350{
351 return (ULONG)*((PUCHAR)KIPCR() + 0x580);
352}
353#endif /* (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) */
354
unsigned char BOOLEAN
void __dmb(unsigned int Type)
@ _ARM_BARRIER_ISHST
Definition: armintr.h:36
LONG NTSTATUS
Definition: precomp.h:26
#define NTSYSAPI
Definition: ntoskrnl.h:12
#define _Acquires_lock_(lock)
#define _Requires_lock_held_(lock)
#define _Requires_lock_not_held_(lock)
#define _Releases_lock_(lock)
#define _Kernel_float_restored_
Definition: driverspecs.h:240
#define _Kernel_requires_resource_held_(kind)
Definition: driverspecs.h:245
#define _IRQL_requires_min_(irql)
Definition: driverspecs.h:231
#define _Kernel_requires_resource_not_held_(kind)
Definition: driverspecs.h:246
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define _IRQL_restores_
Definition: driverspecs.h:233
#define _Kernel_releases_resource_(kind)
Definition: driverspecs.h:244
#define _IRQL_requires_(irql)
Definition: driverspecs.h:229
#define _IRQL_saves_
Definition: driverspecs.h:235
#define _IRQL_raises_(irql)
Definition: driverspecs.h:228
#define _Kernel_acquires_resource_(kind)
Definition: driverspecs.h:247
#define _Kernel_float_saved_
Definition: driverspecs.h:241
UCHAR KIRQL
Definition: env_spec_w32.h:591
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment KeRaiseIrqlToDpcLevel
Definition: CrNtStubs.h:68
VOID FASTCALL KfLowerIrql(IN KIRQL NewIrql)
Definition: pic.c:232
KIRQL FASTCALL KfRaiseIrql(IN KIRQL NewIrql)
Definition: pic.c:187
KIRQL FASTCALL KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
Definition: spinlock.c:85
VOID FASTCALL KfReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL OldIrql)
Definition: spinlock.c:96
#define KeGetCurrentThread
Definition: hal.h:55
__INTRIN_INLINE void __yield(void)
Definition: intrin_arm.h:38
#define _ReadWriteBarrier()
Definition: intrin_arm.h:36
#define KeSaveFloatingPointState(x)
Definition: kmixer.h:32
#define KeRestoreFloatingPointState(x)
Definition: kmixer.h:33
#define _Success_(expr)
Definition: ms_sal.h:259
#define _Inout_
Definition: ms_sal.h:378
#define _Notliteral_
Definition: ms_sal.h:554
#define _Always_(annos)
Definition: ms_sal.h:270
#define _At_(target, annos)
Definition: ms_sal.h:244
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _Post_satisfies_(cond)
Definition: ms_sal.h:588
#define KeGetPcr()
Definition: ketypes.h:81
#define FASTCALL
Definition: nt_native.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define _ANONYMOUS_UNION
Definition: ntbasedef.h:30
#define _ANONYMOUS_STRUCT
Definition: ntbasedef.h:56
#define _NTDDK_
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
Definition: clock.c:19
#define NTHALAPI
Definition: ntoskrnl.h:40
VOID FASTCALL KefReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:265
VOID FASTCALL KefAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:243
unsigned short USHORT
Definition: pedump.c:61
#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
Definition: ke.h:174
#define YieldProcessor
Definition: ke.h:48
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:341
KFLOATING_SAVE
Definition: ke.h:33
FORCEINLINE KIRQL KeRaiseIrqlToSynchLevel(VOID)
Definition: ke.h:117
$if(_WDMDDK_) typedef struct _KFLOATING_SAVE
Definition: ke.h:1
struct _KPCR KPCR
#define HIGH_LEVEL
FORCEINLINE VOID KeMemoryBarrier(VOID)
Definition: ke.h:58
* PKFLOATING_SAVE
Definition: ke.h:33
struct _KPCR * PKPCR
CONTEXT
Definition: ke.h:288
NEON128 NEON128
Definition: ke.h:56
#define KIPCR()
Definition: ke.h:337
$endif(_WDMDDK_) $if(_NTDDK_) typedef struct _NEON128
Definition: ke.h:202
FORCEINLINE VOID _KeQueryTickCount(OUT PLARGE_INTEGER CurrentCount)
Definition: ke.h:178
#define ARM_MAX_WATCHPOINTS
Definition: ke.h:232
NEON128
Definition: ke.h:229
#define ARM_MAX_BREAKPOINTS
Definition: ke.h:231
* PNEON128
Definition: ke.h:229
#define MemoryBarrier()
Definition: ke.h:39
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114
#define STATUS_SUCCESS
Definition: shellext.h:65
@ High
Definition: strmini.h:378
@ Low
Definition: strmini.h:380
Definition: movable.cpp:9
ULONG Lr
Definition: ke.h:270
ULONG Padding
Definition: ke.h:276
ULONG Wcr[ARM_MAX_WATCHPOINTS]
Definition: ke.h:288
ULONG R5
Definition: ke.h:260
ULONG Cpsr
Definition: ke.h:272
ULONG R2
Definition: ke.h:257
ULONG R7
Definition: ke.h:262
ULONG Wvr[ARM_MAX_WATCHPOINTS]
Definition: ke.h:287
ULONG R6
Definition: ke.h:261
union _CONTEXT::@3931 DUMMYUNIONNAME
ULONG ContextFlags
Definition: nt_native.h:1426
ULONG Bcr[ARM_MAX_BREAKPOINTS]
Definition: ke.h:286
ULONG R3
Definition: ke.h:258
ULONG R8
Definition: ke.h:263
ULONG R1
Definition: ke.h:256
ULONG R0
Definition: ke.h:255
ULONG R4
Definition: ke.h:259
ULONGLONG D[32]
Definition: ke.h:280
ULONG Sp
Definition: ke.h:269
ULONG Padding2[2]
Definition: ke.h:290
ULONG R12
Definition: ke.h:267
ULONG Pc
Definition: ke.h:271
ULONG R9
Definition: ke.h:264
NEON128 Q[16]
Definition: ke.h:279
ULONG Bvr[ARM_MAX_BREAKPOINTS]
Definition: ke.h:285
ULONG Fpscr
Definition: ke.h:275
ULONG R10
Definition: ke.h:265
ULONG R11
Definition: ke.h:266
Definition: ke.h:294
UCHAR DispatchInterrupt
Definition: ke.h:326
ULONG StallScaleFactor
Definition: ke.h:318
UCHAR ApcInterrupt
Definition: ke.h:325
struct _KPRCB * CurrentPrcb
Definition: ke.h:304
PVOID Used_Self
Definition: ke.h:306
USHORT MinorVersion
Definition: ke.h:317
PVOID Unused1[3]
Definition: ke.h:319
UCHAR SecondLevelCacheAssociativity
Definition: ke.h:312
ULONG SecondLevelCacheSize
Definition: ke.h:321
ULONG PcrAlign1[24]
Definition: ke.h:326
ULONG KernelReserved[15]
Definition: ke.h:320
PVOID Spare1
Definition: ke.h:304
USHORT SoftwareInterruptPending
Definition: ke.h:322
PVOID KdVersionBlock
Definition: ke.h:324
NT_TIB NtTib
Definition: ke.h:297
PVOID Unused3
Definition: ke.h:325
USHORT MajorVersion
Definition: ke.h:316
USHORT InterruptPad
Definition: ke.h:329
ULONG TibPad0[2]
Definition: ke.h:303
struct _KPCR * Self
Definition: ke.h:303
KIRQL CurrentIrql
Definition: ke.h:311
PKSPIN_LOCK_QUEUE LockArray
Definition: ke.h:305
ULONG Unused0[3]
Definition: ke.h:315
ULONG HalReserved[16]
Definition: ke.h:322
LONG High1Time
Definition: ketypes.h:930
LONG High2Time
Definition: ketypes.h:931
ULONG LowPart
Definition: ketypes.h:929
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
#define FORCEINLINE
Definition: wdftypes.h:67
#define _WDMDDK_
Definition: wdm.template.h:26
#define NTKERNELAPI
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
unsigned char UCHAR
Definition: xmlstorage.h:181