diff -r 4a15ad9d4924 -r c37e8ec58da6 src/arch/x86/vtophys.cc --- a/src/arch/x86/vtophys.cc Mon Jan 10 11:11:54 2011 -0800 +++ b/src/arch/x86/vtophys.cc Mon Jan 10 11:11:54 2011 -0800 @@ -39,7 +39,14 @@ #include +#include "arch/x86/faults.hh" +#include "arch/x86/pagetable_walker.hh" +#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/tlb.hh" using namespace std; @@ -47,11 +54,26 @@ { Addr vtophys(Addr vaddr) { +#if FULL_SYSTEM + panic("Need access to page tables\n"); +#endif return vaddr; } Addr vtophys(ThreadContext *tc, Addr addr) { +#if FULL_SYSTEM + RequestPtr req = new Request; + req->setVirt(0, addr, 0, 0, 0); + Walker *walker = tc->getDTBPtr()->getWalker(); + Fault fault = walker->startFunctional(tc, NULL, req, BaseTLB::Read); + if (fault != NoFault) + panic("vtophys page walk returned fault\n"); + Addr paddr = req->getPaddr() | (addr & (req->getSize()-1)); + delete req; + DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", addr, paddr); + return paddr; +#endif return addr; } }