]> git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/arch/x86/irq/sample_handler.c
Handle interrupts
[nameless-os.git] / kernel / arch / x86 / irq / sample_handler.c
1 #include <tty.h>
2 #include <irq/i8259a.h>
3 #include <stdint.h>
4
5 typedef uint32_t uword_t;
6
7 struct interrupt_frame {
8 uword_t ip;
9 uword_t cs;
10 uword_t flags;
11 };
12
13 struct abort_frame;
14
15 __attribute__((interrupt))
16 void keyb_handler(struct interrupt_frame *frame)
17 {
18 pic_send_eoi(1);
19 kprint("Got a keyboard interrupt!\n", 0);
20 }
21
22
23 __attribute__((interrupt))
24 void double_fault(struct abort_frame *frame)
25 {
26 *(volatile char *) (0xb8000) = ":";
27 *(volatile char *) (0xb8002) = "(";
28 asm volatile ("cli; hlt");
29 }
30