mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
Kernel: Send SIGSEGV on seg-fault
Now programs can catch the SIGSEGV signal when they segfault. This commit also introduced the send_urgent_signal_to_self method, which is needed to send signals to a thread when handling exceptions caused by the same thread.
This commit is contained in:
parent
7fc903b97a
commit
c136fd3fe2
3 changed files with 31 additions and 0 deletions
|
@ -262,6 +262,11 @@ void exception_14_handler(RegisterDump& regs)
|
|||
auto response = MM.handle_page_fault(PageFault(regs.exception_code, VirtualAddress(fault_address)));
|
||||
|
||||
if (response == PageFaultResponse::ShouldCrash) {
|
||||
if(current->has_signal_handler(SIGSEGV)){
|
||||
current->send_urgent_signal_to_self(SIGSEGV);
|
||||
return;
|
||||
}
|
||||
|
||||
kprintf("\033[31;1m%s(%u:%u) Unrecoverable page fault, %s address %p\033[0m\n",
|
||||
current->process().name().characters(),
|
||||
current->pid(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue