The Pedigree Project  0.1
Classes | Public Member Functions | Private Attributes | List of all members
RangeList< T, Reversed > Class Template Reference

#include <RangeList.h>

+ Inheritance diagram for RangeList< T, Reversed >:
+ Collaboration diagram for RangeList< T, Reversed >:

Classes

struct  Range
 

Public Member Functions

 RangeList ()
 
 RangeList (bool preferUsed)
 
 RangeList (T Address, T Length, bool XXX, bool preferUsed=false)
 
 ~RangeList ()
 
 RangeList (const RangeList &)
 
RangeListoperator= (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
 

Detailed Description

template<typename T, bool Reversed = false>
class RangeList< T, Reversed >

This class manages a List of ranges. It automatically merges adjacent entries in the list.

Parameters
[in]Tthe integer type the range address and length is encoded in

Definition at line 35 of file RangeList.h.

Constructor & Destructor Documentation

template<typename T, bool Reversed = false>
RangeList< T, Reversed >::RangeList ( )
inline

Default constructor does nothing

Definition at line 39 of file RangeList.h.

template<typename T, bool Reversed = false>
RangeList< T, Reversed >::RangeList ( bool  preferUsed)
inline

Construct with reverse order, without an initial allocation.

Definition at line 43 of file RangeList.h.

template<typename T, bool Reversed = false>
RangeList< T, Reversed >::RangeList ( Address,
Length,
bool  XXX,
bool  preferUsed = false 
)
inline

Construct with a preexisting range

Parameters
[in]Addressbeginning of the range
[in]Lengthlength of the range

Definition at line 49 of file RangeList.h.

template<typename T , bool Reversed>
RangeList< T, Reversed >::~RangeList ( )

Destructor frees the list

Definition at line 357 of file RangeList.h.

References Vector< T >::clear(), and Vector< T >::count().

template<typename T, bool Reversed>
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().

Member Function Documentation

template<typename T, bool Reversed>
bool RangeList< T, Reversed >::allocate ( length,
T &  address 
)

Allocate a range of a specific size

Parameters
[in]lengththe requested length
[in,out]addressthe beginning address of the allocated range
Returns
true, if successfully allocated (and address is valid), false otherwise

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().

+ Here is the caller graph for this function:

template<typename T, bool Reversed>
bool RangeList< T, Reversed >::allocateSpecific ( address,
length 
)

Allocate a range of specific size and beginning address

Parameters
[in]addressthe beginning address
[in]lengththe length
Returns
true, if successfully allocated, false otherwise

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().

+ Here is the caller graph for this function:

template<typename T , bool Reversed>
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.

template<typename T, bool Reversed>
void RangeList< T, Reversed >::free ( address,
length,
bool  merge = true 
)

Free a range

Parameters
[in]addressbeginning address of the range
[in]lengthlength of the range
[in]mergeset 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().

+ Here is the caller graph for this function:

template<typename T , bool Reversed>
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().

template<typename T, bool Reversed = false>
size_t RangeList< T, Reversed >::size ( ) const
inline

Get the number of ranges in the list

Returns
the number of ranges in the list

Definition at line 101 of file RangeList.h.

template<typename T , bool Reversed>
void RangeList< T, Reversed >::sweep ( )

Member Data Documentation

template<typename T, bool Reversed = false>
bool RangeList< T, Reversed >::m_bPreferUsed
private

Should we prefer previously-used ranges where possible?

Definition at line 119 of file RangeList.h.

template<typename T, bool Reversed = false>
Vector<Range *> RangeList< T, Reversed >::m_List
private

List of ranges

Definition at line 116 of file RangeList.h.

Referenced by RangeList< T, Reversed >::RangeList().


The documentation for this class was generated from the following file: