pagetable.hh (6378:4a2ff62c3b4f) pagetable.hh (8763:509e9bb84dfa)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

29 * Authors: Nathan Binkert
30 * Steve Reinhardt
31 * Jaidev Patwardhan
32 */
33
34#ifndef __ARCH_MIPS_PAGETABLE_H__
35#define __ARCH_MIPS_PAGETABLE_H__
36
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

29 * Authors: Nathan Binkert
30 * Steve Reinhardt
31 * Jaidev Patwardhan
32 */
33
34#ifndef __ARCH_MIPS_PAGETABLE_H__
35#define __ARCH_MIPS_PAGETABLE_H__
36
37#include "arch/mips/isa_traits.hh"
38#include "arch/mips/utility.hh"
39#include "arch/mips/vtophys.hh"
40#include "config/full_system.hh"
37#include "base/misc.hh"
38#include "base/types.hh"
39#include "sim/serialize.hh"
41
42namespace MipsISA {
43
44struct VAddr
45{
40
41namespace MipsISA {
42
43struct VAddr
44{
46 static const int ImplBits = 43;
47 static const Addr ImplMask = (ULL(1) << ImplBits) - 1;
48 static const Addr UnImplMask = ~ImplMask;
49
50 VAddr(Addr a) : addr(a) {}
51 Addr addr;
52 operator Addr() const { return addr; }
53 const VAddr &operator=(Addr a) { addr = a; return *this; }
54
55 Addr vpn() const { return (addr & ImplMask) >> PageShift; }
56 Addr page() const { return addr & Page_Mask; }
57 Addr offset() const { return addr & PageOffset; }
58
59 Addr level3() const
60 { return MipsISA::PteAddr(addr >> PageShift); }
61 Addr level2() const
62 { return MipsISA::PteAddr(addr >> (NPtePageShift + PageShift)); }
63 Addr level1() const
64 { return MipsISA::PteAddr(addr >> (2 * NPtePageShift + PageShift)); }
65};
66
67// ITB/DTB page table entry
68struct PTE
69{
70 Addr Mask;
71 Addr VPN;
72 uint8_t asid;

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

93 int AddrShiftAmount;
94 int OffsetMask;
95
96 bool Valid() { return (V0 | V1); };
97 void serialize(std::ostream &os);
98 void unserialize(Checkpoint *cp, const std::string &section);
99};
100
45};
46
47// ITB/DTB page table entry
48struct PTE
49{
50 Addr Mask;
51 Addr VPN;
52 uint8_t asid;

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

73 int AddrShiftAmount;
74 int OffsetMask;
75
76 bool Valid() { return (V0 | V1); };
77 void serialize(std::ostream &os);
78 void unserialize(Checkpoint *cp, const std::string &section);
79};
80
81// WARN: This particular TLB entry is not necessarily conformed to MIPS ISA
82struct TlbEntry
83{
84 Addr _pageStart;
85 TlbEntry() {}
86 TlbEntry(Addr asn, Addr vaddr, Addr paddr) : _pageStart(paddr) {}
87
88 Addr pageStart()
89 {
90 return _pageStart;
91 }
92
93 void
94 updateVaddr(Addr new_vaddr) {}
95
96 void serialize(std::ostream &os)
97 {
98 SERIALIZE_SCALAR(_pageStart);
99 }
100
101 void unserialize(Checkpoint *cp, const std::string &section)
102 {
103 UNSERIALIZE_SCALAR(_pageStart);
104 }
105
101};
106};
107
108};
102#endif // __ARCH_MIPS_PAGETABLE_H__
103
109#endif // __ARCH_MIPS_PAGETABLE_H__
110