mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
Kernel: Clean up the page fault handling code a bit
Not using "else" after "return" unnests the code and makes it easier to follow. Also use an enum for the two different page fault types.
This commit is contained in:
parent
f58b0c245d
commit
af4cf01560
2 changed files with 22 additions and 19 deletions
|
@ -303,9 +303,16 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
enum class Type {
|
||||
PageNotPresent,
|
||||
ProtectionViolation,
|
||||
};
|
||||
|
||||
VirtualAddress vaddr() const { return m_vaddr; }
|
||||
u16 code() const { return m_code; }
|
||||
|
||||
Type type() const { return (Type)(m_code & 1); }
|
||||
|
||||
bool is_not_present() const { return (m_code & 1) == PageFaultFlags::NotPresent; }
|
||||
bool is_protection_violation() const { return (m_code & 1) == PageFaultFlags::ProtectionViolation; }
|
||||
bool is_read() const { return (m_code & 2) == PageFaultFlags::Read; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue