Finish address_manager to vm_space transition
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
/// \file avl_tree.h
|
||||
/// Templated container class for an AVL tree
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdint.h>
|
||||
#include "kutil/assert.h"
|
||||
|
||||
@@ -220,6 +221,14 @@ public:
|
||||
using item_type = T;
|
||||
using node_type = avl_node<T>;
|
||||
|
||||
avl_tree() = default;
|
||||
avl_tree(avl_tree &&other) :
|
||||
m_count(other.m_count), m_root(other.m_root)
|
||||
{
|
||||
other.m_root = nullptr;
|
||||
other.m_count = 0;
|
||||
}
|
||||
|
||||
inline node_type * root() { return m_root; }
|
||||
inline unsigned count() const { return m_count; }
|
||||
|
||||
@@ -235,7 +244,7 @@ public:
|
||||
|
||||
private:
|
||||
unsigned m_count {0};
|
||||
node_type *m_root;
|
||||
node_type *m_root {nullptr};
|
||||
};
|
||||
|
||||
} // namespace kutil
|
||||
|
||||
@@ -29,9 +29,17 @@ struct vm_range
|
||||
}
|
||||
};
|
||||
|
||||
/// Tracks a region of virtual memory address space
|
||||
class vm_space
|
||||
{
|
||||
public:
|
||||
/// Default constructor. Define an empty range.
|
||||
vm_space();
|
||||
|
||||
/// Constructor. Define a range of managed VM space.
|
||||
/// \arg start Starting address of the managed space
|
||||
/// \arg size Size of the managed space, in bytes
|
||||
/// \arg alloc Allocator to use for tracking objects
|
||||
vm_space(uintptr_t start, size_t size, kutil::allocator &alloc);
|
||||
|
||||
/// Reserve a section of address space.
|
||||
|
||||
@@ -22,6 +22,12 @@ vm_space::vm_space(uintptr_t start, size_t size, allocator &alloc) :
|
||||
start, start+size);
|
||||
}
|
||||
|
||||
vm_space::vm_space() :
|
||||
m_slab(allocator::invalid),
|
||||
m_alloc(allocator::invalid)
|
||||
{
|
||||
}
|
||||
|
||||
inline static bool
|
||||
overlaps(node_type *node, uintptr_t start, size_t size)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user