The Pedigree Project
0.1
|
#include <RangeList.h>
Classes | |
struct | Range |
Public Member Functions | |
RangeList () | |
RangeList (bool preferUsed) | |
RangeList (T Address, T Length, bool XXX, bool preferUsed=false) | |
~RangeList () | |
RangeList (const RangeList &) | |
RangeList & | operator= (const RangeList &l) |
void | free (T address, T length, bool merge=true) |
bool | allocate (T length, T &address) |
bool | allocateSpecific (T address, T length) |
void | clear () |
size_t | size () const |
Range | getRange (size_t index) const |
void | sweep () |
void | dump (void(*emit_line)(const char *s)) const |
Private Attributes | |
decltype(m_List) typedef::Iterator | Iterator |
decltype(m_List) typedef::ConstIterator | ConstIterator |
decltype(m_List) typedef::ReverseIterator | ReverseIterator |
decltype(m_List) typedef::ConstReverseIterator | ConstReverseIterator |
Vector< Range * > | m_List |
bool | m_bPreferUsed |
This class manages a List of ranges. It automatically merges adjacent entries in the list.
[in] | T | the integer type the range address and length is encoded in |
Definition at line 35 of file RangeList.h.
Default constructor does nothing
Definition at line 39 of file RangeList.h.
|
inline |
Construct with reverse order, without an initial allocation.
Definition at line 43 of file RangeList.h.
|
inline |
Construct with a preexisting range
[in] | Address | beginning of the range |
[in] | Length | length of the range |
Definition at line 49 of file RangeList.h.
Destructor frees the list
Definition at line 357 of file RangeList.h.
References Vector< T >::clear(), and Vector< T >::count().
RangeList< T, Reversed >::RangeList | ( | const RangeList< T, Reversed > & | other | ) |
Copy constructor - performs deep copy.
Definition at line 132 of file RangeList.h.
References RangeList< T, Reversed >::m_List, and Vector< T >::pushBack().
bool RangeList< T, Reversed >::allocate | ( | T | length, |
T & | address | ||
) |
Allocate a range of a specific size
[in] | length | the requested length |
[in,out] | address | the beginning address of the allocated range |
Definition at line 222 of file RangeList.h.
References Vector< T >::begin(), Vector< T >::end(), and Vector< T >::erase().
Referenced by Elf::allocate(), Thread::getTlsBase(), and MemoryMapManager::sanitiseAddress().
bool RangeList< T, Reversed >::allocateSpecific | ( | T | address, |
T | length | ||
) |
Allocate a range of specific size and beginning address
[in] | address | the beginning address |
[in] | length | the length |
Definition at line 280 of file RangeList.h.
References Vector< T >::begin(), Vector< T >::end(), Vector< T >::erase(), and Vector< T >::pushBack().
Referenced by IoPortManager::allocate(), Elf::allocate(), MemoryMapManager::sanitiseAddress(), and PpcCommonPhysicalMemoryManager::~PpcCommonPhysicalMemoryManager().
void RangeList< T, Reversed >::dump | ( | void(*)(const char *s) | emit_line | ) | const |
Render the RangeList, emitting each range using the given callback.
Definition at line 413 of file RangeList.h.
References RangeList< T, Reversed >::Range::address, Vector< T >::count(), and RangeList< T, Reversed >::Range::length.
void RangeList< T, Reversed >::free | ( | T | address, |
T | length, | ||
bool | merge = true |
||
) |
Free a range
[in] | address | beginning address of the range |
[in] | length | length of the range |
[in] | merge | set to force creation of a new range rather than merging with an existing one |
Definition at line 163 of file RangeList.h.
References Vector< T >::begin(), Vector< T >::end(), Vector< T >::pushBack(), and Vector< T >::pushFront().
Referenced by IoPortManager::free(), IoPortManager::initialise(), PosixSubsystem::invoke(), KernelElf::loadModule(), Process::Process(), KernelElf::unloadModule(), PpcCommonPhysicalMemoryManager::unmapRegion(), HostedPhysicalMemoryManager::unmapRegion(), X86CommonPhysicalMemoryManager::unmapRegion(), PpcCommonPhysicalMemoryManager::~PpcCommonPhysicalMemoryManager(), and Thread::~Thread().
RangeList< T, Reversed >::Range RangeList< T, Reversed >::getRange | ( | size_t | index | ) | const |
Get a range at a specific index
Definition at line 348 of file RangeList.h.
References Vector< T >::size().
|
inline |
Get the number of ranges in the list
Definition at line 101 of file RangeList.h.
void RangeList< T, Reversed >::sweep | ( | ) |
Sweep the RangeList and re-merge items.
Definition at line 373 of file RangeList.h.
References RangeList< T, Reversed >::Range::address, Vector< T >::count(), Vector< T >::erase(), and RangeList< T, Reversed >::Range::length.
|
private |
Should we prefer previously-used ranges where possible?
Definition at line 119 of file RangeList.h.
|
private |
List of ranges
Definition at line 116 of file RangeList.h.
Referenced by RangeList< T, Reversed >::RangeList().