ReactOS  0.4.14-dev-77-gd9e7c48
ke.h File Reference
#include "intrin_i.h"
#include "mm.h"
Include dependency graph for ke.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define KiServiceExit2   KiExceptionExit
 
#define SYNCH_LEVEL   DISPATCH_LEVEL
 
#define PCR   ((KPCR * const)KIP0PCRADDRESS)
 
#define PCR_ENTRY   0
 
#define PDR_ENTRY   2
 
#define KD_BREAKPOINT_TYPE   ULONG
 
#define KD_BREAKPOINT_SIZE   sizeof(ULONG)
 
#define KD_BREAKPOINT_VALUE   0xDEFE
 
#define MAXIMUM_VECTOR   16
 
#define KeGetContextPc(Context)   ((Context)->Pc)
 
#define KeSetContextPc(Context, ProgramCounter)   ((Context)->Pc = (ProgramCounter))
 
#define KeGetTrapFramePc(TrapFrame)   ((TrapFrame)->Pc)
 
#define KeGetContextReturnRegister(Context)   ((Context)->R0)
 
#define KeSetContextReturnRegister(Context, ReturnValue)   ((Context)->R0 = (ReturnValue))
 
#define KeGetTrapFrame(Thread)
 
#define KeGetExceptionFrame(Thread)
 
#define KeGetContextSwitches(Prcb)   (Prcb)->KeContextSwitches
 
#define KiGetSecondLevelDCacheSize()   ((PKIPCR)KeGetPcr())->SecondLevelDcacheSize
 
#define KeGetTrapFrameInterruptState(TrapFrame)   0
 
#define Ki386PerfEnd()
 
#define KiEndInterrupt(x, y)
 
#define KiGetLinkedTrapFrame(x)   (PKTRAP_FRAME)((x)->TrapFrame)
 
#define KiGetPreviousMode(tf)   ((tf->Cpsr & CPSRM_MASK) == CPSRM_USER) ? UserMode: KernelMode
 

Functions

FORCEINLINE BOOLEAN KeDisableInterrupts (VOID)
 
FORCEINLINE VOID KeRestoreInterrupts (BOOLEAN WereEnabled)
 
FORCEINLINE VOID KeInvalidateTlbEntry (IN PVOID Address)
 
FORCEINLINE VOID KeFlushProcessTb (VOID)
 
FORCEINLINE VOID KeSweepICache (IN PVOID BaseAddress, IN SIZE_T FlushSize)
 
FORCEINLINE VOID KiRundownThread (IN PKTHREAD Thread)
 
VOID KiPassiveRelease (VOID)
 
VOID KiSystemService (IN PKTHREAD Thread, IN PKTRAP_FRAME TrapFrame, IN ULONG Instruction)
 
VOID KiApcInterrupt (VOID)
 
VOID KeFlushTb (VOID)
 
VOID HalSweepDcache (VOID)
 
VOID HalSweepIcache (VOID)
 

Macro Definition Documentation

◆ KD_BREAKPOINT_SIZE

#define KD_BREAKPOINT_SIZE   sizeof(ULONG)

Definition at line 20 of file ke.h.

◆ KD_BREAKPOINT_TYPE

#define KD_BREAKPOINT_TYPE   ULONG

Definition at line 19 of file ke.h.

◆ KD_BREAKPOINT_VALUE

#define KD_BREAKPOINT_VALUE   0xDEFE

Definition at line 21 of file ke.h.

◆ KeGetContextPc

#define KeGetContextPc (   Context)    ((Context)->Pc)

Definition at line 31 of file ke.h.

◆ KeGetContextReturnRegister

#define KeGetContextReturnRegister (   Context)    ((Context)->R0)

Definition at line 40 of file ke.h.

◆ KeGetContextSwitches

#define KeGetContextSwitches (   Prcb)    (Prcb)->KeContextSwitches

Definition at line 61 of file ke.h.

◆ KeGetExceptionFrame

#define KeGetExceptionFrame (   Thread)
Value:
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _KEXCEPTION_FRAME * PKEXCEPTION_FRAME
#define KeGetTrapFrame(Thread)
Definition: ke.h:49
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653

Definition at line 53 of file ke.h.

◆ KeGetTrapFrame

