diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-24 18:09:46 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-24 18:09:46 +0100 |
commit | aa24547e12228633addd5220d4aad55f7754392e (patch) | |
tree | d3b1946564934b54ea7ab509e596d0a9314b9bcd /Kernel/MemoryManager.h | |
parent | e683f611f19eb1b32bb68c553efc370f9cadc19d (diff) | |
download | serenity-aa24547e12228633addd5220d4aad55f7754392e.zip |
Kernel: Finally stop exposing Region members to the public.
Diffstat (limited to 'Kernel/MemoryManager.h')
-rw-r--r-- | Kernel/MemoryManager.h | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h index 4aa2741064..9b01df68d2 100644 --- a/Kernel/MemoryManager.h +++ b/Kernel/MemoryManager.h @@ -111,12 +111,21 @@ private: }; class Region : public Retainable<Region> { + friend class MemoryManager; public: Region(LinearAddress, size_t, String&&, bool r, bool w, bool cow = false); Region(LinearAddress, size_t, RetainPtr<VMObject>&&, size_t offset_in_vmo, String&&, bool r, bool w, bool cow = false); Region(LinearAddress, size_t, RetainPtr<Inode>&&, String&&, bool r, bool w); ~Region(); + LinearAddress laddr() const { return m_laddr; } + size_t size() const { return m_size; } + bool is_readable() const { return m_readable; } + bool is_writable() const { return m_writable; } + String name() const { return m_name; } + + void set_name(String&& name) { m_name = move(name); } + const VMObject& vmo() const { return *m_vmo; } VMObject& vmo() { return *m_vmo; } @@ -125,12 +134,12 @@ public: RetainPtr<Region> clone(); bool contains(LinearAddress laddr) const { - return laddr >= linearAddress && laddr < linearAddress.offset(size); + return laddr >= m_laddr && laddr < m_laddr.offset(size()); } unsigned page_index_from_address(LinearAddress laddr) const { - return (laddr - linearAddress).get() / PAGE_SIZE; + return (laddr - m_laddr).get() / PAGE_SIZE; } size_t first_page_index() const @@ -145,7 +154,7 @@ public: size_t page_count() const { - return size / PAGE_SIZE; + return m_size / PAGE_SIZE; } bool page_in(); @@ -153,16 +162,33 @@ public: size_t committed() const; + PageDirectory* page_directory() { return m_page_directory.ptr(); } + + void set_page_directory(PageDirectory& page_directory) + { + ASSERT(!m_page_directory || m_page_directory.ptr() == &page_directory); + m_page_directory = page_directory; + } + + void release_page_directory() + { + ASSERT(m_page_directory); + m_page_directory.clear(); + } + + const Bitmap& cow_map() const { return m_cow_map; } + +private: RetainPtr<PageDirectory> m_page_directory; - LinearAddress linearAddress; - size_t size { 0 }; + LinearAddress m_laddr; + size_t m_size { 0 }; size_t m_offset_in_vmo { 0 }; RetainPtr<VMObject> m_vmo; - String name; - bool is_readable { true }; - bool is_writable { true }; + String m_name; + bool m_readable { true }; + bool m_writable { true }; bool m_shared { false }; - Bitmap cow_map; + Bitmap m_cow_map; }; #define MM MemoryManager::the() |