From: Gabe Black Date: Tue, 29 May 2012 04:56:23 +0000 (-0700) Subject: X86: Use the HandyM5Reg to avoid a register read and some logic in the TLB. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d9988ded3c0857b3bfef656109ab1e33ff068e16;p=gem5.git X86: Use the HandyM5Reg to avoid a register read and some logic in the TLB. --- diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index eb6e9c530..4923752ef 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -269,15 +269,10 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, } Addr base = tc->readMiscRegNoEffect(MISCREG_SEG_BASE(seg)); Addr limit = tc->readMiscRegNoEffect(MISCREG_SEG_LIMIT(seg)); - // This assumes we're not in 64 bit mode. If we were, the default - // address size is 64 bits, overridable to 32. - int size = 32; bool sizeOverride = (flags & (AddrSizeFlagBit << FlagShift)); - SegAttr csAttr = tc->readMiscRegNoEffect(MISCREG_CS_ATTR); - if ((csAttr.defaultSize && sizeOverride) || - (!csAttr.defaultSize && !sizeOverride)) - size = 16; - Addr offset = bits(vaddr - base, size-1, 0); + int logSize = sizeOverride ? m5Reg.altAddr : m5Reg.defAddr; + int size = (1 << logSize) * 8; + Addr offset = bits(vaddr - base, size - 1, 0); Addr endOffset = offset + req->getSize() - 1; if (expandDown) { DPRINTF(TLB, "Checking an expand down segment.\n");