ReactOS  0.4.13-dev-1089-g05f0b08
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 
77 BOOLEAN
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 
95 VOID
97 {
98  if (WereEnabled) _enable();
99 }
100 
101 //
102 // Invalidates the TLB entry for a specified address
103 //
105 VOID
107 {
108  /* Invalidate the TLB entry for this address */
110 }
111 
113 VOID
115 {
116  KeArmFlushTlb();
117 }
118 
120 VOID
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 
133 VOID
135 {
136  /* FIXME */
137 }
138 
139 VOID
141  VOID
142 );
143 
144 VOID
146  IN PKTRAP_FRAME TrapFrame,
147  IN ULONG Instruction);
148 
149 VOID
151  VOID
152 );
153 
154 #include "mm.h"
155 
156 VOID
157 KeFlushTb(
158  VOID
159 );
160 
161 //
162 // Cache clean and flush
163 //
164 VOID
166  VOID
167 );
168 
169 VOID
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
#define IN
Definition: typedefs.h:38
FORCEINLINE VOID KeArmInvalidateTlbEntry(IN PVOID Address)
Definition: intrin_i.h:185
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
void __cdecl _enable(void)
Definition: intrin_arm.h:373
VOID HalSweepDcache(VOID)
Definition: processor.c:107
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID KiApcInterrupt(VOID)
Definition: trapc.c:228
VOID KiSystemService(IN PKTHREAD Thread, IN PKTRAP_FRAME TrapFrame, IN ULONG Instruction)
Definition: stubs.c:399
FORCEINLINE ARM_STATUS_REGISTER KeArmStatusRegisterGet(VOID)
Definition: intrin_i.h:122
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
#define FORCEINLINE
Definition: ntbasedef.h:221
FORCEINLINE BOOLEAN KeDisableInterrupts(VOID)
Definition: ke.h:176
FORCEINLINE VOID KeInvalidateTlbEntry(IN PVOID Address)
Definition: ke.h:201
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
VOID KiPassiveRelease(VOID)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
VOID HalSweepIcache(VOID)
Definition: processor.c:135
FORCEINLINE VOID KeRestoreInterrupts(BOOLEAN WereEnabled)
Definition: ke.h:191
FORCEINLINE VOID KiRundownThread(IN PKTHREAD Thread)
Definition: ke.h:230
FORCEINLINE VOID KeFlushProcessTb(VOID)
Definition: ke.h:209
VOID KeFlushTb(VOID)
Definition: cpu.c:36
void __cdecl _disable(void)
Definition: intrin_arm.h:365
unsigned int ULONG
Definition: retypes.h:1
FORCEINLINE VOID KeArmFlushTlb(VOID)
Definition: intrin_i.h:175
#define CP15_ICIALLU
Definition: ketypes.h:83
FORCEINLINE VOID KeSweepICache(IN PVOID BaseAddress, IN SIZE_T FlushSize)
Definition: ke.h:217