1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

Turn the syscall interrupt into a trap (by switching the gate type.)

This leaves interrupts enabled while we're in the kernel, which is
precisely what we want.

This uncovered a horrendous problem with kernel tasks silently
overflowing their stacks. For now I've simply increased the stack size
but I need a more MMU-y solution for this eventually.
This commit is contained in:
Andreas Kling 2018-10-19 11:28:43 +02:00
parent 2d1d01661b
commit 46ff281695
6 changed files with 116 additions and 25 deletions

View file

@ -98,11 +98,12 @@ void clock_handle()
WORD foo = vga_get_cursor();
vga_set_attr(0x50);
vga_set_cursor(1600);
vga_set_cursor(0);
kprintf("Task %u interrupted at %x\n", current->pid(), regs.eip );
kprintf("EAX=%x EBX=%x ECX=%x EDX=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
kprintf("ESI=%x EDI=%x EBP=%x ESP=%x\n", regs.esi, regs.edi, regs.ebp, regs.esp);
kprintf("\n\n");
kprintf("Task %u interrupted at %x \n", current->pid(), regs.eip );
kprintf("EAX=%x EBX=%x ECX=%x EDX=%x \n", regs.eax, regs.ebx, regs.ecx, regs.edx);
kprintf("ESI=%x EDI=%x EBP=%x ESP=%x \n", regs.esi, regs.edi, regs.ebp, regs.esp);
kprintf("FLAGS=%x", regs.eflags);
vga_set_cursor(foo);
@ -111,6 +112,9 @@ void clock_handle()
// Compute task ESP.
// Add 12 for CS, EIP, EFLAGS (interrupt mechanic)
// FIXME: Hmm. Should we add an extra 8 here for SS:ESP in some cases?
// If this IRQ occurred while in a user task, wouldn't that also push the stack ptr?
current->tss().esp = regs.esp + 12;
// Prepare a new task to run;