diff --git a/kernel/src/arch/x86_64/CPU.cpp b/kernel/src/arch/x86_64/CPU.cpp index 174fbbc9..97c1c060 100644 --- a/kernel/src/arch/x86_64/CPU.cpp +++ b/kernel/src/arch/x86_64/CPU.cpp @@ -31,7 +31,7 @@ void FPData::save() void FPData::restore() { - if(!m_already_saved) return; + if (!m_already_saved) return; asm volatile("fxrstor (%0)" : : "r"(m_data)); } @@ -64,6 +64,13 @@ void decode_page_fault_error_code(u64 code) decode_page_fault_error_code(regs->error); + if (!is_in_kernel(regs)) + { + // FIXME: Kill this process with SIGSEGV once we have signals and all that. + kerrorln("Current task %zu was terminated because of a page fault", Scheduler::current()->id); + kernel_exit(); + } + CPU::print_stack_trace_at(regs); CPU::efficient_halt();