i need a break
This commit is contained in:
@ -2,8 +2,10 @@
|
||||
|
||||
#ifdef __TESTING__
|
||||
#include <kernel/_kernel.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <kernel/x86/idt.h>
|
||||
#include <kernel/x86/pic.h>
|
||||
|
||||
__attribute__((aligned(0x10)))
|
||||
static idt_entry_t idt[256];
|
||||
@ -12,8 +14,12 @@ static idtr_t idtr;
|
||||
|
||||
static bool vectors[IDT_MAX_DESCRIPTORS];
|
||||
|
||||
void exception_handler()
|
||||
void exception_handler(unsigned int i)
|
||||
{
|
||||
#ifdef __TESTING__
|
||||
kerror("EXCEPTION");
|
||||
printf("Exeption: %u\n", i);
|
||||
#endif
|
||||
__asm__ volatile ("cli; hlt"); // hangs the computer
|
||||
}
|
||||
|
||||
@ -28,7 +34,6 @@ void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags)
|
||||
descriptor->reserved = 0;
|
||||
}
|
||||
|
||||
|
||||
extern void* isr_stub_table[];
|
||||
void idt_init(void)
|
||||
{
|
||||
@ -38,16 +43,19 @@ void idt_init(void)
|
||||
idtr.base = (uintptr_t)&idt[0];
|
||||
idtr.limit = (uint16_t) sizeof(idt_entry_t) * IDT_MAX_DESCRIPTORS - 1;
|
||||
|
||||
for (uint8_t vector = 0; vector < 32; vector++) {
|
||||
for (uint8_t vector = 0; vector < IDT_MAX_DESCRIPTORS; vector++) {
|
||||
idt_set_descriptor(vector, isr_stub_table[vector], 0x8E);
|
||||
vectors[vector] = true;
|
||||
}
|
||||
|
||||
// The "m" indicates actual data, not a pointer
|
||||
__asm__ volatile("lidt %0" : : "m"(idtr)); // load the new IDT
|
||||
|
||||
PIC_remap(0x20, 0x28);
|
||||
IRQ_set_mask(0xfd); // unmask IRQ1
|
||||
|
||||
__asm__ volatile("sti"); // set the interrupt flag
|
||||
#ifdef __TESTING__
|
||||
kinfo("Initialized the IDT");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user