[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / include / internal / arm / ke.h
index f539cf4..8dace74 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
 #define __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
 
+#include "intrin_i.h"
+
 //
 //Lockdown TLB entries
 //
 #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) \
+//#define KeGetTrapFrameInterruptState(TrapFrame)
 
 //
 // Invalidates the TLB entry for a specified address