vtophys.cc (7087:fb8d5786ff30) vtophys.cc (7901:f9b675da608a)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 25 unchanged lines hidden (view full) ---

34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Gabe Black
38 */
39
40#include <string>
41
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 25 unchanged lines hidden (view full) ---

34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Gabe Black
38 */
39
40#include <string>
41
42#include "arch/x86/pagetable_walker.hh"
43#include "arch/x86/tlb.hh"
42#include "arch/x86/vtophys.hh"
44#include "arch/x86/vtophys.hh"
45#include "base/trace.hh"
46#include "config/full_system.hh"
47#include "cpu/thread_context.hh"
48#include "sim/fault.hh"
43
44using namespace std;
45
46namespace X86ISA
47{
49
50using namespace std;
51
52namespace X86ISA
53{
48 Addr vtophys(Addr vaddr)
54 Addr
55 vtophys(Addr vaddr)
49 {
56 {
57#if FULL_SYSTEM
58 panic("Need access to page tables\n");
59#endif
50 return vaddr;
51 }
52
60 return vaddr;
61 }
62
53 Addr vtophys(ThreadContext *tc, Addr addr)
63 Addr
64 vtophys(ThreadContext *tc, Addr vaddr)
54 {
65 {
55 return addr;
66#if FULL_SYSTEM
67 Walker *walker = tc->getDTBPtr()->getWalker();
68 Addr size;
69 Addr addr = vaddr;
70 Fault fault = walker->startFunctional(tc, addr, size, BaseTLB::Read);
71 if (fault != NoFault)
72 panic("vtophys page walk returned fault\n");
73 Addr masked_addr = vaddr & (size - 1);
74 Addr paddr = addr | masked_addr;
75 DPRINTF(VtoPhys, "vtophys(%#x) -> %#x\n", vaddr, paddr);
76 return paddr;
77#endif
78 return vaddr;
56 }
57}
79 }
80}