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.

svn path=/branches/ros-amd64-bringup/; revision=45082
This commit is contained in:
Timo Kreuzer 2010-01-15 00:13:38 +00:00
parent 52c5ac7be7
commit b2e87768af
2 changed files with 24 additions and 14 deletions

View file

@ -13,6 +13,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
extern ULONG64 InterruptDispatchTable[256];
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
KIDT_INIT KiInterruptInitTable[] = KIDT_INIT KiInterruptInitTable[] =
@ -73,7 +75,7 @@ KeInitExceptions(VOID)
} }
else else
{ {
Offset = (ULONG64)KiUnexpectedInterrupt; Offset = (ULONG64)&InterruptDispatchTable[i];
KiIdt[i].Dpl = 0; KiIdt[i].Dpl = 0;
KiIdt[i].IstIndex = 0; KiIdt[i].IstIndex = 0;
} }

View file

@ -28,10 +28,10 @@ _MsgBreakpointTrap:
.ascii "BreakpointTrap at %p\n\0" .ascii "BreakpointTrap at %p\n\0"
_MsgUnexpectedInterrupt: _MsgUnexpectedInterrupt:
.ascii "UnexpectedInterrupt\n\0" .ascii "UnexpectedInterrupt Vector=0x%02lx\n\0"
_MsgInvalidOpcodeFault: _MsgInvalidOpcodeFault:
.ascii "General protection fault at %p!\n\0" .ascii "Invalid opcode fault at %p!\n\0"
_MsgDoubleFault: _MsgDoubleFault:
.ascii "Double fault at %p, rbp=%p!\n\0" .ascii "Double fault at %p, rbp=%p!\n\0"
@ -242,6 +242,17 @@ _MsgTrapInfo:
.text .text
.code64 .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 // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params
_InternalDispatchException: _InternalDispatchException:
@ -779,23 +790,20 @@ PageFaultReturn:
.proc KiUnexpectedInterrupt .proc KiUnexpectedInterrupt
.pushframe 0 .pushframe 0
/* Push pseudo error code */
push 0 /* The error code is the vector */
.allocstack 0x8
cli cli
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
lea rcx, _MsgUnexpectedInterrupt[rip] /* Set bugcheck parameters */
call _FrLdrDbgPrint[rip]
mov ecx, TRAP_CAUSE_UNKNOWN mov ecx, TRAP_CAUSE_UNKNOWN
// mov rdx, // The unexpected interrupt mov rdx, [rbp + KTRAP_FRAME_ErrorCode] // the vector
// mov rdx, // The unknown floating-point exception mov r8, 0 // The unknown floating-point exception
// mov r8, // The enabled and asserted status bits mov r9, 0 // The enabled and asserted status bits
xor r9, r9 // Reserved sub rsp, 8
mov [rbp + KTRAP_FRAME_P5], rbp // trap frame mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame
call _KeBugCheckWithTf call _KeBugCheckWithTf
.endproc .endproc