mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Kernel: Store AddressSpace memory regions in an IntrusiveRedBlackTree
This means we never need to allocate when inserting/removing regions from the address space.
This commit is contained in:
parent
7381474835
commit
2617adac52
7 changed files with 99 additions and 81 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/Memory/AllocationStrategy.h>
|
||||
#include <Kernel/Memory/PageDirectory.h>
|
||||
#include <Kernel/Memory/Region.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel::Memory {
|
||||
|
@ -28,8 +29,8 @@ public:
|
|||
|
||||
size_t region_count() const { return m_regions.size(); }
|
||||
|
||||
RedBlackTree<FlatPtr, NonnullOwnPtr<Region>>& regions() { return m_regions; }
|
||||
RedBlackTree<FlatPtr, NonnullOwnPtr<Region>> const& regions() const { return m_regions; }
|
||||
auto& regions() { return m_regions; }
|
||||
auto const& regions() const { return m_regions; }
|
||||
|
||||
void dump_regions();
|
||||
|
||||
|
@ -68,11 +69,13 @@ public:
|
|||
private:
|
||||
explicit AddressSpace(NonnullRefPtr<PageDirectory>);
|
||||
|
||||
void delete_all_regions_assuming_they_are_unmapped();
|
||||
|
||||
mutable RecursiveSpinlock m_lock;
|
||||
|
||||
RefPtr<PageDirectory> m_page_directory;
|
||||
|
||||
RedBlackTree<FlatPtr, NonnullOwnPtr<Region>> m_regions;
|
||||
IntrusiveRedBlackTree<&Region::m_tree_node> m_regions;
|
||||
|
||||
bool m_enforces_syscall_regions { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue