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

#include <AsidManager.h>

+ Collaboration diagram for AsidManager:

Public Types

typedef uint8_t Asid
 

Public Member Functions

Asid obtainAsid ()
 
void returnAsid (Asid asid)
 
void bulldoze (Asid asid)
 

Static Public Member Functions

static AsidManagerinstance ()
 

Private Member Functions

 AsidManager ()
 
 ~AsidManager ()
 

Private Attributes

uint32_t m_Asids [NUM_ASID]
 
Mutex m_Mutex
 

Static Private Attributes

static AsidManager m_Instance
 

Detailed Description

MIPS TLB entries are marked with an ASID - an address space identifier. There are only 256 of these available (on the R4000) so they have to be managed in some way.

We have the policy that all processes in the "Ready" or "Running" state have ASIDs assigned. When a thread goes to sleep it must relinquish its ASID.

There is a use case where we have >256 running processes - This is handled by every process calling our function 'bulldoze' just before it is scheduled. Normally 'bulldoze' will do nothing, but in the case where there is contention for its ASID the entire TLB will be flushed of any entry containing that ASID.

Definition at line 44 of file AsidManager.h.

Member Typedef Documentation

typedef uint8_t AsidManager::Asid

ASID typedef

Definition at line 48 of file AsidManager.h.

Constructor & Destructor Documentation

AsidManager::AsidManager ( )
private

Default constructor

Definition at line 31 of file AsidManager.cc.

AsidManager::~AsidManager ( )
private

Destructor - not implemented.

Definition at line 35 of file AsidManager.cc.

Member Function Documentation

void AsidManager::bulldoze ( AsidManager::Asid  asid)

If the ASID given is contended, flush the TLB of all references to it.

Definition at line 87 of file AsidManager.cc.

Referenced by obtainAsid().

+ Here is the caller graph for this function:

AsidManager & AsidManager::instance ( )
static

Gets the instance of the AsidManager

Definition at line 26 of file AsidManager.cc.

References m_Instance.

AsidManager::Asid AsidManager::obtainAsid ( )

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

Definition at line 39 of file AsidManager.cc.

References Semaphore::acquire(), bulldoze(), m_Asids, m_Mutex, panic(), and Semaphore::release().

void AsidManager::returnAsid ( AsidManager::Asid  asid)

Takes an ASID. The given ASID is returned to the pool of usable ASIDs.

Definition at line 75 of file AsidManager.cc.

References Semaphore::acquire(), ERROR, m_Asids, m_Mutex, and Semaphore::release().

Member Data Documentation

uint32_t AsidManager::m_Asids[NUM_ASID]
private

The array of ASID to instance count.

Definition at line 70 of file AsidManager.h.

Referenced by obtainAsid(), and returnAsid().

AsidManager AsidManager::m_Instance
staticprivate

The static AsidManager instance - singleton class.

Definition at line 76 of file AsidManager.h.

Referenced by instance().

Mutex AsidManager::m_Mutex
private

Our lock, to protect the integrity of our data.

Definition at line 73 of file AsidManager.h.

Referenced by obtainAsid(), and returnAsid().


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