diff options
-rw-r--r-- | Kernel/Process.cpp | 3 | ||||
-rw-r--r-- | Kernel/VM/MemoryManager.cpp | 5 | ||||
-rw-r--r-- | Kernel/VM/Region.cpp | 24 | ||||
-rw-r--r-- | Kernel/VM/Region.h | 3 |
4 files changed, 5 insertions, 30 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 2adee8f203..e6d0931ad3 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -190,7 +190,8 @@ Region& Process::allocate_split_region(const Region& source_region, const Range& Region* Process::allocate_region(const Range& range, const String& name, int prot, bool commit) { ASSERT(range.is_valid()); - auto& region = add_region(Region::create_user_accessible(range, name, prot_to_region_access_flags(prot))); + auto vmobject = AnonymousVMObject::create_with_size(range.size()); + auto& region = add_region(Region::create_user_accessible(range, vmobject, 0, name, prot_to_region_access_flags(prot))); region.map(page_directory()); if (commit) region.commit(); diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 740da3619c..960458ac94 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -314,11 +314,12 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringVi ASSERT(!(size % PAGE_SIZE)); auto range = kernel_page_directory().range_allocator().allocate_anywhere(size); ASSERT(range.is_valid()); + auto vmobject = AnonymousVMObject::create_with_size(size); OwnPtr<Region> region; if (user_accessible) - region = Region::create_user_accessible(range, name, access, cacheable); + region = Region::create_user_accessible(range, vmobject, 0, name, access, cacheable); else - region = Region::create_kernel_only(range, name, access, cacheable); + region = Region::create_kernel_only(range, vmobject, 0, name, access, cacheable); region->map(kernel_page_directory()); if (should_commit) region->commit(); diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 80e0711d67..a9f6b69727 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -38,16 +38,6 @@ namespace Kernel { -Region::Region(const Range& range, const String& name, u8 access, bool cacheable) - : m_range(range) - , m_vmobject(AnonymousVMObject::create_with_size(size())) - , m_name(name) - , m_access(access) - , m_cacheable(cacheable) -{ - MM.register_region(*this); -} - Region::Region(const Range& range, NonnullRefPtr<VMObject> vmobject, size_t offset_in_vmobject, const String& name, u8 access, bool cacheable) : m_range(range) , m_offset_in_vmobject(offset_in_vmobject) @@ -175,13 +165,6 @@ size_t Region::amount_shared() const return bytes; } -NonnullOwnPtr<Region> Region::create_user_accessible(const Range& range, const StringView& name, u8 access, bool cacheable) -{ - auto region = make<Region>(range, name, access, cacheable); - region->m_user_accessible = true; - return region; -} - NonnullOwnPtr<Region> Region::create_user_accessible(const Range& range, NonnullRefPtr<VMObject> vmobject, size_t offset_in_vmobject, const StringView& name, u8 access, bool cacheable) { auto region = make<Region>(range, move(vmobject), offset_in_vmobject, name, access, cacheable); @@ -196,13 +179,6 @@ NonnullOwnPtr<Region> Region::create_kernel_only(const Range& range, NonnullRefP return region; } -NonnullOwnPtr<Region> Region::create_kernel_only(const Range& range, const StringView& name, u8 access, bool cacheable) -{ - auto region = make<Region>(range, name, access, cacheable); - region->m_user_accessible = false; - return region; -} - bool Region::should_cow(size_t page_index) const { auto& slot = vmobject().physical_pages()[page_index]; diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 60f2cd4d8b..075079c7bd 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -55,9 +55,7 @@ public: Execute = 4, }; - 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_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(); @@ -160,7 +158,6 @@ public: Region* m_prev { nullptr }; // NOTE: These are public so we can make<> them. - 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); private: |