The Pedigree Project  0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
VsidManager Class Reference

#include <VsidManager.h>

+ Collaboration diagram for VsidManager:

Classes

struct  VsidStack
 

Public Types

typedef uint32_t Vsid
 

Public Member Functions

Vsid obtainVsid ()
 
void returnVsid (Vsid vsid)
 

Static Public Member Functions

static VsidManagerinstance ()
 

Private Member Functions

 VsidManager (const VsidManager &)
 
VsidManageroperator= (const VsidManager &)
 
 VsidManager ()
 
 ~VsidManager ()
 

Private Attributes

Vsid m_HighWaterMark
 
VsidStackm_pStack
 
Mutex m_Mutex
 

Static Private Attributes

static VsidManager m_Instance
 

Detailed Description

PPC has too many possible VSID's to do the same thing as MIPS' ASIDs, so we have to box a little more cleverly.

We have a pointer marking the 'high water mark' of the VSID's already allocated. We also have a stack of VSIDs - when a VSID is released it is pushed onto this stack to be reallocated. If the VSID released == the high water mark, we don't push it and just decrement the high water mark instead.

When a VSID is required, we try and pop one off the stack first. If the stack is empty, we increment the high water mark and return that.

Definition at line 41 of file VsidManager.h.

Member Typedef Documentation

typedef uint32_t VsidManager::Vsid

VSID typedef

Definition at line 45 of file VsidManager.h.

Constructor & Destructor Documentation

VsidManager::VsidManager ( )
private

Default constructor

Definition at line 30 of file VsidManager.cc.

VsidManager::~VsidManager ( )
private

Destructor - not implemented.

Definition at line 34 of file VsidManager.cc.

Member Function Documentation

VsidManager & VsidManager::instance ( )
static

Gets the instance of the VsidManager

Definition at line 25 of file VsidManager.cc.

References m_Instance.

Referenced by PPC32VirtualAddressSpace::PPC32VirtualAddressSpace(), and PPC32VirtualAddressSpace::~PPC32VirtualAddressSpace().

+ Here is the caller graph for this function:

VsidManager::Vsid VsidManager::obtainVsid ( )

Returns an VSID. The TLB is flushed of all references to that ASID.

Todo:
Locking

Definition at line 38 of file VsidManager.cc.

References m_HighWaterMark, m_pStack, and NOTICE.

Referenced by PPC32VirtualAddressSpace::PPC32VirtualAddressSpace().

+ Here is the caller graph for this function:

void VsidManager::returnVsid ( VsidManager::Vsid  vsid)

Takes an VSID. The given VSID is returned to the pool of usable VSIDs.

Todo:
Locking
Todo:
decrement high water mark if possible

Definition at line 58 of file VsidManager.cc.

Referenced by PPC32VirtualAddressSpace::~PPC32VirtualAddressSpace().

+ Here is the caller graph for this function:

Member Data Documentation

Vsid VsidManager::m_HighWaterMark
private

Our 'high water mark'

Definition at line 72 of file VsidManager.h.

Referenced by obtainVsid().

VsidManager VsidManager::m_Instance
staticprivate

The static VsidManager instance - singleton class.

Definition at line 81 of file VsidManager.h.

Referenced by instance().

Mutex VsidManager::m_Mutex
private

Our lock, to protect the integrity of our data.

Definition at line 78 of file VsidManager.h.

VsidStack* VsidManager::m_pStack
private

Our stack of useable VSIDs

Definition at line 75 of file VsidManager.h.

Referenced by obtainVsid().


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