12023SN/A/* 25268Sksewell@umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan 35254Sksewell@umich.edu * Copyright (c) 2007 MIPS Technologies, Inc. 45254Sksewell@umich.edu * All rights reserved. 52023SN/A * 65254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 75254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 85254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 95254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 105254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 115254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 125254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 135254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 145254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 155254Sksewell@umich.edu * this software without specific prior written permission. 162023SN/A * 175254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 205254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 215254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 225254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 235254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 245254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 255254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 265254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 275254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu * 295254Sksewell@umich.edu * Authors: Gabe Black 305254Sksewell@umich.edu * Korey Sewell 315222Sksewell@umich.edu * Jaidev Patwardhan 322023SN/A */ 332023SN/A 342028SN/A#ifndef __ARCH_MIPS_ISA_TRAITS_HH__ 352028SN/A#define __ARCH_MIPS_ISA_TRAITS_HH__ 362023SN/A 372597SN/A#include "arch/mips/types.hh" 386216Snate@binkert.org#include "base/types.hh" 398542Sgblack@eecs.umich.edu#include "cpu/static_inst_fwd.hh" 402023SN/A 417811Ssteve.reinhardt@amd.comnamespace LittleEndianGuest {} 422239SN/A 432131SN/Anamespace MipsISA 442023SN/A{ 452525SN/A 466378Sgblack@eecs.umich.eduusing namespace LittleEndianGuest; 472023SN/A 486378Sgblack@eecs.umich.eduStaticInstPtr decodeInst(ExtMachInst); 493093Sksewell@umich.edu 506378Sgblack@eecs.umich.educonst Addr PageShift = 13; 516378Sgblack@eecs.umich.educonst Addr PageBytes = ULL(1) << PageShift; 526378Sgblack@eecs.umich.educonst Addr Page_Mask = ~(PageBytes - 1); 536378Sgblack@eecs.umich.educonst Addr PageOffset = PageBytes - 1; 545222Sksewell@umich.edu 555222Sksewell@umich.edu 566378Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////// 576378Sgblack@eecs.umich.edu// 586378Sgblack@eecs.umich.edu// Translation stuff 596378Sgblack@eecs.umich.edu// 605222Sksewell@umich.edu 616378Sgblack@eecs.umich.educonst Addr PteShift = 3; 626378Sgblack@eecs.umich.educonst Addr NPtePageShift = PageShift - PteShift; 636378Sgblack@eecs.umich.educonst Addr NPtePage = ULL(1) << NPtePageShift; 646378Sgblack@eecs.umich.educonst Addr PteMask = NPtePage - 1; 655222Sksewell@umich.edu 666378Sgblack@eecs.umich.edu//// All 'Mapped' segments go through the TLB 676378Sgblack@eecs.umich.edu//// All other segments are translated by dropping the MSB, to give 686378Sgblack@eecs.umich.edu//// the corresponding physical address 696378Sgblack@eecs.umich.edu// User Segment - Mapped 706378Sgblack@eecs.umich.educonst Addr USegBase = ULL(0x0); 716378Sgblack@eecs.umich.educonst Addr USegEnd = ULL(0x7FFFFFFF); 725222Sksewell@umich.edu 736378Sgblack@eecs.umich.edu// Kernel Segment 0 - Unmapped 746378Sgblack@eecs.umich.educonst Addr KSeg0End = ULL(0x9FFFFFFF); 756378Sgblack@eecs.umich.educonst Addr KSeg0Base = ULL(0x80000000); 766378Sgblack@eecs.umich.educonst Addr KSeg0Mask = ULL(0x1FFFFFFF); 775222Sksewell@umich.edu 786378Sgblack@eecs.umich.edu// Kernel Segment 1 - Unmapped, Uncached 796378Sgblack@eecs.umich.educonst Addr KSeg1End = ULL(0xBFFFFFFF); 806378Sgblack@eecs.umich.educonst Addr KSeg1Base = ULL(0xA0000000); 816378Sgblack@eecs.umich.educonst Addr KSeg1Mask = ULL(0x1FFFFFFF); 825222Sksewell@umich.edu 836378Sgblack@eecs.umich.edu// Kernel/Supervisor Segment - Mapped 846378Sgblack@eecs.umich.educonst Addr KSSegEnd = ULL(0xDFFFFFFF); 856378Sgblack@eecs.umich.educonst Addr KSSegBase = ULL(0xC0000000); 865222Sksewell@umich.edu 876378Sgblack@eecs.umich.edu// Kernel Segment 3 - Mapped 886378Sgblack@eecs.umich.educonst Addr KSeg3End = ULL(0xFFFFFFFF); 896378Sgblack@eecs.umich.educonst Addr KSeg3Base = ULL(0xE0000000); 905222Sksewell@umich.edu 915222Sksewell@umich.edu 926378Sgblack@eecs.umich.eduinline Addr Phys2K0Seg(Addr addr) 936378Sgblack@eecs.umich.edu{ 946378Sgblack@eecs.umich.edu return addr | KSeg0Base; 956378Sgblack@eecs.umich.edu} 965254Sksewell@umich.edu 975254Sksewell@umich.edu 986378Sgblack@eecs.umich.educonst unsigned VABits = 32; 996378Sgblack@eecs.umich.educonst unsigned PABits = 32; // Is this correct? 1006378Sgblack@eecs.umich.educonst Addr VAddrImplMask = (ULL(1) << VABits) - 1; 1016378Sgblack@eecs.umich.educonst Addr VAddrUnImplMask = ~VAddrImplMask; 1026378Sgblack@eecs.umich.eduinline Addr VAddrImpl(Addr a) { return a & VAddrImplMask; } 1036378Sgblack@eecs.umich.eduinline Addr VAddrVPN(Addr a) { return a >> MipsISA::PageShift; } 1046378Sgblack@eecs.umich.eduinline Addr VAddrOffset(Addr a) { return a & MipsISA::PageOffset; } 1055254Sksewell@umich.edu 1066378Sgblack@eecs.umich.educonst Addr PAddrImplMask = (ULL(1) << PABits) - 1; 1075222Sksewell@umich.edu 1086378Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////////// 1096378Sgblack@eecs.umich.edu// 1106378Sgblack@eecs.umich.edu// Interrupt levels 1116378Sgblack@eecs.umich.edu// 1126378Sgblack@eecs.umich.eduenum InterruptLevels 1136378Sgblack@eecs.umich.edu{ 1146378Sgblack@eecs.umich.edu INTLEVEL_SOFTWARE_MIN = 4, 1156378Sgblack@eecs.umich.edu INTLEVEL_SOFTWARE_MAX = 19, 1165222Sksewell@umich.edu 1176378Sgblack@eecs.umich.edu INTLEVEL_EXTERNAL_MIN = 20, 1186378Sgblack@eecs.umich.edu INTLEVEL_EXTERNAL_MAX = 34, 1195222Sksewell@umich.edu 1206378Sgblack@eecs.umich.edu INTLEVEL_IRQ0 = 20, 1216378Sgblack@eecs.umich.edu INTLEVEL_IRQ1 = 21, 1226378Sgblack@eecs.umich.edu INTINDEX_ETHERNET = 0, 1236378Sgblack@eecs.umich.edu INTINDEX_SCSI = 1, 1246378Sgblack@eecs.umich.edu INTLEVEL_IRQ2 = 22, 1256378Sgblack@eecs.umich.edu INTLEVEL_IRQ3 = 23, 1265222Sksewell@umich.edu 1276378Sgblack@eecs.umich.edu INTLEVEL_SERIAL = 33, 1285222Sksewell@umich.edu 1296378Sgblack@eecs.umich.edu NumInterruptLevels = INTLEVEL_EXTERNAL_MAX 1306378Sgblack@eecs.umich.edu}; 1315222Sksewell@umich.edu 1326378Sgblack@eecs.umich.edu// MIPS modes 1336378Sgblack@eecs.umich.eduenum mode_type 1346378Sgblack@eecs.umich.edu{ 1356378Sgblack@eecs.umich.edu mode_kernel = 0, // kernel 1366378Sgblack@eecs.umich.edu mode_supervisor = 1, // supervisor 1376378Sgblack@eecs.umich.edu mode_user = 2, // user mode 1386378Sgblack@eecs.umich.edu mode_debug = 3, // debug mode 1396378Sgblack@eecs.umich.edu mode_number // number of modes 1406378Sgblack@eecs.umich.edu}; 1412131SN/A 1426378Sgblack@eecs.umich.educonst int ANNOTE_NONE = 0; 1436378Sgblack@eecs.umich.educonst uint32_t ITOUCH_ANNOTE = 0xffffffff; 1446378Sgblack@eecs.umich.edu 1458412Sksewell@umich.educonst bool HasUnalignedMemAcc = true; 1466974Stjones1@inf.ed.ac.uk 1479329Sdam.sunwoo@arm.comconst bool CurThreadInfoImplemented = false; 1489329Sdam.sunwoo@arm.comconst int CurThreadInfoReg = -1; 1499329Sdam.sunwoo@arm.com 1507811Ssteve.reinhardt@amd.com} // namespace MipsISA 1512023SN/A 1522028SN/A#endif // __ARCH_MIPS_ISA_TRAITS_HH__ 153