diff options
Diffstat (limited to 'arch/alpha/alpha_memory.cc')
-rw-r--r-- | arch/alpha/alpha_memory.cc | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/arch/alpha/alpha_memory.cc b/arch/alpha/alpha_memory.cc index 81a1902a0..8f6d7a51a 100644 --- a/arch/alpha/alpha_memory.cc +++ b/arch/alpha/alpha_memory.cc @@ -68,24 +68,27 @@ AlphaTLB::~AlphaTLB() AlphaISA::PTE * AlphaTLB::lookup(Addr vpn, uint8_t asn) const { - DPRINTF(TLB, "lookup %#x, asn %#x\n", vpn, (int)asn); + // assume not found... + AlphaISA::PTE *retval = NULL; PageTable::const_iterator i = lookupTable.find(vpn); - if (i == lookupTable.end()) - return NULL; - - while (i->first == vpn) { - int index = i->second; - AlphaISA::PTE *pte = &table[index]; - assert(pte->valid); - if (vpn == pte->tag && (pte->asma || pte->asn == asn)) - return pte; + if (i != lookupTable.end()) { + while (i->first == vpn) { + int index = i->second; + AlphaISA::PTE *pte = &table[index]; + assert(pte->valid); + if (vpn == pte->tag && (pte->asma || pte->asn == asn)) { + retval = pte; + break; + } - ++i; + ++i; + } } - // not found... - return NULL; + DPRINTF(TLB, "lookup %#x, asn %#x -> %s ppn %#x\n", vpn, (int)asn, + retval ? "hit" : "miss", retval ? retval->ppn : 0); + return retval; } @@ -501,6 +504,8 @@ AlphaDTB::translate(MemReqPtr &req, bool write) const */ if (req->vaddr & (req->size - 1)) { fault(req, write ? MM_STAT_WR_MASK : 0); + DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->vaddr, + req->size); return Alignment_Fault; } |