ev5.hh revision 5569:baeee670d4ce
11689SN/A/*
22329SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
31689SN/A * All rights reserved.
41689SN/A *
51689SN/A * Redistribution and use in source and binary forms, with or without
61689SN/A * modification, are permitted provided that the following conditions are
71689SN/A * met: redistributions of source code must retain the above copyright
81689SN/A * notice, this list of conditions and the following disclaimer;
91689SN/A * redistributions in binary form must reproduce the above copyright
101689SN/A * notice, this list of conditions and the following disclaimer in the
111689SN/A * documentation and/or other materials provided with the distribution;
121689SN/A * neither the name of the copyright holders nor the names of its
131689SN/A * contributors may be used to endorse or promote products derived from
141689SN/A * this software without specific prior written permission.
151689SN/A *
161689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
261689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292935Sksewell@umich.edu *          Nathan Binkert
301689SN/A *          Ali Saidi
311689SN/A */
321060SN/A
331060SN/A#ifndef __ARCH_ALPHA_EV5_HH__
343773Sgblack@eecs.umich.edu#define __ARCH_ALPHA_EV5_HH__
353773Sgblack@eecs.umich.edu
361858SN/A#include "config/alpha_tlaser.hh"
371717SN/A#include "arch/alpha/isa_traits.hh"
381060SN/A
391061SN/Anamespace AlphaISA {
404329Sktlim@umich.edu
414329Sktlim@umich.edu#if ALPHA_TLASER
424329Sktlim@umich.educonst uint64_t AsnMask = ULL(0x7f);
432292SN/A#else
442292SN/Aconst uint64_t AsnMask = ULL(0xff);
452292SN/A#endif
462292SN/A
473788Sgblack@eecs.umich.educonst int VAddrImplBits = 43;
483798Sgblack@eecs.umich.educonst Addr VAddrImplMask = (ULL(1) << VAddrImplBits) - 1;
492361SN/Aconst Addr VAddrUnImplMask = ~VAddrImplMask;
502361SN/Ainline Addr VAddrImpl(Addr a) { return a & VAddrImplMask; }
511060SN/Ainline Addr VAddrVPN(Addr a) { return a >> PageShift; }
522292SN/Ainline Addr VAddrOffset(Addr a) { return a & PageOffset; }
532292SN/Ainline Addr VAddrSpaceEV5(Addr a) { return a >> 41 & 0x3; }
542292SN/Ainline Addr VAddrSpaceEV6(Addr a) { return a >> 41 & 0x7f; }
552292SN/A
562292SN/A#if ALPHA_TLASER
572292SN/Ainline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFF00000); }
582292SN/Aconst int PAddrImplBits = 40;
592292SN/A#else
602292SN/Ainline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFFF00000); }
612292SN/Aconst int PAddrImplBits = 44; // for Tsunami
622292SN/A#endif
632301SN/Aconst Addr PAddrImplMask = (ULL(1) << PAddrImplBits) - 1;
642292SN/Aconst Addr PAddrUncachedBit39 = ULL(0x8000000000);
652292SN/Aconst Addr PAddrUncachedBit40 = ULL(0x10000000000);
662292SN/Aconst Addr PAddrUncachedBit43 = ULL(0x80000000000);
672292SN/Aconst Addr PAddrUncachedMask = ULL(0x807ffffffff); // Clear PA<42:35>
682292SN/A
692292SN/Ainline Addr
702292SN/APhys2K0Seg(Addr addr)
712292SN/A{
722292SN/A#if !ALPHA_TLASER
732292SN/A    if (addr & PAddrUncachedBit43) {
742292SN/A        addr &= PAddrUncachedMask;
752292SN/A        addr |= PAddrUncachedBit40;
762292SN/A    }
772292SN/A#endif
782292SN/A    return addr | K0SegBase;
792292SN/A}
802292SN/A
811060SN/Ainline int DTB_ASN_ASN(uint64_t reg) { return reg >> 57 & AsnMask; }
821060SN/Ainline Addr DTB_PTE_PPN(uint64_t reg)
831061SN/A{ return reg >> 32 & (ULL(1) << PAddrImplBits - PageShift) - 1; }
841060SN/Ainline int DTB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
852292SN/Ainline int DTB_PTE_XWE(uint64_t reg) { return reg >> 12 & 0xf; }
861062SN/Ainline int DTB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
871062SN/Ainline int DTB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
882301SN/Ainline int DTB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
891062SN/Ainline int DTB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
901062SN/A
911062SN/Ainline int ITB_ASN_ASN(uint64_t reg) { return reg >> 4 & AsnMask; }
922301SN/Ainline Addr ITB_PTE_PPN(uint64_t reg)
931062SN/A{ return reg >> 32 & (ULL(1) << PAddrImplBits - PageShift) - 1; }
941062SN/Ainline int ITB_PTE_XRE(uint64_t reg) { return reg >> 8 & 0xf; }
951062SN/Ainline bool ITB_PTE_FONR(uint64_t reg) { return reg >> 1 & 0x1; }
962301SN/Ainline bool ITB_PTE_FONW(uint64_t reg) { return reg >> 2 & 0x1; }
971062SN/Ainline int ITB_PTE_GH(uint64_t reg) { return reg >> 5 & 0x3; }
981062SN/Ainline bool ITB_PTE_ASMA(uint64_t reg) { return reg >> 4 & 0x1; }
992301SN/A
1002301SN/Ainline uint64_t MCSR_SP(uint64_t reg) { return reg >> 1 & 0x3; }
1012301SN/A
1022301SN/Ainline bool ICSR_SDE(uint64_t reg) { return reg >> 30 & 0x1; }
1032292SN/Ainline int ICSR_SPE(uint64_t reg) { return reg >> 28 & 0x3; }
1042301SN/Ainline bool ICSR_FPE(uint64_t reg) { return reg >> 26 & 0x1; }
1052292SN/A
1062292SN/Ainline uint64_t ALT_MODE_AM(uint64_t reg) { return reg >> 3 & 0x3; }
1071062SN/Ainline uint64_t DTB_CM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
1082301SN/Ainline uint64_t ICM_CM(uint64_t reg) { return reg >> 3 & 0x3; }
1091062SN/A
1101062SN/Aconst uint64_t MM_STAT_BAD_VA_MASK = ULL(0x0020);
1111062SN/Aconst uint64_t MM_STAT_DTB_MISS_MASK = ULL(0x0010);
1122301SN/Aconst uint64_t MM_STAT_FONW_MASK = ULL(0x0008);
1131062SN/Aconst uint64_t MM_STAT_FONR_MASK = ULL(0x0004);
1141062SN/Aconst uint64_t MM_STAT_ACV_MASK = ULL(0x0002);
1151062SN/Aconst uint64_t MM_STAT_WR_MASK = ULL(0x0001);
1162301SN/Ainline int Opcode(MachInst inst) { return inst >> 26 & 0x3f; }
1171062SN/Ainline int Ra(MachInst inst) { return inst >> 21 & 0x1f; }
1181062SN/A
1191062SN/Aconst Addr PalBase = 0x4000;
1202301SN/Aconst Addr PalMax = 0x10000;
1212292SN/A
1221062SN/A} // namespace AlphaISA
1231062SN/A
1242301SN/A#endif // __ARCH_ALPHA_EV5_HH__
1252292SN/A