x86: implements vtophys
Calls walker to look up virt. to phys. page mapping
This commit is contained in:
parent
eea78f968b
commit
38140b5519
|
@ -48,6 +48,7 @@
|
||||||
#include "mem/mem_object.hh"
|
#include "mem/mem_object.hh"
|
||||||
#include "mem/packet.hh"
|
#include "mem/packet.hh"
|
||||||
#include "params/X86PagetableWalker.hh"
|
#include "params/X86PagetableWalker.hh"
|
||||||
|
#include "sim/faults.hh"
|
||||||
|
|
||||||
class ThreadContext;
|
class ThreadContext;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "arch/x86/bios/smbios.hh"
|
#include "arch/x86/bios/smbios.hh"
|
||||||
#include "arch/x86/bios/intelmp.hh"
|
#include "arch/x86/bios/intelmp.hh"
|
||||||
|
#include "arch/x86/isa_traits.hh"
|
||||||
#include "arch/x86/regs/misc.hh"
|
#include "arch/x86/regs/misc.hh"
|
||||||
#include "arch/x86/system.hh"
|
#include "arch/x86/system.hh"
|
||||||
#include "arch/vtophys.hh"
|
#include "arch/vtophys.hh"
|
||||||
|
|
|
@ -39,19 +39,42 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "arch/x86/pagetable_walker.hh"
|
||||||
|
#include "arch/x86/tlb.hh"
|
||||||
#include "arch/x86/vtophys.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;
|
using namespace std;
|
||||||
|
|
||||||
namespace X86ISA
|
namespace X86ISA
|
||||||
{
|
{
|
||||||
Addr vtophys(Addr vaddr)
|
Addr
|
||||||
|
vtophys(Addr vaddr)
|
||||||
{
|
{
|
||||||
|
#if FULL_SYSTEM
|
||||||
|
panic("Need access to page tables\n");
|
||||||
|
#endif
|
||||||
return vaddr;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,9 @@
|
||||||
#ifndef __ARCH_X86_VTOPHYS_HH__
|
#ifndef __ARCH_X86_VTOPHYS_HH__
|
||||||
#define __ARCH_X86_VTOPHYS_HH__
|
#define __ARCH_X86_VTOPHYS_HH__
|
||||||
|
|
||||||
#include "arch/x86/isa_traits.hh"
|
|
||||||
#include "arch/x86/pagetable.hh"
|
|
||||||
#include "base/types.hh"
|
#include "base/types.hh"
|
||||||
|
|
||||||
class ThreadContext;
|
class ThreadContext;
|
||||||
class FunctionalPort;
|
|
||||||
|
|
||||||
namespace X86ISA
|
namespace X86ISA
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue