Remove magic numbers

This commit is contained in:
Thomas Lovén 2017-12-06 21:20:33 +01:00
parent 127d6ca5a4
commit 6cbdb8f7de
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,12 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#define IDT_INTERRUPT 0xE
#define IDT_DPL0 0x0
#define IDT_PRESENT 0x80
#define NUM_INTERRUPTS 256
struct int_gate_descriptor struct int_gate_descriptor
{ {
uint16_t base_l; uint16_t base_l;
@ -54,8 +60,6 @@ debug("R12=%016x R13=%016x R14=%016x R15=%016x\n", r->r12, r->r13, r->r14, r->r1
debug("RIP=%016x RFL=%016x\n", r->rip, r->rflags); \ debug("RIP=%016x RFL=%016x\n", r->rip, r->rflags); \
debug("CS=%016x SS=%016x\n", r->cs, r->ss); debug("CS=%016x SS=%016x\n", r->cs, r->ss);
void load_idt(struct idtr *); void load_idt(struct idtr *);
#define NUM_INTERRUPTS 256
void interrupt_init(); void interrupt_init();

View File

@ -24,7 +24,7 @@ void interrupt_init()
for(int i=0; i < NUM_INTERRUPTS; i++) for(int i=0; i < NUM_INTERRUPTS; i++)
{ {
idt_set_gate(i, isr_table[i], 0x8, 0, 0x8E); idt_set_gate(i, isr_table[i], 0x8, 0, IDT_PRESENT | IDT_DPL0 | IDT_INTERRUPT);
} }
idtr.addr = idt; idtr.addr = idt;