kernel/x86_64: Avoid kernel panics when a page fault occurs in a userspace thread
This commit is contained in:
parent
ca85a69442
commit
e30eec4213
@ -31,7 +31,7 @@ void FPData::save()
|
|||||||
|
|
||||||
void FPData::restore()
|
void FPData::restore()
|
||||||
{
|
{
|
||||||
if(!m_already_saved) return;
|
if (!m_already_saved) return;
|
||||||
asm volatile("fxrstor (%0)" : : "r"(m_data));
|
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);
|
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::print_stack_trace_at(regs);
|
||||||
|
|
||||||
CPU::efficient_halt();
|
CPU::efficient_halt();
|
||||||
|
Loading…
Reference in New Issue
Block a user