Kernel/Userspace: Start initial work on userspace and syscalls

This commit is contained in:
2023-03-13 15:32:46 +02:00
parent af854ec9e1
commit 8b8e3cbbf0
10 changed files with 231 additions and 5 deletions

View File

@@ -148,6 +148,12 @@ namespace IDT
descriptor.flags = 0x8E;
}
static void register_syscall_handler(uint8_t index, void(*handler)())
{
register_interrupt_handler(index, handler);
s_idt[index].flags = 0xEE;
}
void register_irq_handler(uint8_t irq, void(*handler)())
{
s_irq_handlers[irq] = handler;
@@ -203,6 +209,8 @@ namespace IDT
extern "C" void irq14();
extern "C" void irq15();
extern "C" void syscall_asm();
void initialize()
{
s_idt = (GateDescriptor*)kmalloc(0x100 * sizeof(GateDescriptor));
@@ -262,6 +270,8 @@ namespace IDT
REGISTER_IRQ_HANDLER(14);
REGISTER_IRQ_HANDLER(15);
register_syscall_handler(0x80, syscall_asm);
flush_idt();
}