Author: tkreuzer
Date: Fri Jun 4 12:51:44 2010
New Revision: 47564
URL:
http://svn.reactos.org/svn/reactos?rev=47564&view=rev
Log:
[NTOSKRNL]
Implement KeRegisterInterruptHandler and KeQueryInterruptHandler for amd64
Modified:
trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Fri Jun 4 12:51:44
2010
@@ -155,6 +155,52 @@
#else
/* Nothing to do */
#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