blob: ba5a615d43898e8a2f649e45d832fd2f0a8d2546 [file] [log] [blame]
swissChiliaed6ff32021-05-29 17:51:04 -07001#include "pic.h"
2#include <log.h>
3
4#define DECLARE_INTERRUPT(sym, name) \
5 static void sym##_h(struct registers *regs) \
6 { \
7 kprintf("Fault " name ": eip = 0x%x, err = 0x%x\n", regs->eip, \
8 regs->error_code); \
9 asm volatile("cli"); \
10 kpanic(name); \
11 }
12
13#define ADD_INTERRUPT(sym, num) add_interrupt_handler(num, sym##_h)
14
15DECLARE_INTERRUPT(gp, "#GP")
16DECLARE_INTERRUPT(pf, "#PF")
17
18void init_faults()
19{
20 ADD_INTERRUPT(gp, 13);
21 ADD_INTERRUPT(pf, 14);
22}