aboutsummaryrefslogtreecommitdiff
path: root/i686/lidt.c
diff options
context:
space:
mode:
Diffstat (limited to 'i686/lidt.c')
-rw-r--r--i686/lidt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/i686/lidt.c b/i686/lidt.c
index 3e261ac..aa6185b 100644
--- a/i686/lidt.c
+++ b/i686/lidt.c
@@ -1,5 +1,6 @@
#include "idt.h"
#include <stdint.h>
+#include <stdio.h>
struct __attribute__((packed)) Pointer {
uint16_t limit;
@@ -21,7 +22,7 @@ struct __attribute__((packed)) Gate_t {
_Static_assert(sizeof(struct Gate_t) == 8);
void
-Gate(struct Gate_t *entry, void *f, uint16_t selector)
+Gate(struct Gate_t *entry, void (*f)(struct interrupt_frame *), uint16_t selector)
{
uint32_t f_addr = (uint32_t)f;
entry->offset_15_0 = f_addr & 0xffff;
@@ -36,7 +37,14 @@ static struct Gate_t interrupt_table[256] __attribute((aligned(4096)));
void
idt_install()
{
- for (int i = 0; i <= 0x2f; ++i) Gate(&interrupt_table[i], &interrupt_handler, 0x10);
+ // exceptions 0x00~0x13
+ for (int i = 0; i <= 0x13; ++i) Gate(&interrupt_table[i], &abort_handler, 0x10);
+ // irq 0x20~0x2f
+ // for (int i = 0; i < 16; ++i) irq_table[i] = NULL;
+ for (int i = 0x20; i <= 0x2f; ++i) Gate(&interrupt_table[i], &abort_handler, 0x10);
+ Gate(&interrupt_table[0x20], &irq0x00, 0x10);
+ Gate(&interrupt_table[0x21], &irq0x01, 0x10);
+ // syscall 0x80
Gate(&interrupt_table[0x80], &abort_handler, 0x10);
const struct Pointer ptr = {.limit = sizeof(interrupt_table) - 1, .base = (unsigned)&interrupt_table};