43#include "debug/MipsPRA.hh"
44#include "debug/TLB.hh"
46#include "params/MipsTLB.hh"
61 table =
new PTE[size];
62 memset(table, 0,
sizeof(PTE) * size);
79 while (
i->first == vpn) {
87 if (((vpn & InvMask) == (VPN & InvMask)) &&
88 (pte->
G || (asn == pte->
asid))) {
97 DPRINTF(
TLB,
"lookup %#x, asn %#x -> %s ppn %#x\n", vpn, (
int)asn,
98 retval ?
"hit" :
"miss", retval ? retval->
PFN1 : 0);
107 return &table[Index];
115 PageTable::const_iterator
i = lookupTable.find(vpn);
116 if (
i != lookupTable.end()) {
117 while (
i->first == vpn) {
122 Addr Mask = pte->Mask;
123 Addr InvMask = ~Mask;
125 if (((vpn & InvMask) == (VPN & InvMask)) &&
126 (pte->G || (asn == pte->asid))) {
134 DPRINTF(MipsPRA,
"VPN: %x, asid: %d, Result of TLBP: %d\n",vpn,asn,Ind);
141 Addr VAddrUncacheable = 0xA0000000;
144 if ((req->getVaddr() & VAddrUncacheable) == VAddrUncacheable) {
154 smallPages = _smallPages;
156 warn(
"Attempted to write at index (%d) beyond TLB size (%d)",
161 Index, pte.
Mask << 11,
163 ((pte.
PFN0 << 6) | (pte.
C0 << 3) |
164 (pte.
D0 << 2) | (pte.
V0 <<1) | pte.
G),
165 ((pte.
PFN1 <<6) | (pte.
C1 << 3) |
166 (pte.
D1 << 2) | (pte.
V1 <<1) | pte.
G));
167 if (table[Index].V0 || table[Index].V1) {
169 PageTable::iterator
i = lookupTable.find(table[Index].VPN);
170 lookupTable.erase(
i);
174 lookupTable.insert(std::make_pair(table[Index].VPN, Index));
180TLB::insert(Addr addr, PTE &pte)
182 fatal(
"TLB Insert not yet implemented\n");
189 memset(table, 0,
sizeof(PTE) * size);
200 for (
int i = 0;
i <
size;
i++) {
202 table[
i].serialize(
cp);
212 for (
int i = 0;
i <
size;
i++) {
214 table[
i].unserialize(
cp);
215 if (table[
i].V0 || table[
i].V1) {
216 lookupTable.insert(std::make_pair(table[
i].VPN,
i));
234 translation->
finish(translateAtomic(req, tc,
mode), req, tc,
mode);
void translateTiming(const RequestPtr &req, ThreadContext *tc, BaseMMU::Translation *translation, BaseMMU::Mode mode) override
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)=0
bool translate(Addr vaddr, Addr &paddr)
Translate function.
int probeEntry(Addr vpn, uint8_t) const
PowerISA::PTE & index(bool advance=true)
void insertAt(PowerISA::PTE &pte, unsigned Index, int _smallPages)
PowerISA::PTE * lookup(Addr vpn, uint8_t asn) const
PowerISA::PTE * getEntry(unsigned) const
static Fault checkCacheability(const RequestPtr &req)
EmulationPageTable * pTable
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
@ UNCACHEABLE
The request is to an uncacheable address.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual Process * getProcessPtr()=0
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) const override
Do post-translation physical address finalization.
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Declaration of IniFile object.
Copyright (c) 2024 Arm Limited All rights reserved.
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
std::string csprintf(const char *format, const Args &...args)
constexpr decltype(nullptr) NoFault
Declarations of a non-full system Page Table.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)