Kernel: Clean up Region access bit setters a little

This commit is contained in:
Andreas Kling 2019-12-25 02:39:03 +01:00
parent 336ac9e8e7
commit 7a0088c4d2
Notes: sideshowbarker 2024-07-19 10:42:03 +09:00

View file

@ -109,21 +109,9 @@ public:
u32 cow_pages() const;
void set_writable(bool b)
{
if (b)
m_access |= Access::Write;
else
m_access &= ~Access::Write;
}
void set_readable(bool b)
{
if (b)
m_access |= Access::Read;
else
m_access &= ~Access::Read;
}
void set_readable(bool b) { set_access_bit(Access::Read, b); }
void set_writable(bool b) { set_access_bit(Access::Write, b); }
void set_executable(bool b) { set_access_bit(Access::Execute, b); }
void map(PageDirectory&);
enum class ShouldDeallocateVirtualMemoryRange {
@ -147,6 +135,14 @@ public:
private:
Bitmap& ensure_cow_map() const;
void set_access_bit(Access access, bool b)
{
if (b)
m_access |= access;
else
m_access &= ~access;
}
PageFaultResponse handle_cow_fault(size_t page_index);
PageFaultResponse handle_inode_fault(size_t page_index);
PageFaultResponse handle_zero_fault(size_t page_index);