1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Steve Reinhardt 29 * Nathan Binkert 30 * Ali Saidi 31 */ 32 33#ifndef __ARCH_ALPHA_EV5_HH__ 34#define __ARCH_ALPHA_EV5_HH__ 35 36#include "config/alpha_tlaser.hh" 37#include "arch/alpha/isa_traits.hh" 38 39namespace AlphaISA { 40 41#if ALPHA_TLASER 42const uint64_t AsnMask = ULL(0x7f); 43#else 44const uint64_t AsnMask = ULL(0xff); 45#endif 46 47const int VAddrImplBits = 43; 48const Addr VAddrImplMask = (ULL(1) << VAddrImplBits) - 1; 49const Addr VAddrUnImplMask = ~VAddrImplMask; 50inline Addr VAddrImpl(Addr a) { return a & VAddrImplMask; } 51inline Addr VAddrVPN(Addr a) { return a >> PageShift; } 52inline Addr VAddrOffset(Addr a) { return a & PageOffset; } 53inline Addr VAddrSpaceEV5(Addr a) { return a >> 41 & 0x3; } 54inline Addr VAddrSpaceEV6(Addr a) { return a >> 41 & 0x7f; } 55 56#if ALPHA_TLASER 57inline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFF00000); } 58const int PAddrImplBits = 40; 59#else 60inline bool PAddrIprSpace(Addr a) { return a >= ULL(0xFFFFFF00000); } 61const int PAddrImplBits = 44; // for Tsunami 62#endif 63const Addr PAddrImplMask = (ULL(1) << PAddrImplBits) - 1; 64const Addr PAddrUncachedBit39 = ULL(0x8000000000); 65const Addr PAddrUncachedBit40 = ULL(0x10000000000); 66const Addr PAddrUncachedBit43 = ULL(0x80000000000); 67const Addr PAddrUncachedMask = ULL(0x807ffffffff); // Clear PA<42:35> 68 69inline Addr 70Phys2K0Seg(Addr addr) 71{ 72#if !ALPHA_TLASER 73 if (addr & PAddrUncachedBit43) { 74 addr &= PAddrUncachedMask; 75 addr |= PAddrUncachedBit40; 76 } 77#endif 78 return addr | K0SegBase; 79} 80 81inline int DTB_ASN_ASN(uint64_t reg) { return reg >> 57 & AsnMask; } 82inline Addr DTB_PTE_PPN(uint64_t reg)
|