#ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
#define __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
+#include "intrin_i.h"
+
//
//Lockdown TLB entries
//
#define PCR_ENTRY 0
#define PDR_ENTRY 2
-#define KeArchHaltProcessor() KeArmHaltProcessor()
+#define IMAGE_FILE_MACHINE_ARCHITECTURE IMAGE_FILE_MACHINE_ARM
+
+//
+// BKPT is 4 bytes long
+//
+#define KD_BREAKPOINT_TYPE ULONG
+#define KD_BREAKPOINT_SIZE sizeof(ULONG)
+//#define KD_BREAKPOINT_VALUE
+
+//
+// Macros for getting and setting special purpose registers in portable code
+//
+#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))
+
+//
+// Macro to get trap and exception frame from a thread stack
+//
+#define KeGetTrapFrame(Thread) \
+ (PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
+ sizeof(KTRAP_FRAME))
+
+#define KeGetExceptionFrame(Thread) \
+ (PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \
+ sizeof(KEXCEPTION_FRAME))
+
+//
+// Macro to get context switches from the PRCB
+// All architectures but x86 have it in the PRCB's KeContextSwitches
+//
+#define KeGetContextSwitches(Prcb) \
+ Prcb->KeContextSwitches
+//
+// Returns the Interrupt State from a Trap Frame.
+// ON = TRUE, OFF = FALSE
+//
+//#define KeGetTrapFrameInterruptState(TrapFrame)
+
+//
+// Invalidates the TLB entry for a specified address
+//
+FORCEINLINE
VOID
-NTAPI
-KeArmInitThreadWithContext(
- IN PKTHREAD Thread,
- IN PKSYSTEM_ROUTINE SystemRoutine,
- IN PKSTART_ROUTINE StartRoutine,
- IN PVOID StartContext,
- IN PCONTEXT Context
-);
+KeInvalidateTlbEntry(IN PVOID Address)
+{
+ /* Invalidate the TLB entry for this address */
+ KeArmInvalidateTlbEntry(Address);
+}
VOID
KiPassiveRelease(
VOID
);
-#define KeArchInitThreadWithContext KeArmInitThreadWithContext
#define KiSystemStartupReal KiSystemStartup
#define KiGetPreviousMode(tf) \