*/
#include "arch/sparc/asi.hh"
-#include "arch/sparc/tlb.hh"
-#include "sim/builder.hh"
#include "arch/sparc/miscregfile.hh"
+#include "arch/sparc/tlb.hh"
+#include "base/trace.hh"
#include "cpu/thread_context.hh"
+#include "sim/builder.hh"
/* @todo remove some of the magic constants. -- ali
* */
MapIter i;
TlbEntry *new_entry;
+
+ DPRINTF(TLB, "TLB: Inserting TLB Entry; va=%#x, pid=%d cid=%d r=%d\n",
+ va, partition_id, context_id, (int)real);
+
int x = -1;
for (x = 0; x < size; x++) {
if (!tlb[x].valid || !tlb[x].used) {
i->second->used = false;
usedEntries--;
}
+ DPRINTF(TLB, "TLB: Found conflicting entry, deleting it\n");
lookupTable.erase(i);
}
TlbRange tr;
TlbEntry *t;
+ DPRINTF(TLB, "TLB: Looking up entry va=%#x pid=%d cid=%d r=%d\n",
+ va, partition_id, context_id, real);
// Assemble full address structure
tr.va = va;
tr.size = va + MachineBytes;
// Try to find the entry
i = lookupTable.find(tr);
if (i == lookupTable.end()) {
+ DPRINTF(TLB, "TLB: No valid entry found\n");
return NULL;
}
+ DPRINTF(TLB, "TLB: Valid entry found\n");
// Mark the entries used bit and clear other used bits in needed
t = i->second;
ITB::writeSfsr(ThreadContext *tc, bool write, ContextType ct,
bool se, FaultTypes ft, int asi)
{
+ DPRINTF(TLB, "TLB: ITB Fault: w=%d ct=%d ft=%d asi=%d\n",
+ (int)write, ct, ft, asi);
TLB::writeSfsr(tc, MISCREG_MMU_ITLB_SFSR, write, ct, se, ft, asi);
}
DTB::writeSfr(ThreadContext *tc, Addr a, bool write, ContextType ct,
bool se, FaultTypes ft, int asi)
{
+ DPRINTF(TLB, "TLB: DTB Fault: A=%#x w=%d ct=%d ft=%d asi=%d\n",
+ a, (int)write, ct, ft, asi);
TLB::writeSfsr(tc, MISCREG_MMU_DTLB_SFSR, write, ct, se, ft, asi);
tc->setMiscReg(MISCREG_MMU_DTLB_SFAR, a);
}
bool real = false;
TlbEntry *e;
+ DPRINTF(TLB, "TLB: ITB Request to translate va=%#x size=%d\n",
+ vaddr, req->getSize());
+
assert(req->getAsi() == ASI_IMPLICIT);
if (tl > 0) {
bool implicit = false;
bool real = false;
Addr vaddr = req->getVaddr();
+ Addr size = req->getSize();
ContextType ct;
int context;
ASI asi;
TlbEntry *e;
-
asi = (ASI)req->getAsi();
+ DPRINTF(TLB, "TLB: DTB Request to translate va=%#x size=%d asi=%#x\n",
+ vaddr, size, asi);
+
if (asi == ASI_IMPLICIT)
implicit = true;
}
// If the asi is unaligned trap
- if (AsiIsBlock(asi) && vaddr & 0x3f || vaddr & 0x7) {
+ if (vaddr & size-1) {
writeSfr(tc, vaddr, false, ct, false, OtherFault, asi);
return new MemAddressNotAligned;
}
if (e == NULL || !e->valid) {
tc->setMiscReg(MISCREG_MMU_DTLB_TAG_ACCESS,
vaddr & ~BytesInPageMask | context);
+ DPRINTF(TLB, "TLB: DTB Failed to find matching TLB entry\n");
if (real)
return new DataRealTranslationMiss;
else
return new DataAccessException;
}
handleMmuRegAccess:
+ DPRINTF(TLB, "TLB: DTB Translating MM IPR access\n");
req->setMmapedIpr(true);
req->setPaddr(req->getVaddr());
return NoFault;