3 * Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu>
6 * This is free software. You are permitted to use,
7 * redistribute, and modify it as specified in the file "COPYING".
10 #include <geekos/idt.h>
11 #include <geekos/kthread.h>
12 #include <geekos/defs.h>
13 #include <geekos/trap.h>
14 #include <geekos/serial.h>
15 #include <geekos/debug.h>
17 * TODO: need to add handlers for other exceptions (such as bounds
22 * Handler for general protection faults and other bad errors.
23 * Kill the current thread (which caused the fault).
25 static void GPF_Handler(struct Interrupt_State* state)
27 /* Send the thread to the reaper... */
28 SerialPrintLevel(1000,"Exception %d received, killing thread %p\n",state->intNum, g_currentThread);
29 Dump_Interrupt_State(state);
33 /* We will never get here */
38 * Initialize handlers for processor traps.
42 PrintBoth("Initializing Traps\n");
43 Install_Interrupt_Handler(12, &GPF_Handler); /* stack exception */
44 Install_Interrupt_Handler(13, &GPF_Handler); /* general protection fault */