mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
Kernel: Change Region allocation helpers
We now can create a cacheable Region, so when map() is called, if a Region is cacheable then all the virtual memory space being allocated to it will be marked as not cache disabled. In addition to that, OS components can create a Region that will be mapped to a specific physical address by using the appropriate helper method.
This commit is contained in:
parent
b913e30011
commit
d2b41010c5
7 changed files with 77 additions and 56 deletions
|
@ -26,11 +26,11 @@ public:
|
|||
Execute = 4,
|
||||
};
|
||||
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, const StringView& name, u8 access);
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access);
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<Inode>, const StringView& name, u8 access);
|
||||
static NonnullOwnPtr<Region> create_kernel_only(const Range&, const StringView& name, u8 access);
|
||||
static NonnullOwnPtr<Region> create_kernel_only(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access);
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, const StringView& name, u8 access, bool cacheable = true);
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access, bool cacheable = true);
|
||||
static NonnullOwnPtr<Region> create_user_accessible(const Range&, NonnullRefPtr<Inode>, const StringView& name, u8 access, bool cacheable = true);
|
||||
static NonnullOwnPtr<Region> create_kernel_only(const Range&, const StringView& name, u8 access, bool cacheable = true);
|
||||
static NonnullOwnPtr<Region> create_kernel_only(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access, bool cacheable = true);
|
||||
|
||||
~Region();
|
||||
|
||||
|
@ -40,6 +40,7 @@ public:
|
|||
bool is_readable() const { return m_access & Access::Read; }
|
||||
bool is_writable() const { return m_access & Access::Write; }
|
||||
bool is_executable() const { return m_access & Access::Execute; }
|
||||
bool is_cacheable() const { return m_cacheable; }
|
||||
const String& name() const { return m_name; }
|
||||
unsigned access() const { return m_access; }
|
||||
|
||||
|
@ -115,6 +116,7 @@ public:
|
|||
void set_writable(bool b) { set_access_bit(Access::Write, b); }
|
||||
void set_executable(bool b) { set_access_bit(Access::Execute, b); }
|
||||
|
||||
void set_page_directory(PageDirectory&);
|
||||
void map(PageDirectory&);
|
||||
enum class ShouldDeallocateVirtualMemoryRange {
|
||||
No,
|
||||
|
@ -130,9 +132,9 @@ public:
|
|||
Region* m_prev { nullptr };
|
||||
|
||||
// NOTE: These are public so we can make<> them.
|
||||
Region(const Range&, const String&, u8 access);
|
||||
Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const String&, u8 access);
|
||||
Region(const Range&, NonnullRefPtr<Inode>, const String&, u8 access);
|
||||
Region(const Range&, const String&, u8 access, bool cacheable);
|
||||
Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const String&, u8 access, bool cacheable);
|
||||
Region(const Range&, NonnullRefPtr<Inode>, const String&, u8 access, bool cacheable);
|
||||
|
||||
private:
|
||||
Bitmap& ensure_cow_map() const;
|
||||
|
@ -159,6 +161,7 @@ private:
|
|||
u8 m_access { 0 };
|
||||
bool m_shared { false };
|
||||
bool m_user_accessible { false };
|
||||
bool m_cacheable { false };
|
||||
bool m_stack { false };
|
||||
bool m_mmap { false };
|
||||
mutable OwnPtr<Bitmap> m_cow_map;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue