scheduler: Fix page table switch for scheduler

The userspace process may map pages where the kernel has allocated data and cause a crash.

This patch fixes this issue by having a separate IRQ handler which sets the kernel page table at the start of SchedulerInterruptHandler() and restores it in SchedulerHandlerStub() function.
This commit is contained in:
EnderIce2
2024-11-17 03:11:20 +02:00
parent 079055082a
commit 86a119ea51
9 changed files with 161 additions and 21 deletions

View File

@ -356,10 +356,10 @@ namespace Tasking
/* CPU state */
#if defined(a64)
CPU::x64::TrapFrame Registers{};
CPU::x64::SchedulerFrame Registers{};
uintptr_t ShadowGSBase, GSBase, FSBase;
#elif defined(a32)
CPU::x32::TrapFrame Registers{};
CPU::x32::SchedulerFrame Registers{};
uintptr_t ShadowGSBase, GSBase, FSBase;
#elif defined(aa64)
uintptr_t Registers; // TODO