summaryrefslogtreecommitdiff
path: root/src/arch/amd64/idt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/amd64/idt.c')
-rw-r--r--src/arch/amd64/idt.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/arch/amd64/idt.c b/src/arch/amd64/idt.c
index 5445560..c903ca8 100644
--- a/src/arch/amd64/idt.c
+++ b/src/arch/amd64/idt.c
@@ -9,18 +9,18 @@
#define IDT_SIZE 256
struct idt_entry {
- uint16_t isr_low; // low 16 bits of isr
- uint16_t kernel_cs; // kernel segment selector
- uint8_t ist; // interrupt stack table
- uint8_t flags; // gate type, privilege level, present bit
- uint16_t isr_mid; // middle 16 bits of isr
- uint32_t isr_high; // high 32 bits of isr
+ uint16_t isr_low; // low 16 bits of isr
+ uint16_t kernel_cs; // kernel segment selector
+ uint8_t ist; // interrupt stack table
+ uint8_t flags; // gate type, privilege level, present bit
+ uint16_t isr_mid; // middle 16 bits of isr
+ uint32_t isr_high; // high 32 bits of isr
uint32_t reserved;
} __attribute__((packed));
struct idtr {
uint16_t size;
- void *address;
+ uint64_t address;
} __attribute__((packed));
// interrupt gate
@@ -47,7 +47,7 @@ extern void *isr_stub_table[];
// initialize and load the IDT
void idt_init(void) {
// initialize idtr
- idtr.address = &idt;
+ idtr.address = (uint64_t)&idt;
idtr.size = (uint16_t)sizeof(struct idt_entry) * IDT_SIZE - 1;
// initialize idt
@@ -63,14 +63,13 @@ void idt_init(void) {
entry->flags = PRESENT | RING0 | gate_type;
entry->isr_low = isr & 0xffff;
entry->isr_mid = (isr >> 16) & 0xffff;
- entry->isr_high = isr >> 32;
+ entry->isr_high = (isr >> 32) & 0xffffffff;
entry->reserved = 0;
}
__asm__ volatile ("lidt %0" : : "m"(idtr));
}
-
// Intel manual vol 3 ch 6.3.1
char *EXCEPTIONS[] = {
"Exception 0x00 Divide Error",