1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

Kernel+LibC: Make page fault crashes a bit more readable.

We'll now try to detect crashes that were due to dereferencing nullptr,
uninitialized malloc() memory, or recently free()'d memory.
It's not perfect but I think it's pretty good. :^)

Also added some color to the most important parts of the crash log,
and added some more modes to /bin/crash for exercising this code.

Fixes #243.
This commit is contained in:
Andreas Kling 2019-06-19 20:52:12 +02:00
parent 15bea7153a
commit 8c0ae711d8
5 changed files with 76 additions and 11 deletions

View file

@ -53,3 +53,13 @@ constexpr unsigned GB = KB * KB * KB;
namespace std {
typedef decltype(nullptr) nullptr_t;
}
static constexpr dword explode_byte(byte b)
{
return b << 24 | b << 16 | b << 8 | b;
}
static_assert(explode_byte(0xff) == 0xffffffff);
static_assert(explode_byte(0x80) == 0x80808080);
static_assert(explode_byte(0x7f) == 0x7f7f7f7f);
static_assert(explode_byte(0) == 0);