ReactOS 0.4.15-dev-7958-gcd0bb1a
ke.h
Go to the documentation of this file.
1#pragma once
2
3#include "intrin_i.h"
4
5#define KiServiceExit2 KiExceptionExit
6
7#define SYNCH_LEVEL DISPATCH_LEVEL
8#define PCR ((KPCR * const)KIP0PCRADDRESS)
9
10//
11//Lockdown TLB entries
12//
13#define PCR_ENTRY 0
14#define PDR_ENTRY 2
15
16//
17// BKPT is 4 bytes long
18//
19#define KD_BREAKPOINT_TYPE ULONG
20#define KD_BREAKPOINT_SIZE sizeof(ULONG)
21#define KD_BREAKPOINT_VALUE 0xDEFE
22
23//
24// Maximum IRQs
25//
26#define MAXIMUM_VECTOR 16
27
28//
29// Macros for getting and setting special purpose registers in portable code
30//
31#define KeGetContextPc(Context) \
32 ((Context)->Pc)
33
34#define KeSetContextPc(Context, ProgramCounter) \
35 ((Context)->Pc = (ProgramCounter))
36
37#define KeGetTrapFramePc(TrapFrame) \
38 ((TrapFrame)->Pc)
39
40#define KeGetContextReturnRegister(Context) \
41 ((Context)->R0)
42
43#define KeSetContextReturnRegister(Context, ReturnValue) \
44 ((Context)->R0 = (ReturnValue))
45
46//
47// Macro to get trap and exception frame from a thread stack
48//
49#define KeGetTrapFrame(Thread) \
50 (PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
51 sizeof(KTRAP_FRAME))
52
53#define KeGetExceptionFrame(Thread) \
54 (PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \
55 sizeof(KEXCEPTION_FRAME))
56
57//
58// Macro to get context switches from the PRCB
59// All architectures but x86 have it in the PRCB's KeContextSwitches
60//
61#define KeGetContextSwitches(Prcb) \
62 (Prcb)->KeContextSwitches
63
64//
65// Macro to get the second level cache size field name which differs between
66// CISC and RISC architectures, as the former has unified I/D cache
67//
68#define KiGetSecondLevelDCacheSize() ((PKIPCR)KeGetPcr())->SecondLevelDcacheSize
69
70//
71// Returns the Interrupt State from a Trap Frame.
72// ON = TRUE, OFF = FALSE
73//
74#define KeGetTrapFrameInterruptState(TrapFrame) 0
75
79{
81
82 //
83 // Get current interrupt state and disable interrupts
84 //
86 _disable();
87
88 //
89 // Return previous interrupt state
90 //
91 return Flags.IrqDisable;
92}
93
95VOID
97{
98 if (WereEnabled) _enable();
99}
100
101//
102// Invalidates the TLB entry for a specified address
103//
105VOID
107{
108 /* Invalidate the TLB entry for this address */
110}
111
113VOID
115{
117}
118
120VOID
122 IN SIZE_T FlushSize)
123{
124 //
125 // Always sweep the whole cache
126 //
128 UNREFERENCED_PARAMETER(FlushSize);
129 _MoveToCoprocessor(0, CP15_ICIALLU);
130}
131
133VOID
135{
136 /* FIXME */
137}
138
139VOID
141 VOID
142);
143
144VOID
146 IN PKTRAP_FRAME TrapFrame,
148
149VOID
151 VOID
152);
153
154#include "mm.h"
155
156VOID
158 VOID
159);
160
161//
162// Cache clean and flush
163//
164VOID
166 VOID
167);
168
169VOID
171 VOID
172);
173
174#define Ki386PerfEnd()
175#define KiEndInterrupt(x,y)
176
177#define KiGetLinkedTrapFrame(x) \
178 (PKTRAP_FRAME)((x)->TrapFrame)
179
180#define KiGetPreviousMode(tf) \
181 ((tf->Cpsr & CPSRM_MASK) == CPSRM_USER) ? UserMode: KernelMode
unsigned char BOOLEAN
FORCEINLINE VOID KeArmInvalidateTlbEntry(IN PVOID Address)
Definition: intrin_i.h:185
FORCEINLINE ARM_STATUS_REGISTER KeArmStatusRegisterGet(VOID)
Definition: intrin_i.h:122
FORCEINLINE VOID KeArmFlushTlb(VOID)
Definition: intrin_i.h:175
@ Instruction
Definition: asmpp.cpp:82
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
void __cdecl _disable(void)
Definition: intrin_arm.h:365
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define CP15_ICIALLU
Definition: ketypes.h:80
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
FORCEINLINE VOID KeInvalidateTlbEntry(IN PVOID Address)
Definition: ke.h:264
FORCEINLINE VOID KeFlushProcessTb(VOID)
Definition: ke.h:272
FORCEINLINE BOOLEAN KeDisableInterrupts(VOID)
Definition: ke.h:239
VOID KiApcInterrupt(VOID)
Definition: trapc.c:229
FORCEINLINE VOID KeRestoreInterrupts(BOOLEAN WereEnabled)
Definition: ke.h:254
FORCEINLINE VOID KiRundownThread(IN PKTHREAD Thread)
Definition: ke.h:293
FORCEINLINE VOID KeSweepICache(IN PVOID BaseAddress, IN SIZE_T FlushSize)
Definition: ke.h:280
VOID KeFlushTb(VOID)
Definition: cpu.c:36
VOID HalSweepDcache(VOID)
Definition: processor.c:107
VOID HalSweepIcache(VOID)
Definition: processor.c:135
VOID KiSystemService(IN PKTHREAD Thread, IN PKTRAP_FRAME TrapFrame, IN ULONG Instruction)
Definition: traphandler.c:274
VOID KiPassiveRelease(VOID)
static WCHAR Address[46]
Definition: ping.c:68
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define FORCEINLINE
Definition: wdftypes.h:67
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170