From d9988ded3c0857b3bfef656109ab1e33ff068e16 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 28 May 2012 21:56:23 -0700 Subject: [PATCH] X86: Use the HandyM5Reg to avoid a register read and some logic in the TLB. --- src/arch/x86/tlb.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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"); -- 2.30.2