ev5.hh revision 6330
11758SN/A/*
21762SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
31758SN/A * All rights reserved.
41758SN/A *
51758SN/A * Redistribution and use in source and binary forms, with or without
61758SN/A * modification, are permitted provided that the following conditions are
71758SN/A * met: redistributions of source code must retain the above copyright
81758SN/A * notice, this list of conditions and the following disclaimer;
91758SN/A * redistributions in binary form must reproduce the above copyright
101758SN/A * notice, this list of conditions and the following disclaimer in the
111758SN/A * documentation and/or other materials provided with the distribution;
121758SN/A * neither the name of the copyright holders nor the names of its
131758SN/A * contributors may be used to endorse or promote products derived from
141758SN/A * this software without specific prior written permission.
151758SN/A *
161758SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171758SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181758SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191758SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201758SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211758SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221758SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231758SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241758SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251758SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261758SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
302665Ssaidi@eecs.umich.edu *          Ali Saidi
311758SN/A */
322SN/A
331147SN/A#ifndef __ARCH_ALPHA_EV5_HH__
341147SN/A#define __ARCH_ALPHA_EV5_HH__
352SN/A
362107SN/A#include "arch/alpha/isa_traits.hh"
371858SN/A
386330Sgblack@eecs.umich.educlass ThreadContext;
396330Sgblack@eecs.umich.edu
405566Snate@binkert.orgnamespace AlphaISA {
412107SN/A
421147SN/Aconst uint64_t AsnMask = ULL(0xff);
431147SN/Aconst int VAddrImplBits = 43;
441147SN/Aconst Addr VAddrImplMask = (ULL(1) << VAddrImplBits) - 1;
451147SN/Aconst Addr VAddrUnImplMask = ~VAddrImplMask;
461147SN/Ainline Addr VAddrImpl(Addr a) { return a & VAddrImplMask; }
475568Snate@binkert.orginline Addr VAddrVPN(Addr a) { return a >> PageShift; }
485568Snate@binkert.orginline Addr VAddrOffset(Addr a) { return a & PageOffset; }
491147SN/Ainline Addr VAddrSpaceEV5(Addr a) { return a >> 41 & 0x3; }
501147SN/Ainline Addr VAddrSpaceEV6(Addr a) { return a >> 41 & 0x7f; }
51924SN/A
521147SN/Ainline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFFF00000); }
531147SN/Aconst int PAddrImplBits = 44; // for Tsunami
541147SN/Aconst Addr PAddrImplMask = (ULL(1) << PAddrImplBits) - 1;
551147SN/Aconst Addr PAddrUncachedBit39 = ULL(0x8000000000);
561147SN/Aconst Addr PAddrUncachedBit40 = ULL(0x10000000000);
571147SN/Aconst Addr PAddrUncachedBit43 = ULL(0x80000000000);
581147SN/Aconst Addr PAddrUncachedMask = ULL(0x807ffffffff); // Clear PA<42:35>
595569Snate@binkert.org
605569Snate@binkert.orginline Addr
615569Snate@binkert.orgPhys2K0Seg(Addr addr)
621805SN/A{
631805SN/A    if (addr & PAddrUncachedBit43) {
641805SN/A        addr &= PAddrUncachedMask;
651805SN/A        addr |= PAddrUncachedBit40;
661805SN/A    }
675568Snate@binkert.org    return addr | K0SegBase;
681805SN/A}
69924SN/A
701147SN/Ainline int DTB_ASN_ASN(uint64_t reg) { return reg >> 57 & AsnMask; }
711147SN/Ainline Addr DTB_PTE_PPN(uint64_t reg)
725570Snate@binkert.org{ return reg >> 32 & ((ULL(1) << (PAddrImplBits - PageShift)) - 1); }
731147SN/Ainline int DTB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
741147SN/Ainline int DTB_PTE_XWE(uint64_t reg) { return reg >> 12 & 0xf; }
751147SN/Ainline int DTB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
761147SN/Ainline int DTB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
771147SN/Ainline int DTB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
781147SN/Ainline int DTB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
792SN/A
801147SN/Ainline int ITB_ASN_ASN(uint64_t reg) { return reg >> 4 & AsnMask; }
811147SN/Ainline Addr ITB_PTE_PPN(uint64_t reg)
825570Snate@binkert.org{ return reg >> 32 & ((ULL(1) << (PAddrImplBits - PageShift)) - 1); }
831147SN/Ainline int ITB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
841147SN/Ainline bool ITB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
851147SN/Ainline bool ITB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
861147SN/Ainline int ITB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
871147SN/Ainline bool ITB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
882SN/A
891147SN/Ainline uint64_t MCSR_SP(uint64_t reg) { return reg >> 1 & 0x3; }
902SN/A
911147SN/Ainline bool ICSR_SDE(uint64_t reg) { return reg >> 30 & 0x1; }
921147SN/Ainline int ICSR_SPE(uint64_t reg) { return reg >> 28 & 0x3; }
931147SN/Ainline bool ICSR_FPE(uint64_t reg) { return reg >> 26 & 0x1; }
942SN/A
951147SN/Ainline uint64_t ALT_MODE_AM(uint64_t reg) { return reg >> 3 & 0x3; }
961147SN/Ainline uint64_t DTB_CM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
971147SN/Ainline uint64_t ICM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
982SN/A
991147SN/Aconst uint64_t MM_STAT_BAD_VA_MASK = ULL(0x0020);
1001147SN/Aconst uint64_t MM_STAT_DTB_MISS_MASK = ULL(0x0010);
1011147SN/Aconst uint64_t MM_STAT_FONW_MASK = ULL(0x0008);
1021147SN/Aconst uint64_t MM_STAT_FONR_MASK = ULL(0x0004);
1031147SN/Aconst uint64_t MM_STAT_ACV_MASK = ULL(0x0002);
1041147SN/Aconst uint64_t MM_STAT_WR_MASK = ULL(0x0001);
1055568Snate@binkert.orginline int Opcode(MachInst inst) { return inst >> 26 & 0x3f; }
1065568Snate@binkert.orginline int Ra(MachInst inst) { return inst >> 21 & 0x1f; }
1072SN/A
1081147SN/Aconst Addr PalBase = 0x4000;
1091147SN/Aconst Addr PalMax = 0x10000;
1102SN/A
1116330Sgblack@eecs.umich.eduvoid copyIprs(ThreadContext *src, ThreadContext *dest);
1126330Sgblack@eecs.umich.edu
1135566Snate@binkert.org} // namespace AlphaISA
1142SN/A
1151147SN/A#endif // __ARCH_ALPHA_EV5_HH__
116