The Pedigree Project
0.1
|
#include <HashedPageTable.h>
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 HashedPageTable & | instance () |
Private Member Functions | |
HashedPageTable (const HashedPageTable &) | |
HashedPageTable & | operator= (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 | |
PTEG * | m_pHtab |
uint32_t | m_Size |
uint32_t | m_Mask |
Static Private Attributes | |
static HashedPageTable | m_Instance |
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.
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'.
effectiveAddress | The EA (virtual address) to map. |
physicalAddress | The physical address to map to. |
mode | The mode of the mapping - in VirtualAddressSpace form (VirtualAddressSpace::WriteThrough etc) |
vsid | The virtual space identifier. |
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().
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 | ||
) |
Initialises the page table.
Definition at line 63 of file HashedPageTable.cc.
References Translations::addTranslation(), VirtualAddressSpace::CacheDisable, Translations::findFreePhysicalMemory(), Translations::getNumTranslations(), Translations::getTranslation(), VirtualAddressSpace::Guarded, PPC32InterruptManager::initialiseProcessor(), OpenFirmware::instance(), HTABSize::mask, VirtualAddressSpace::MemoryCoherent, HTABSize::memorySize, panic(), HTABSize::size, VirtualAddressSpace::Write, and VirtualAddressSpace::WriteThrough.
|
static |
Obtains the singleton instance of the HashedPageTable.
Definition at line 50 of file HashedPageTable.cc.
Referenced by PPC32VirtualAddressSpace::map(), and PPC32VirtualAddressSpace::unmap().
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().
|
private |
Set a DBAT entry
Definition at line 482 of file HashedPageTable.cc.
References VirtualAddressSpace::KernelMode, and panic().
|
private |
Sets an IBAT entry
Definition at line 394 of file HashedPageTable.cc.
References VirtualAddressSpace::KernelMode, and panic().
|
staticprivate |
The singleton instance.
Definition at line 135 of file HashedPageTable.h.
|
private |
The mask to use during hashing.
Definition at line 132 of file HashedPageTable.h.
|
private |
Pointer to the HTAB.
Definition at line 126 of file HashedPageTable.h.
|
private |
The size of the HTAB.
Definition at line 129 of file HashedPageTable.h.