#define KeGetContextSwitches(Prcb) \
(Prcb->KeContextSwitches)
+//
+// Macro to get the second level cache size field name which differs between
+// CISC and RISC architectures, as the former has unified I/D cache
+//
+#define KiGetSecondLevelDCacheSize() ((PKIPCR)KeGetPcr())->SecondLevelCacheSize
+
#define KeGetExceptionFrame(Thread) \
(PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \
sizeof(KEXCEPTION_FRAME))
__writecr3(__readcr3());
}
-FORCEINLINE
-PRKTHREAD
-KeGetCurrentThread(VOID)
-{
- return (PRKTHREAD)__readgsqword(FIELD_OFFSET(KIPCR, Prcb.CurrentThread));
-}
-
FORCEINLINE
VOID
KiRundownThread(IN PKTHREAD Thread)
#endif
}
+/* Registers an interrupt handler with an IDT vector */
+FORCEINLINE
+VOID
+KeRegisterInterruptHandler(IN ULONG Vector,
+ IN PVOID Handler)
+{
+ UCHAR Entry;
+ PKIDTENTRY64 Idt;
+
+ /* Get the entry from the HAL */
+ Entry = HalVectorToIDTEntry(Vector);
+
+ /* Now set the data */
+ Idt = &KeGetPcr()->IdtBase[Entry];
+ Idt->OffsetLow = (ULONG_PTR)Handler & 0xffff;
+ Idt->OffsetMiddle = ((ULONG_PTR)Handler >> 16) & 0xffff;
+ Idt->OffsetHigh = (ULONG_PTR)Handler >> 32;
+ Idt->Selector = KGDT64_R0_CODE;
+ Idt->IstIndex = 0;
+ Idt->Type = 0x0e;
+ Idt->Dpl = 0;
+ Idt->Present = 1;
+ Idt->Reserved0 = 0;
+ Idt->Reserved1 = 0;
+}
+
+/* Returns the registered interrupt handler for a given IDT vector */
+FORCEINLINE
+PVOID
+KeQueryInterruptHandler(IN ULONG Vector)
+{
+ UCHAR Entry;
+ PKIDTENTRY64 Idt;
+
+ /* Get the entry from the HAL */
+ Entry = HalVectorToIDTEntry(Vector);
+
+ /* Get the IDT entry */
+ Idt = &KeGetPcr()->IdtBase[Entry];
+
+ /* Return the address */
+ return (PVOID)((ULONG64)Idt->OffsetHigh << 32 |
+ (ULONG64)Idt->OffsetMiddle << 16 |
+ (ULONG64)Idt->OffsetLow);
+}
+
+VOID
+FORCEINLINE
+KiEndInterrupt(IN KIRQL Irql,
+ IN PKTRAP_FRAME TrapFrame)
+{
+ DbgPrint("KiEndInterrupt is unimplemented\n");
+}
+
+#define Ki386PerfEnd(x)
+
struct _KPCR;
VOID
KTRAP_FRAME TrapFrame);
#endif
-#endif
+#endif /* __ASM__ */
+
+#undef KeGetCurrentThread
+#define _KeGetCurrentThread KeGetCurrentThread
+
+// HACK
+extern NTKERNELAPI volatile KSYSTEM_TIME KeTickCount;
+
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H */
/* EOF */