#ifndef __ARCH_POWER_ISA_TRAITS_HH__
#define __ARCH_POWER_ISA_TRAITS_HH__
-#include "arch/power/types.hh"
#include "base/types.hh"
-#include "cpu/static_inst_fwd.hh"
namespace PowerISA
{
const ByteOrder GuestByteOrder = BigEndianByteOrder;
-StaticInstPtr decodeInst(ExtMachInst);
-
const Addr PageShift = 12;
const Addr PageBytes = ULL(1) << PageShift;
-const Addr Page_Mask = ~(PageBytes - 1);
-const Addr PageOffset = PageBytes - 1;
-
-const Addr PteShift = 3;
-const Addr NPtePageShift = PageShift - PteShift;
-const Addr NPtePage = ULL(1) << NPtePageShift;
-const Addr PteMask = NPtePage - 1;
-
-const int MachineBytes = 4;
} // namespace PowerISA
namespace PowerISA
{
-static inline Addr PteAddr(Addr a) { return (a & PteMask) << PteShift; }
-
-struct VAddr
-{
- static const int ImplBits = 43;
- static const Addr ImplMask = (ULL(1) << ImplBits) - 1;
- static const Addr UnImplMask = ~ImplMask;
-
- Addr addr;
-
- VAddr(Addr a)
- : addr(a)
- {}
-
- operator Addr() const
- {
- return addr;
- }
-
- const VAddr
- &operator=(Addr a)
- {
- addr = a;
- return *this;
- }
-
- Addr
- vpn() const
- {
- return (addr & ImplMask) >> PageShift;
- }
-
- Addr
- page() const
- {
- return addr & Page_Mask;
- }
-
- Addr
- offset() const
- {
- return addr & PageOffset;
- }
-
- Addr
- level3() const
- {
- return PowerISA::PteAddr(addr >> PageShift);
- }
-
- Addr
- level2() const
- {
- return PowerISA::PteAddr(addr >> (NPtePageShift + PageShift));
- }
-
- Addr
- level1() const
- {
- return PowerISA::PteAddr(addr >> (2 * NPtePageShift + PageShift));
- }
-};
-
// ITB/DTB page table entry
struct PTE
{