x86: Set interrupt handler for Double Fault exception

This patch sets an interrupt handler for Double Fault exception during
CPU initialization. In case such exception is raised, we halt the system.
This way, we avoid the system to triple fault (due to an unhandled
interrupt for instance), leaving no trace about what cause the triple
fault.
This commit is contained in:
Andre Guedes 2015-04-15 17:44:38 -03:00 committed by Jesus Sanchez-Palencia
parent e28f400e0c
commit 604538ed62

View file

@ -30,10 +30,23 @@
#include "gdt.h" #include "gdt.h"
#include "idt.h" #include "idt.h"
#include "interrupt.h"
#include "helpers.h"
static void
double_fault_handler(struct interrupt_context context)
{
halt();
}
/*---------------------------------------------------------------------------*/
void void
cpu_init(void) cpu_init(void)
{ {
gdt_init(); gdt_init();
idt_init(); idt_init();
/* Set an interrupt handler for Double Fault exception. This way, we avoid
* the system to triple fault, leaving no trace about what happened.
*/
SET_INTERRUPT_HANDLER(8, 1, double_fault_handler);
} }