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