SPARC: Make sure unaligned access are caught on cached translations as well.

--HG--
extra : convert_revision : 5c1f3f585817a19a771164f809dfc2fdc1ab3fb2
This commit is contained in:
Gabe Black 2007-08-26 20:15:29 -07:00
parent 20e0a3792a
commit f738afb865

View file

@ -569,6 +569,7 @@ DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
asi = (ASI)req->getAsi(); asi = (ASI)req->getAsi();
bool implicit = false; bool implicit = false;
bool hpriv = bits(tlbdata,0,0); bool hpriv = bits(tlbdata,0,0);
bool unaligned = (vaddr & size-1);
DPRINTF(TLB, "TLB: DTB Request to translate va=%#x size=%d asi=%#x\n", DPRINTF(TLB, "TLB: DTB Request to translate va=%#x size=%d asi=%#x\n",
vaddr, size, asi); vaddr, size, asi);
@ -579,6 +580,9 @@ DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
if (asi == ASI_IMPLICIT) if (asi == ASI_IMPLICIT)
implicit = true; implicit = true;
// Only use the fast path here if there doesn't need to be an unaligned
// trap later
if (!unaligned) {
if (hpriv && implicit) { if (hpriv && implicit) {
req->setPaddr(vaddr & PAddrImplMask); req->setPaddr(vaddr & PAddrImplMask);
return NoFault; return NoFault;
@ -616,6 +620,7 @@ DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
} // if matched } // if matched
} // if cache entry valid } // if cache entry valid
} }
}
bool red = bits(tlbdata,1,1); bool red = bits(tlbdata,1,1);
bool priv = bits(tlbdata,2,2); bool priv = bits(tlbdata,2,2);
@ -707,7 +712,7 @@ DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
} }
// If the asi is unaligned trap // If the asi is unaligned trap
if (vaddr & size-1) { if (unaligned) {
writeSfsr(vaddr, false, ct, false, OtherFault, asi); writeSfsr(vaddr, false, ct, false, OtherFault, asi);
return new MemAddressNotAligned; return new MemAddressNotAligned;
} }