arm: Clean up and document decoder API
[gem5.git] / src / arch / x86 / vtophys.cc
index 3a69325640dff4e10e65fb9b4020c92a80eb0f15..4bbeb7119a77a3590f5373f98b2c892389624416 100644 (file)
@@ -43,9 +43,8 @@
 #include "arch/x86/tlb.hh"
 #include "arch/x86/vtophys.hh"
 #include "base/trace.hh"
-#include "config/full_system.hh"
 #include "cpu/thread_context.hh"
-#include "sim/fault.hh"
+#include "debug/VtoPhys.hh"
 
 using namespace std;
 
@@ -54,27 +53,22 @@ namespace X86ISA
     Addr
     vtophys(Addr vaddr)
     {
-#if FULL_SYSTEM
         panic("Need access to page tables\n");
-#endif
-        return vaddr;
     }
 
     Addr
     vtophys(ThreadContext *tc, Addr vaddr)
     {
-#if FULL_SYSTEM
         Walker *walker = tc->getDTBPtr()->getWalker();
-        Addr size;
+        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;
-#endif
-        return vaddr;
     }
 }