mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-01 21:53:54 +00:00
Kernel/x86_64: *Restore* interrupt flag in page fault handler
If a page fault occurs while interrupts are disabled, we were wrongly enabling interrupts right away in the page fault handler. Instead, we should only do this if interrupts were enabled when the page fault occurred.
This commit is contained in:
parent
e3b9f78eb9
commit
1b4baaed56
|
@ -177,13 +177,16 @@ void page_fault_handler(TrapFrame* trap)
|
|||
{
|
||||
clac();
|
||||
|
||||
// NOTE: Once we've extracted the faulting address from CR2,
|
||||
// we can re-enable interrupts.
|
||||
auto fault_address = read_cr2();
|
||||
sti();
|
||||
|
||||
auto& regs = *trap->regs;
|
||||
|
||||
// NOTE: Once we've extracted the faulting address from CR2, we can re-enable interrupts.
|
||||
// However, we only do this *if* they were enabled when the page fault occurred.
|
||||
if (regs.flags() & 0x200) {
|
||||
sti();
|
||||
}
|
||||
|
||||
if constexpr (PAGE_FAULT_DEBUG) {
|
||||
u32 fault_page_directory = read_cr3();
|
||||
dbgln("CPU #{} ring {} {} page fault in PD={:#x}, {}{} {}",
|
||||
|
|
Loading…
Reference in a new issue