mem-cache: Add multiple eviction stats
[gem5.git] / src / arch / x86 / vtophys.cc
index e4abfca59302cc12d5b46dda79ee2da1ddcc9381..d0287f2ce7d46270c2ddf01ae8a81cae76a99f02 100644 (file)
  * Authors: Gabe Black
  */
 
+#include "arch/x86/vtophys.hh"
+
 #include <string>
 
 #include "arch/x86/pagetable_walker.hh"
 #include "arch/x86/tlb.hh"
-#include "arch/x86/vtophys.hh"
 #include "base/trace.hh"
 #include "cpu/thread_context.hh"
 #include "debug/VtoPhys.hh"
-#include "sim/fault_fwd.hh"
 
 using namespace std;
 
@@ -60,13 +60,14 @@ namespace X86ISA
     Addr
     vtophys(ThreadContext *tc, Addr vaddr)
     {
-        Walker *walker = tc->getDTBPtr()->getWalker();
-        Addr size;
+        Walker *walker = dynamic_cast<TLB *>(tc->getDTBPtr())->getWalker();
+        unsigned logBytes;
         Addr addr = vaddr;
-        Fault fault = walker->startFunctional(tc, addr, size, BaseTLB::Read);
+        Fault fault = walker->startFunctional(
+                tc, addr, logBytes, BaseTLB::Read);
         if (fault != NoFault)
             panic("vtophys page walk returned fault\n");
-        Addr masked_addr = vaddr & (size - 1);
+        Addr masked_addr = vaddr & mask(logBytes);
         Addr paddr = addr | masked_addr;
         DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
         return paddr;