diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-06 09:33:35 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-06 09:33:35 +0200 |
commit | af4cf01560f7cb2a1c88b5ee41c40deaeb448d5c (patch) | |
tree | 3871fde044d7dbcff0f4d72a2130e5a1949d321c /Kernel/Arch/i386/CPU.h | |
parent | f58b0c245d157efb877e2d09ce1599233c0da06c (diff) | |
download | serenity-af4cf01560f7cb2a1c88b5ee41c40deaeb448d5c.zip |
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.
Diffstat (limited to 'Kernel/Arch/i386/CPU.h')
-rw-r--r-- | Kernel/Arch/i386/CPU.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h index a8386ace93..9c12fe9cd3 100644 --- a/Kernel/Arch/i386/CPU.h +++ b/Kernel/Arch/i386/CPU.h @@ -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; } |