fix: no more random reboot
This commit is contained in:
@ -14,10 +14,13 @@
|
||||
#define PIC2_DATA (PIC2 + 1)
|
||||
|
||||
extern void *isr_stub_table[];
|
||||
extern void *irq_stub_table[];
|
||||
|
||||
__attribute__((aligned(0x10))) static struct idt_entry idt_entries[IDT_SIZE];
|
||||
static struct idt_descriptor idtr;
|
||||
|
||||
void load_idt(struct idt_descriptor *idtr);
|
||||
|
||||
void idt_set_descriptor(uint8_t index, void *isr, uint8_t flags)
|
||||
{
|
||||
struct idt_entry *descriptor = &idt_entries[index];
|
||||
@ -36,8 +39,9 @@ void init_idt(void)
|
||||
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
idt_set_descriptor(i, isr_stub_table[i], 0x8E);
|
||||
__asm__ volatile("lidt %0" : : "m"(idtr));
|
||||
__asm__ volatile("sti");
|
||||
for (uint8_t i = 32; i < 48; i++)
|
||||
idt_set_descriptor(i, irq_stub_table[i], 0x8E);
|
||||
load_idt(&idtr);
|
||||
// https://wiki.osdev.org/8259_PIC#Programming_with_the_8259_PIC
|
||||
pic_remap(0x20, 0x28);
|
||||
pic_disable();
|
||||
|
Reference in New Issue
Block a user