3 Copyright (c) 1998-2001 Klaus P. Gerlicher
11 handle double faults on x86
25 15-Nov-2000: general cleanup of source files
29 This file may be distributed under the terms of the GNU Public License.
33 ////////////////////////////////////////////////////
39 ////////////////////////////////////////////////////
42 ULONG OldDblFltHandler
= 0;
44 ////////////////////////////////////////////////////
48 //*************************************************************************
49 // HandleDoubleFault()
51 //*************************************************************************
52 void HandleDoubleFault(FRAME
* ptr
)
54 DPRINT((0,"HandleDoubleFault(): ptr = %x\n",ptr
));
58 //*************************************************************************
61 //*************************************************************************
63 NewDblFltHandler:\n\t \
70 // setup default data selectors\n\t \
74 // get frame ptr\n\t \
75 lea 40(%esp),%eax\n\t \
77 call _HandleDoubleFault\n\t \
83 // remove error code from stack and replace with reason code\n\t \
84 movl $" STR(REASON_DOUBLE_FAULT
) ",(%esp)\n\t \
85 // call debugger loop\n\t \
86 jmp NewInt31Handler\n\t");
89 //*************************************************************************
90 // InstallDblFltHook()
92 //*************************************************************************
93 void InstallDblFltHook(void)
95 ULONG LocalDblFltHandler
;
100 if(!OldDblFltHandler
)
102 __asm__("mov $NewDblFltHandler,%0"
103 :"=r" (LocalDblFltHandler
)
106 OldDblFltHandler
=SetGlobalInt(0x08,(ULONG
)LocalDblFltHandler
);
113 //*************************************************************************
114 // DeInstallDblFltHook()
116 //*************************************************************************
117 void DeInstallDblFltHook(void)
124 RemoveAllSWBreakpoints(TRUE
);
125 SetGlobalInt(0x08,(ULONG
)OldDblFltHandler
);