]>
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
{
24 __attribute__((interrupt
))
25 void keyb_handler(struct interrupt_frame
*frame
)
28 kprint("Got a keyboard interrupt!\n", 0);
32 __attribute__((interrupt
))
33 void pf_handler(struct fault_frame
*frame
)
35 struct pf_errcode
*errcode
= &(frame
->error_code
);
36 kprint("A page fault occurred!\n", VGA_COLOR_DARK_RED
);
38 kprint("Attempted to access non-present page\n", 0);
41 kprint("Kernel attempted to write to page\n", 0);
42 } else kprint("Kernel attempted to read from page\n", 0);
44 kprint("Fault occurred while fetching instruction\n", 0);
47 asm ("mov %%cr2, %0": "=a" (cr2
));
55 __attribute__((interrupt
))
56 void double_fault(struct abort_frame
*frame
)
58 *(volatile uint32_t *) (0xb8000) = 0xcf28cf3a;
60 asm volatile ("cli; hlt");