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

#include <HashedPageTable.h>

+ Collaboration diagram for HashedPageTable:

Classes

struct  BATL
 
struct  BATU
 
struct  PTE
 
struct  PTEG
 

Public Member Functions

void initialise (Translations &translations, uint32_t ramMax)
 
void addMapping (uint32_t effectiveAddress, uint32_t physicalAddress, uint32_t mode, uint32_t vsid)
 
void removeMapping (uint32_t effectiveAddress, uint32_t vsid)
 
bool isMapped (uint32_t effectiveAddress, uint32_t vsid)
 
uint32_t getMapping (uint32_t effectiveAddress, uint32_t vsid)
 

Static Public Member Functions

static HashedPageTableinstance ()
 

Private Member Functions

 HashedPageTable (const HashedPageTable &)
 
HashedPageTableoperator= (const HashedPageTable &)
 
void setIBAT (size_t n, uintptr_t virt, physical_uintptr_t phys, size_t size, uint32_t mode)
 
void setDBAT (size_t n, uintptr_t virt, physical_uintptr_t phys, size_t size, uint32_t mode)
 

Private Attributes

PTEGm_pHtab
 
uint32_t m_Size
 
uint32_t m_Mask
 

Static Private Attributes

static HashedPageTable m_Instance
 

Detailed Description

The PPC hashed page table that is used almost as a secondary PTE cache by the processor. It is a finite size, so not all PTEs may be able to fit in it (hence why it is used as a secondary cache of sorts.

The size is set at initialisation time, and is based on the amount of available RAM.

Definition at line 36 of file HashedPageTable.h.

Member Function Documentation

void HashedPageTable::addMapping ( uint32_t  effectiveAddress,
uint32_t  physicalAddress,
uint32_t  mode,
uint32_t  vsid 
)

Adds a page table entry mapping effectiveAddress to physicalAddress for the given VSID, with mode 'mode'.

Parameters
effectiveAddressThe EA (virtual address) to map.
physicalAddressThe physical address to map to.
modeThe mode of the mapping - in VirtualAddressSpace form (VirtualAddressSpace::WriteThrough etc)
vsidThe virtual space identifier.
Todo:
change this to random replacement.

Definition at line 168 of file HashedPageTable.cc.

References VirtualAddressSpace::CacheDisable, VirtualAddressSpace::CopyOnWrite, FATAL, VirtualAddressSpace::Guarded, Hex, VirtualAddressSpace::KernelMode, VirtualAddressSpace::MemoryCoherent, panic(), VirtualAddressSpace::Write, and VirtualAddressSpace::WriteThrough.

Referenced by PPC32VirtualAddressSpace::map().

+ Here is the caller graph for this function:

uint32_t HashedPageTable::getMapping ( uint32_t  effectiveAddress,
uint32_t  vsid 
)

Returns the mapping for effectiveAddress in VSID. If there is no such mapping, the return value is undefined.

Definition at line 356 of file HashedPageTable.cc.

void HashedPageTable::initialise ( Translations translations,
uint32_t  ramMax 
)
HashedPageTable & HashedPageTable::instance ( )
static

Obtains the singleton instance of the HashedPageTable.

Definition at line 50 of file HashedPageTable.cc.

Referenced by PPC32VirtualAddressSpace::map(), and PPC32VirtualAddressSpace::unmap().

+ Here is the caller graph for this function:

bool HashedPageTable::isMapped ( uint32_t  effectiveAddress,
uint32_t  vsid 
)

Returns true if a mapping exists for effectiveAddress in the given VSID.

Definition at line 317 of file HashedPageTable.cc.

void HashedPageTable::removeMapping ( uint32_t  effectiveAddress,
uint32_t  vsid 
)

Removes a mapping for the given effective address, in the given VSID.

Definition at line 274 of file HashedPageTable.cc.

Referenced by PPC32VirtualAddressSpace::unmap().

+ Here is the caller graph for this function:

void HashedPageTable::setDBAT ( size_t  n,
uintptr_t  virt,
physical_uintptr_t  phys,
size_t  size,
uint32_t  mode 
)
private

Set a DBAT entry

Definition at line 482 of file HashedPageTable.cc.

References VirtualAddressSpace::KernelMode, and panic().

void HashedPageTable::setIBAT ( size_t  n,
uintptr_t  virt,
physical_uintptr_t  phys,
size_t  size,
uint32_t  mode 
)
private

Sets an IBAT entry

Definition at line 394 of file HashedPageTable.cc.

References VirtualAddressSpace::KernelMode, and panic().

Member Data Documentation

HashedPageTable HashedPageTable::m_Instance
staticprivate

The singleton instance.

Definition at line 135 of file HashedPageTable.h.

uint32_t HashedPageTable::m_Mask
private

The mask to use during hashing.

Definition at line 132 of file HashedPageTable.h.

PTEG* HashedPageTable::m_pHtab
private

Pointer to the HTAB.

Definition at line 126 of file HashedPageTable.h.

uint32_t HashedPageTable::m_Size
private

The size of the HTAB.

Definition at line 129 of file HashedPageTable.h.


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