mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Kernel: Print a helpful panic message for READONLY_AFTER_INIT crashes
This commit is contained in:
parent
d8013c60bb
commit
a10accd48c
1 changed files with 8 additions and 0 deletions
|
@ -53,6 +53,9 @@
|
|||
#include <Kernel/VM/ProcessPagingScope.h>
|
||||
#include <LibC/mallocdefs.h>
|
||||
|
||||
extern FlatPtr start_of_ro_after_init;
|
||||
extern FlatPtr end_of_ro_after_init;
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static DescriptorTablePointer s_idtr;
|
||||
|
@ -265,6 +268,11 @@ void page_fault_handler(TrapFrame* trap)
|
|||
handle_crash(regs, "Bad stack on page fault", SIGSTKFLT);
|
||||
}
|
||||
|
||||
if (fault_address >= (FlatPtr)&start_of_ro_after_init && fault_address < (FlatPtr)&end_of_ro_after_init) {
|
||||
dump(regs);
|
||||
PANIC("Attempt to write into READONLY_AFTER_INIT section");
|
||||
}
|
||||
|
||||
auto response = MM.handle_page_fault(PageFault(regs.exception_code, VirtualAddress(fault_address)));
|
||||
|
||||
if (response == PageFaultResponse::ShouldCrash || response == PageFaultResponse::OutOfMemory) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue