Author: tkreuzer
Date: Fri Jan 15 01:13:38 2010
New Revision: 45082
URL:
http://svn.reactos.org/svn/reactos?rev=45082&view=rev
Log:
[NTOS]
Implement InterruptDispatchTable, containing 256 dispatch stubs, that push the Vector on
the stack and then jump to KiUnexpectedInterrupt. This way we have the vector as ErrorCode
on the stack and we can report it with KeBugCheckWithTf.
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/except.c [iso-8859-1] Fri Jan 15
01:13:38 2010
@@ -12,6 +12,8 @@
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
+
+extern ULONG64 InterruptDispatchTable[256];
/* GLOBALS *******************************************************************/
@@ -73,7 +75,7 @@
}
else
{
- Offset = (ULONG64)KiUnexpectedInterrupt;
+ Offset = (ULONG64)&InterruptDispatchTable[i];
KiIdt[i].Dpl = 0;
KiIdt[i].IstIndex = 0;
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] Fri Jan 15
01:13:38 2010
@@ -28,10 +28,10 @@
.ascii "BreakpointTrap at %p\n\0"
_MsgUnexpectedInterrupt:
-.ascii "UnexpectedInterrupt\n\0"
+.ascii "UnexpectedInterrupt Vector=0x%02lx\n\0"
_MsgInvalidOpcodeFault:
-.ascii "General protection fault at %p!\n\0"
+.ascii "Invalid opcode fault at %p!\n\0"
_MsgDoubleFault:
.ascii "Double fault at %p, rbp=%p!\n\0"
@@ -242,6 +242,17 @@
.text
.code64
+.align 8
+.global _InterruptDispatchTable
+_InterruptDispatchTable:
+.set Vector, 0
+.rept 256
+ push Vector
+ jmp _KiUnexpectedInterrupt
+ .align 8
+ .set Vector, Vector+1
+.endr
+
// rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params
_InternalDispatchException:
@@ -779,23 +790,20 @@
.proc KiUnexpectedInterrupt
.pushframe 0
- /* Push pseudo error code */
- push 0
- .allocstack 0x8
+
+ /* The error code is the vector */
cli
ENTER_TRAP_FRAME TRAPFLAG_ALL
- lea rcx, _MsgUnexpectedInterrupt[rip]
- call _FrLdrDbgPrint[rip]
-
+ /* Set bugcheck parameters */
mov ecx, TRAP_CAUSE_UNKNOWN
-// mov rdx, // The unexpected interrupt
-// mov rdx, // The unknown floating-point exception
-// mov r8, // The enabled and asserted status bits
- xor r9, r9 // Reserved
- mov [rbp + KTRAP_FRAME_P5], rbp // trap frame
+ mov rdx, [rbp + KTRAP_FRAME_ErrorCode] // the vector
+ mov r8, 0 // The unknown floating-point exception
+ mov r9, 0 // The enabled and asserted status bits
+ sub rsp, 8
+ mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame
call _KeBugCheckWithTf
.endproc