summaryrefslogtreecommitdiff
path: root/Kernel/VM/Region.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-01-09 23:29:31 +0200
committerAndreas Kling <awesomekling@gmail.com>2020-01-14 15:38:58 +0100
commitd2b41010c550e7574698dc7e74c6f24958ef1737 (patch)
tree4b7d4e29d01f96a9e2e881a6f5f9a87fd57d7b27 /Kernel/VM/Region.h
parentb913e300111c6dc403a8d0d6691890de14ea9de7 (diff)
downloadserenity-d2b41010c550e7574698dc7e74c6f24958ef1737.zip
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.
Diffstat (limited to 'Kernel/VM/Region.h')
-rw-r--r--Kernel/VM/Region.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h
index 3af580af79..377344d348 100644
--- a/Kernel/VM/Region.h
+++ b/Kernel/VM/Region.h
@@ -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;