#define KeGetTrapFrame (   Thread)
Value:
(PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
sizeof(KTRAP_FRAME))
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
struct _KTRAP_FRAME * PKTRAP_FRAME

Definition at line 49 of file ke.h.

◆ KeGetTrapFrameInterruptState

#define KeGetTrapFrameInterruptState (   TrapFrame)    0

Definition at line 74 of file ke.h.

◆ KeGetTrapFramePc

#define KeGetTrapFramePc (   TrapFrame)    ((TrapFrame)->Pc)

Definition at line 37 of file ke.h.

◆ KeSetContextPc

#define KeSetContextPc (   Context,
  ProgramCounter 
)    ((Context)->Pc = (ProgramCounter))

Definition at line 34 of file ke.h.

◆ KeSetContextReturnRegister

#define KeSetContextReturnRegister (   Context,
  ReturnValue 
)    ((Context)->R0 = (ReturnValue))

Definition at line 43 of file ke.h.

◆ Ki386PerfEnd

#define Ki386PerfEnd ( )

Definition at line 174 of file ke.h.

◆ KiEndInterrupt

#define KiEndInterrupt (   x,
  y 
)

Definition at line 175 of file ke.h.

◆ KiGetLinkedTrapFrame

#define KiGetLinkedTrapFrame (   x)    (PKTRAP_FRAME)((x)->TrapFrame)

Definition at line 177 of file ke.h.

◆ KiGetPreviousMode

#define KiGetPreviousMode (   tf)    ((tf->Cpsr & CPSRM_MASK) == CPSRM_USER) ? UserMode: KernelMode

Definition at line 180 of file ke.h.

◆ KiGetSecondLevelDCacheSize

#define KiGetSecondLevelDCacheSize ( )    ((PKIPCR)KeGetPcr())->SecondLevelDcacheSize

Definition at line 68 of file ke.h.

◆ KiServiceExit2

#define KiServiceExit2   KiExceptionExit

Definition at line 5 of file ke.h.

◆ MAXIMUM_VECTOR

#define MAXIMUM_VECTOR   16

Definition at line 26 of file ke.h.

◆ PCR

#define PCR   ((KPCR * const)KIP0PCRADDRESS)

Definition at line 8 of file ke.h.

◆ PCR_ENTRY

#define PCR_ENTRY   0

Definition at line 13 of file ke.h.

◆ PDR_ENTRY

#define PDR_ENTRY   2

Definition at line 14 of file ke.h.

◆ SYNCH_LEVEL

#define SYNCH_LEVEL   DISPATCH_LEVEL

Definition at line 7 of file ke.h.

Function Documentation

◆ HalSweepDcache()

VOID HalSweepDcache ( VOID  )

Definition at line 107 of file processor.c.

108 {
109  /*
110  * We get called very early on, before HalInitSystem or any of the Hal*
111  * processor routines, so we need to figure out what CPU we're on.
112  */
114 
115  /*
116  * Check if we can do it the ARMv5TE-J way
117  */
119  {
120  /* Test, clean, flush D-Cache */
121  __asm__ __volatile__ ("1: mrc p15, 0, pc, c7, c14, 3; bne 1b");
122  }
123  else
124  {
125  /* We need to do it it by set/way. For now always call ARMv7 function */
126  //extern VOID v7_flush_dcache_all(VOID);
127  //v7_flush_dcache_all();
128  }
129 }
BOOLEAN HalpTestCleanSupported
Definition: processor.c:20
BOOLEAN HalpProcessorIdentified
Definition: processor.c:19
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
VOID HalpIdentifyProcessor(VOID)
Definition: processor.c:25

Referenced by KiInitializeKernel(), and KiInitializeSystem().

◆ HalSweepIcache()

VOID HalSweepIcache ( VOID  )

Definition at line 135 of file processor.c.

136 {
137  /* All ARM cores support the same Icache flush command */
139 }
FORCEINLINE VOID KeArmFlushIcache(VOID)
Definition: intrin_i.h:205

Referenced by KiInitializeSystem().

◆ KeDisableInterrupts()

FORCEINLINE BOOLEAN KeDisableInterrupts ( VOID  )

Definition at line 78 of file ke.h.

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 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
FORCEINLINE ARM_STATUS_REGISTER KeArmStatusRegisterGet(VOID)
Definition: intrin_i.h:122
void __cdecl _disable(void)
Definition: intrin_arm.h:365

◆ KeFlushProcessTb()

FORCEINLINE VOID KeFlushProcessTb ( VOID  )

Definition at line 114 of file ke.h.

115 {
116  KeArmFlushTlb();
117 }
FORCEINLINE VOID KeArmFlushTlb(VOID)
Definition: intrin_i.h:175

◆ KeFlushTb()

VOID KeFlushTb ( VOID  )

Definition at line 36 of file cpu.c.

37 {
38  //
39  // Flush the entire TLB
40  //
41  KeArmFlushTlb();
42 }
FORCEINLINE VOID KeArmFlushTlb(VOID)
Definition: intrin_i.h:175

Referenced by KeFlushCurrentTb(), and KiInitializeSystem().

◆ KeInvalidateTlbEntry()

FORCEINLINE VOID KeInvalidateTlbEntry ( IN PVOID  Address)

Definition at line 106 of file ke.h.

107 {
108  /* Invalidate the TLB entry for this address */
110 }
FORCEINLINE VOID KeArmInvalidateTlbEntry(IN PVOID Address)
Definition: intrin_i.h:185
static WCHAR Address[46]
Definition: ping.c:68

◆ KeRestoreInterrupts()

FORCEINLINE VOID KeRestoreInterrupts ( BOOLEAN  WereEnabled)

Definition at line 96 of file ke.h.

97 {
98  if (WereEnabled) _enable();
99 }
void __cdecl _enable(void)
Definition: intrin_arm.h:373

◆ KeSweepICache()

FORCEINLINE VOID KeSweepICache ( IN PVOID  BaseAddress,
IN SIZE_T  FlushSize 
)

Definition at line 121 of file ke.h.

123 {
124  //
125  // Always sweep the whole cache
126  //
128  UNREFERENCED_PARAMETER(FlushSize);
129  _MoveToCoprocessor(0, CP15_ICIALLU);
130 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define CP15_ICIALLU
Definition: ketypes.h:83

◆ KiApcInterrupt()

VOID KiApcInterrupt ( VOID  )

Definition at line 228 of file trapc.c.

229 {
231  KEXCEPTION_FRAME ExceptionFrame;
232  PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
233 
234  DPRINT1("[APC TRAP]\n");
235  while (TRUE);
236 
237  //
238  // Isolate previous mode
239  //
240  PreviousMode = KiGetPreviousMode(TrapFrame);
241 
242  //
243  // FIXME-USER: Handle APC interrupt while in user-mode
244  //
246 
247  //
248  // Disable interrupts
249  //
250  _disable();
251 
252  //
253  // Clear APC interrupt
254  //
256 
257  //
258  // Re-enable interrupts
259  //
260  _enable();
261 
262  //
263  // Deliver APCs
264  //
265  KiDeliverApc(PreviousMode, &ExceptionFrame, TrapFrame);
266 }
#define TRUE
Definition: types.h:120
void __cdecl _enable(void)
Definition: intrin_arm.h:373
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KiGetPreviousMode(tf)
Definition: ke.h:180
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL HalClearSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:282
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define KeGetCurrentThread
Definition: hal.h:44
VOID NTAPI KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, IN PKEXCEPTION_FRAME ExceptionFrame, IN PKTRAP_FRAME TrapFrame)
Definition: apc.c:302
#define APC_LEVEL
Definition: env_spec_w32.h:695

◆ KiPassiveRelease()

VOID KiPassiveRelease ( VOID  )

Referenced by KiInitializePcr().

◆ KiRundownThread()

FORCEINLINE VOID KiRundownThread ( IN PKTHREAD  Thread)

Definition at line 134 of file ke.h.

135 {
136  /* FIXME */
137 }

◆ KiSystemService()

VOID KiSystemService ( IN PKTHREAD  Thread,
IN PKTRAP_FRAME  TrapFrame,
IN ULONG  Instruction 
)

Definition at line 399 of file stubs.c.

402 {
404  __debugbreak();
405 }
#define UNIMPLEMENTED
Definition: stubs.c:20
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

Referenced by KiSoftwareInterruptHandler().