blob: ba5a615d43898e8a2f649e45d832fd2f0a8d2546 [file] [log] [blame]
#include "pic.h"
#include <log.h>
#define DECLARE_INTERRUPT(sym, name) \
static void sym##_h(struct registers *regs) \
{ \
kprintf("Fault " name ": eip = 0x%x, err = 0x%x\n", regs->eip, \
regs->error_code); \
asm volatile("cli"); \
kpanic(name); \
}
#define ADD_INTERRUPT(sym, num) add_interrupt_handler(num, sym##_h)
DECLARE_INTERRUPT(gp, "#GP")
DECLARE_INTERRUPT(pf, "#PF")
void init_faults()
{
ADD_INTERRUPT(gp, 13);
ADD_INTERRUPT(pf, 14);
}