diff options
author | Joel Hestness <hestness@cs.utexas.edu> | 2011-02-06 22:14:17 -0800 |
---|---|---|
committer | Joel Hestness <hestness@cs.utexas.edu> | 2011-02-06 22:14:17 -0800 |
commit | 38140b5519d7fb925e7a5c53be72399243112c80 (patch) | |
tree | 4c45ada2a1766350682d36724ade553a91462a64 /src/arch/x86/vtophys.cc | |
parent | eea78f968b8c959e377bcdf50203c070de5057ac (diff) | |
download | gem5-38140b5519d7fb925e7a5c53be72399243112c80.tar.xz |
x86: implements vtophys
Calls walker to look up virt. to phys. page mapping
Diffstat (limited to 'src/arch/x86/vtophys.cc')
-rw-r--r-- | src/arch/x86/vtophys.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/arch/x86/vtophys.cc b/src/arch/x86/vtophys.cc index e0bb6c993..3a6932564 100644 --- a/src/arch/x86/vtophys.cc +++ b/src/arch/x86/vtophys.cc @@ -39,19 +39,42 @@ #include <string> +#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/fault.hh" using namespace std; namespace X86ISA { - Addr vtophys(Addr vaddr) + Addr + vtophys(Addr vaddr) { +#if FULL_SYSTEM + panic("Need access to page tables\n"); +#endif return vaddr; } - Addr vtophys(ThreadContext *tc, Addr addr) + Addr + vtophys(ThreadContext *tc, Addr vaddr) { - return addr; +#if FULL_SYSTEM + Walker *walker = tc->getDTBPtr()->getWalker(); + Addr size; + Addr addr = vaddr; + Fault fault = walker->startFunctional(tc, addr, size, BaseTLB::Read); + if (fault != NoFault) + panic("vtophys page walk returned fault\n"); + Addr masked_addr = vaddr & (size - 1); + Addr paddr = addr | masked_addr; + DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr); + return paddr; +#endif + return vaddr; } } |