]>
git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/arch/x86/irq/sample_handler.c
2 #include <irq/i8259a.h>
7 typedef uint32_t uword_t
;
9 struct interrupt_frame
{
16 struct pf_errcode error_code
;
24 __attribute__((interrupt
))
25 void keyb_handler(struct interrupt_frame
*frame
)
28 kprint("Got a keyboard interrupt!\n", 0);
30 int a
= *(int *) (0xa0000000);
33 __attribute__((interrupt
))
34 void pf_handler(struct fault_frame
*frame
)
37 struct pf_errcode errcode
= frame
->error_code
;
38 asm ("mov %%cr2, %0": "=a" (address
));
39 kprint("A page fault occurred!\n", VGA_COLOR_DARK_RED
);
40 kprint("Faulting address: ", 0);
44 kprint("Address points to non-mapped page\n", 0);
47 kprint("Fault occurred while writing to memory\n", 0);
49 kprint("Fault occurred while reading from memory\n", 0);
52 kprint("Fault occurred while fetching instruction\n", 0);
60 __attribute__((interrupt
))
61 void double_fault(struct abort_frame
*frame
)
63 *(volatile uint32_t *) (0xb8000) = 0xcf28cf3a;
65 asm volatile ("cli; hlt");