diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-14 01:25:22 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-14 01:34:23 +0100 |
commit | 8415866c0371eae16e3c1221720efaa6c3cec3e2 (patch) | |
tree | 069ac36c07e125f946a1369eb34746e427ba3eb0 /Kernel/VM/Region.h | |
parent | 1593219a41bdb9d8efa62abf5fca462b38563878 (diff) | |
download | serenity-8415866c0371eae16e3c1221720efaa6c3cec3e2.zip |
Kernel: Remove user/kernel flags from Region
Now that we no longer need to support the signal trampolines being
user-accessible inside the kernel memory range, we can get rid of the
"kernel" and "user-accessible" flags on Region and simply use the
address of the region to determine whether it's kernel or user.
This also tightens the page table mapping code, since it can now set
user-accessibility based solely on the virtual address of a page.
Diffstat (limited to 'Kernel/VM/Region.h')
-rw-r--r-- | Kernel/VM/Region.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index ab04e6b491..0fba189157 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -59,8 +59,13 @@ public: HasBeenExecutable = 64, }; - static NonnullOwnPtr<Region> create_user_accessible(Process*, const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access, bool cacheable, bool shared); - static NonnullOwnPtr<Region> create_kernel_only(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const StringView& name, u8 access, bool cacheable = true); + enum class Cacheable { + No = 0, + Yes, + }; + + static NonnullOwnPtr<Region> create_user_accessible(Process*, const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, String name, u8 access, Cacheable, bool shared); + static NonnullOwnPtr<Region> create_kernel_only(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, String name, u8 access, Cacheable = Cacheable::Yes); ~Region(); @@ -79,8 +84,7 @@ public: const String& name() const { return m_name; } unsigned access() const { return m_access; } - void set_name(const String& name) { m_name = name; } - void set_name(String&& name) { m_name = move(name); } + void set_name(String name) { m_name = move(name); } const VMObject& vmobject() const { return *m_vmobject; } VMObject& vmobject() { return *m_vmobject; } @@ -95,8 +99,8 @@ public: bool is_mmap() const { return m_mmap; } void set_mmap(bool mmap) { m_mmap = mmap; } - bool is_user_accessible() const { return m_user_accessible; } - bool is_kernel() const { return m_kernel || vaddr().get() >= 0xc0000000; } + bool is_user() const { return !is_kernel(); } + bool is_kernel() const { return vaddr().get() < 0x00800000 || vaddr().get() >= 0xc0000000; } PageFaultResponse handle_fault(const PageFault&, ScopedSpinLock<RecursiveSpinLock>&); @@ -225,7 +229,7 @@ public: Region* m_prev { nullptr }; // NOTE: These are public so we can make<> them. - Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, const String&, u8 access, bool cacheable, bool kernel, bool shared); + Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, String, u8 access, Cacheable, bool shared); bool remap_vmobject_page_range(size_t page_index, size_t page_count); @@ -272,11 +276,9 @@ private: String m_name; u8 m_access { 0 }; bool m_shared : 1 { false }; - bool m_user_accessible : 1 { false }; bool m_cacheable : 1 { false }; bool m_stack : 1 { false }; bool m_mmap : 1 { false }; - bool m_kernel : 1 { false }; bool m_syscall_region : 1 { false }; WeakPtr<Process> m_owner; }; |