mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
Kernel: Track user accessibility per Region.
Region now has is_user_accessible(), which informs the memory manager how to map these pages. Previously, we were just passing a "bool user_allowed" to various functions and I'm not at all sure that any of that was correct. All the Region constructors are now hidden, and you must go through one of these helpers to construct a region: - Region::create_user_accessible(...) - Region::create_kernel_only(...) That ensures that we don't accidentally create a Region without specifying user accessibility. :^)
This commit is contained in:
parent
4547a301c4
commit
5b2447a27b
6 changed files with 73 additions and 30 deletions
|
@ -18,9 +18,11 @@ public:
|
|||
Execute = 4,
|
||||
};
|
||||
|
||||
Region(const Range&, const String&, u8 access, bool cow = false);
|
||||
Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmo, const String&, u8 access, bool cow = false);
|
||||
Region(const Range&, RefPtr<Inode>&&, const String&, u8 access);
|
||||
static NonnullRefPtr<Region> create_user_accessible(const Range&, const StringView& name, u8 access, bool cow = false);
|
||||
static NonnullRefPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access, bool cow = false);
|
||||
static NonnullRefPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<Inode>, const StringView& name, u8 access, bool cow = false);
|
||||
static NonnullRefPtr<Region> create_kernel_only(const Range&, const StringView& name, u8 access, bool cow = false);
|
||||
|
||||
~Region();
|
||||
|
||||
VirtualAddress vaddr() const { return m_range.base(); }
|
||||
|
@ -38,6 +40,8 @@ public:
|
|||
bool is_shared() const { return m_shared; }
|
||||
void set_shared(bool shared) { m_shared = shared; }
|
||||
|
||||
bool is_user_accessible() const { return m_user_accessible; }
|
||||
|
||||
NonnullRefPtr<Region> clone();
|
||||
|
||||
bool contains(VirtualAddress vaddr) const
|
||||
|
@ -97,6 +101,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Region(const Range&, const String&, u8 access, bool cow = false);
|
||||
Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmo, const String&, u8 access, bool cow = false);
|
||||
Region(const Range&, RefPtr<Inode>&&, const String&, u8 access, bool cow = false);
|
||||
|
||||
RefPtr<PageDirectory> m_page_directory;
|
||||
Range m_range;
|
||||
size_t m_offset_in_vmo { 0 };
|
||||
|
@ -104,5 +112,6 @@ private:
|
|||
String m_name;
|
||||
u8 m_access { 0 };
|
||||
bool m_shared { false };
|
||||
bool m_user_accessible { false };
|
||||
Bitmap m_cow_map;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue