diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-30 16:14:37 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-30 16:14:37 +0200 |
commit | baaede1bf9e8c4180f0c2aed251645e69dfea6bf (patch) | |
tree | b6697c7234f328e0437869e8ecb83d675afb2d48 /Kernel/VM/Region.cpp | |
parent | 8fe72d7b3cfadb66bda77d295fbe178667190444 (diff) | |
download | serenity-baaede1bf9e8c4180f0c2aed251645e69dfea6bf.zip |
Kernel: Make the Process allocate_region* API's understand "int prot".
Instead of having to inspect 'prot' at every call site, make the Process
API's take care of that so we can just pass it through.
Diffstat (limited to 'Kernel/VM/Region.cpp')
-rw-r--r-- | Kernel/VM/Region.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index e1cd53dbdc..3c93cfff7c 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -4,36 +4,33 @@ #include <Kernel/Process.h> #include <Kernel/Thread.h> -Region::Region(const Range& range, String&& n, bool r, bool w, bool cow) +Region::Region(const Range& range, String&& n, byte access, bool cow) : m_range(range) , m_vmo(VMObject::create_anonymous(size())) , m_name(move(n)) - , m_readable(r) - , m_writable(w) + , m_access(access) , m_cow_map(Bitmap::create(m_vmo->page_count(), cow)) { m_vmo->set_name(m_name); MM.register_region(*this); } -Region::Region(const Range& range, RetainPtr<Inode>&& inode, String&& n, bool r, bool w) +Region::Region(const Range& range, RetainPtr<Inode>&& inode, String&& n, byte access) : m_range(range) , m_vmo(VMObject::create_file_backed(move(inode))) , m_name(move(n)) - , m_readable(r) - , m_writable(w) + , m_access(access) , m_cow_map(Bitmap::create(m_vmo->page_count())) { MM.register_region(*this); } -Region::Region(const Range& range, Retained<VMObject>&& vmo, size_t offset_in_vmo, String&& n, bool r, bool w, bool cow) +Region::Region(const Range& range, Retained<VMObject>&& vmo, size_t offset_in_vmo, String&& n, byte access, bool cow) : m_range(range) , m_offset_in_vmo(offset_in_vmo) , m_vmo(move(vmo)) , m_name(move(n)) - , m_readable(r) - , m_writable(w) + , m_access(access) , m_cow_map(Bitmap::create(m_vmo->page_count(), cow)) { MM.register_region(*this); @@ -71,7 +68,7 @@ bool Region::page_in() Retained<Region> Region::clone() { ASSERT(current); - if (m_shared || (m_readable && !m_writable)) { + if (m_shared || (is_readable() && !is_writable())) { #ifdef MM_DEBUG dbgprintf("%s<%u> Region::clone(): sharing %s (L%x)\n", current->process().name().characters(), @@ -80,7 +77,7 @@ Retained<Region> Region::clone() laddr().get()); #endif // Create a new region backed by the same VMObject. - return adopt(*new Region(m_range, m_vmo.copy_ref(), m_offset_in_vmo, String(m_name), m_readable, m_writable)); + return adopt(*new Region(m_range, m_vmo.copy_ref(), m_offset_in_vmo, String(m_name), m_access)); } #ifdef MM_DEBUG @@ -93,7 +90,7 @@ Retained<Region> Region::clone() // Set up a COW region. The parent (this) region becomes COW as well! m_cow_map.fill(true); MM.remap_region(current->process().page_directory(), *this); - return adopt(*new Region(m_range, m_vmo->clone(), m_offset_in_vmo, String(m_name), m_readable, m_writable, true)); + return adopt(*new Region(m_range, m_vmo->clone(), m_offset_in_vmo, String(m_name), m_access, true)); } int Region::commit() |