miscregs.hh revision 7362
12SN/A/*
28707Sandreas.hansson@arm.com * Copyright (c) 2010 ARM Limited
38707Sandreas.hansson@arm.com * All rights reserved
48707Sandreas.hansson@arm.com *
58707Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68707Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78707Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88707Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98707Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108707Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118707Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128707Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138707Sandreas.hansson@arm.com *
141762SN/A * Copyright (c) 2009 The Regents of The University of Michigan
157897Shestness@cs.utexas.edu * All rights reserved.
162SN/A *
172SN/A * Redistribution and use in source and binary forms, with or without
182SN/A * modification, are permitted provided that the following conditions are
192SN/A * met: redistributions of source code must retain the above copyright
202SN/A * notice, this list of conditions and the following disclaimer;
212SN/A * redistributions in binary form must reproduce the above copyright
222SN/A * notice, this list of conditions and the following disclaimer in the
232SN/A * documentation and/or other materials provided with the distribution;
242SN/A * neither the name of the copyright holders nor the names of its
252SN/A * contributors may be used to endorse or promote products derived from
262SN/A * this software without specific prior written permission.
272SN/A *
282SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392SN/A *
402665Ssaidi@eecs.umich.edu * Authors: Gabe Black
412665Ssaidi@eecs.umich.edu */
422665Ssaidi@eecs.umich.edu#ifndef __ARCH_ARM_MISCREGS_HH__
437897Shestness@cs.utexas.edu#define __ARCH_ARM_MISCREGS_HH__
442SN/A
452SN/A#include "base/bitunion.hh"
461717SN/A
471717SN/Anamespace ArmISA
482SN/A{
492SN/A    enum ConditionCode {
502SN/A        COND_EQ  =   0,
514182Sgblack@eecs.umich.edu        COND_NE, //  1
525664Sgblack@eecs.umich.edu        COND_CS, //  2
53707SN/A        COND_CC, //  3
541858SN/A        COND_MI, //  4
556658Snate@binkert.org        COND_PL, //  5
568229Snate@binkert.org        COND_VS, //  6
5756SN/A        COND_VC, //  7
584776Sgblack@eecs.umich.edu        COND_HI, //  8
592SN/A        COND_LS, //  9
603520Sgblack@eecs.umich.edu        COND_GE, // 10
613520Sgblack@eecs.umich.edu        COND_LT, // 11
623520Sgblack@eecs.umich.edu        COND_GT, // 12
633520Sgblack@eecs.umich.edu        COND_LE, // 13
645529Snate@binkert.org        COND_AL, // 14
652190SN/A        COND_UC  // 15
662315SN/A    };
672680Sktlim@umich.edu
682SN/A    enum MiscRegIndex {
692856Srdreslin@umich.edu        MISCREG_CPSR = 0,
702SN/A        MISCREG_SPSR,
714182Sgblack@eecs.umich.edu        MISCREG_SPSR_FIQ,
724182Sgblack@eecs.umich.edu        MISCREG_SPSR_IRQ,
734182Sgblack@eecs.umich.edu        MISCREG_SPSR_SVC,
744182Sgblack@eecs.umich.edu        MISCREG_SPSR_MON,
754182Sgblack@eecs.umich.edu        MISCREG_SPSR_UND,
762356SN/A        MISCREG_SPSR_ABT,
772356SN/A        MISCREG_FPSR,
782356SN/A        MISCREG_FPSID,
796144Sksewell@umich.edu        MISCREG_FPSCR,
802356SN/A        MISCREG_FPEXC,
812356SN/A        MISCREG_MVFR0,
826144Sksewell@umich.edu        MISCREG_MVFR1,
832356SN/A        MISCREG_SEV_MAILBOX,
842356SN/A
856144Sksewell@umich.edu        // CP15 registers
862356SN/A        MISCREG_CP15_START,
872356SN/A        MISCREG_SCTLR = MISCREG_CP15_START,
882356SN/A        MISCREG_DCCISW,
896144Sksewell@umich.edu        MISCREG_DCCIMVAC,
906144Sksewell@umich.edu        MISCREG_DCCMVAC,
916144Sksewell@umich.edu        MISCREG_CONTEXTIDR,
926144Sksewell@umich.edu        MISCREG_TPIDRURW,
936144Sksewell@umich.edu        MISCREG_TPIDRURO,
945336Shines@cs.fsu.edu        MISCREG_TPIDRPRW,
952356SN/A        MISCREG_CP15ISB,
962356SN/A        MISCREG_CP15DSB,
972856Srdreslin@umich.edu        MISCREG_CP15DMB,
982SN/A        MISCREG_CPACR,
991634SN/A        MISCREG_CLIDR,
1001634SN/A        MISCREG_CCSIDR,
1011695SN/A        MISCREG_CSSELR,
1023814Ssaidi@eecs.umich.edu        MISCREG_ICIALLUIS,
1033814Ssaidi@eecs.umich.edu        MISCREG_ICIALLU,
1045712Shsul@eecs.umich.edu        MISCREG_ICIMVAU,
1055712Shsul@eecs.umich.edu        MISCREG_BPIMVA,
1065715Shsul@eecs.umich.edu        MISCREG_BPIALLIS,
1075712Shsul@eecs.umich.edu        MISCREG_BPIALL,
1085712Shsul@eecs.umich.edu        MISCREG_MIDR,
1091634SN/A        MISCREG_TTBR0,
1108707Sandreas.hansson@arm.com        MISCREG_TTBR1,
1118707Sandreas.hansson@arm.com        MISCREG_TLBTR,
1128707Sandreas.hansson@arm.com        MISCREG_DACR,
1138707Sandreas.hansson@arm.com        MISCREG_TLBIALLIS,
1148707Sandreas.hansson@arm.com        MISCREG_TLBIMVAIS,
1158707Sandreas.hansson@arm.com        MISCREG_TLBIASIDIS,
1168707Sandreas.hansson@arm.com        MISCREG_TLBIMVAAIS,
1178707Sandreas.hansson@arm.com        MISCREG_ITLBIALL,
1188707Sandreas.hansson@arm.com        MISCREG_ITLBIMVA,
1198707Sandreas.hansson@arm.com        MISCREG_ITLBIASID,
1208707Sandreas.hansson@arm.com        MISCREG_DTLBIALL,
1218707Sandreas.hansson@arm.com        MISCREG_DTLBIMVA,
1228707Sandreas.hansson@arm.com        MISCREG_DTLBIASID,
1238707Sandreas.hansson@arm.com        MISCREG_TLBIALL,
1248707Sandreas.hansson@arm.com        MISCREG_TLBIMVA,
1258707Sandreas.hansson@arm.com        MISCREG_TLBIASID,
1268707Sandreas.hansson@arm.com        MISCREG_TLBIMVAA,
1278707Sandreas.hansson@arm.com        MISCREG_DFSR,
1288707Sandreas.hansson@arm.com        MISCREG_IFSR,
1298707Sandreas.hansson@arm.com        MISCREG_DFAR,
1308707Sandreas.hansson@arm.com        MISCREG_IFAR,
1318707Sandreas.hansson@arm.com        MISCREG_CP15_UNIMP_START,
1328707Sandreas.hansson@arm.com        MISCREG_CTR = MISCREG_CP15_UNIMP_START,
1338707Sandreas.hansson@arm.com        MISCREG_TCMTR,
1348707Sandreas.hansson@arm.com        MISCREG_MPIDR,
1358707Sandreas.hansson@arm.com        MISCREG_ID_PFR0,
1368707Sandreas.hansson@arm.com        MISCREG_ID_PFR1,
1378707Sandreas.hansson@arm.com        MISCREG_ID_DFR0,
1388707Sandreas.hansson@arm.com        MISCREG_ID_AFR0,
1398707Sandreas.hansson@arm.com        MISCREG_ID_MMFR0,
1408707Sandreas.hansson@arm.com        MISCREG_ID_MMFR1,
1418707Sandreas.hansson@arm.com        MISCREG_ID_MMFR2,
1428707Sandreas.hansson@arm.com        MISCREG_ID_MMFR3,
1438707Sandreas.hansson@arm.com        MISCREG_ID_ISAR0,
1448707Sandreas.hansson@arm.com        MISCREG_ID_ISAR1,
1458707Sandreas.hansson@arm.com        MISCREG_ID_ISAR2,
1468707Sandreas.hansson@arm.com        MISCREG_ID_ISAR3,
1478707Sandreas.hansson@arm.com        MISCREG_ID_ISAR4,
1488707Sandreas.hansson@arm.com        MISCREG_ID_ISAR5,
1498707Sandreas.hansson@arm.com        MISCREG_PAR,
1508707Sandreas.hansson@arm.com        MISCREG_AIDR,
1518707Sandreas.hansson@arm.com        MISCREG_ACTLR,
1528707Sandreas.hansson@arm.com        MISCREG_ADFSR,
1538707Sandreas.hansson@arm.com        MISCREG_AIFSR,
1548707Sandreas.hansson@arm.com        MISCREG_DCIMVAC,
1558707Sandreas.hansson@arm.com        MISCREG_DCISW,
1568707Sandreas.hansson@arm.com        MISCREG_MCCSW,
1578707Sandreas.hansson@arm.com        MISCREG_DCCMVAU,
1588707Sandreas.hansson@arm.com        MISCREG_SCR,
1598707Sandreas.hansson@arm.com        MISCREG_SDER,
1608707Sandreas.hansson@arm.com        MISCREG_NSACR,
1611634SN/A        MISCREG_TTBCR,
1625712Shsul@eecs.umich.edu        MISCREG_V2PCWPR,
1635712Shsul@eecs.umich.edu        MISCREG_V2PCWPW,
1645712Shsul@eecs.umich.edu        MISCREG_V2PCWUR,
1652359SN/A        MISCREG_V2PCWUW,
1667064Snate@binkert.org        MISCREG_V2POWPR,
1675100Ssaidi@eecs.umich.edu        MISCREG_V2POWPW,
1687823Ssteve.reinhardt@amd.com        MISCREG_V2POWUR,
1695099Ssaidi@eecs.umich.edu        MISCREG_V2POWUW,
1707914SBrad.Beckmann@amd.com        MISCREG_PRRR,
1717914SBrad.Beckmann@amd.com        MISCREG_NMRR,
1723814Ssaidi@eecs.umich.edu        MISCREG_VBAR,
1733814Ssaidi@eecs.umich.edu        MISCREG_MVBAR,
1741634SN/A        MISCREG_ISR,
1753495Sktlim@umich.edu        MISCREG_FCEIDR,
1763495Sktlim@umich.edu
1777823Ssteve.reinhardt@amd.com
1783495Sktlim@umich.edu        MISCREG_CP15_END,
1793495Sktlim@umich.edu
1803495Sktlim@umich.edu        // Dummy indices
1813495Sktlim@umich.edu        MISCREG_NOP = MISCREG_CP15_END,
1823495Sktlim@umich.edu        MISCREG_RAZ,
1837823Ssteve.reinhardt@amd.com
1843495Sktlim@umich.edu        NUM_MISCREGS
1853495Sktlim@umich.edu    };
1863495Sktlim@umich.edu
1873495Sktlim@umich.edu    MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
1883495Sktlim@umich.edu                               unsigned crm, unsigned opc2);
1895664Sgblack@eecs.umich.edu
1905664Sgblack@eecs.umich.edu    const char * const miscRegName[NUM_MISCREGS] = {
1911858SN/A        "cpsr", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
1922SN/A        "spsr_mon", "spsr_und", "spsr_abt",
1935704Snate@binkert.org        "fpsr", "fpsid", "fpscr", "fpexc", "mvfr0", "mvfr1",
1942SN/A        "sev_mailbox",
1952SN/A        "sctlr", "dccisw", "dccimvac", "dccmvac",
1965645Sgblack@eecs.umich.edu        "contextidr", "tpidrurw", "tpidruro", "tpidrprw",
1975645Sgblack@eecs.umich.edu        "cp15isb", "cp15dsb", "cp15dmb", "cpacr",
1985645Sgblack@eecs.umich.edu        "clidr", "ccsidr", "csselr",
1995647Sgblack@eecs.umich.edu        "icialluis", "iciallu", "icimvau",
2005645Sgblack@eecs.umich.edu        "bpimva", "bpiallis", "bpiall",
2015645Sgblack@eecs.umich.edu        "midr", "ttbr0", "ttbr1", "tlbtr", "dacr",
2025807Snate@binkert.org        "tlbiallis", "tlbimvais", "tlbiasidis", "tlbimvaais",
2035807Snate@binkert.org        "itlbiall", "itlbimva", "itlbiasid",
2045807Snate@binkert.org        "dtlbiall", "dtlbimva", "dtlbiasid",
2055807Snate@binkert.org        "tlbiall", "tlbimva", "tlbiasid", "tlbimvaa",
2065807Snate@binkert.org        "dfsr", "ifsr", "dfar", "ifar",
2075807Snate@binkert.org        "ctr", "tcmtr", "mpidr",
2085807Snate@binkert.org        "id_pfr0", "id_pfr1", "id_dfr0", "id_afr0",
2095807Snate@binkert.org        "id_mmfr0", "id_mmfr1", "id_mmfr2", "id_mmfr3",
2105807Snate@binkert.org        "id_isar0", "id_isar1", "id_isar2", "id_isar3", "id_isar4", "id_isar5",
2115807Snate@binkert.org        "par", "aidr", "actlr",
2125807Snate@binkert.org        "adfsr", "aifsr",
2135807Snate@binkert.org        "dcimvac", "dcisw", "mccsw",
2145807Snate@binkert.org        "dccmvau",
2155807Snate@binkert.org        "scr", "sder", "nsacr", "ttbcr",
2165807Snate@binkert.org        "v2pcwpr", "v2pcwpw", "v2pcwur", "v2pcwuw",
2175807Snate@binkert.org        "v2powpr", "v2powpw", "v2powur", "v2powuw",
2185807Snate@binkert.org        "prrr", "nmrr", "vbar", "mvbar", "isr", "fceidr",
2195807Snate@binkert.org        "nop", "raz"
2205807Snate@binkert.org    };
2215807Snate@binkert.org
2222SN/A    BitUnion32(CPSR)
2235704Snate@binkert.org        Bitfield<31> n;
2245704Snate@binkert.org        Bitfield<30> z;
2255704Snate@binkert.org        Bitfield<29> c;
2265704Snate@binkert.org        Bitfield<28> v;
2275704Snate@binkert.org        Bitfield<27> q;
2281917SN/A        Bitfield<26,25> it1;
2291917SN/A        Bitfield<24> j;
2301917SN/A        Bitfield<19, 16> ge;
2311917SN/A        Bitfield<15,10> it2;
2321917SN/A        Bitfield<9> e;
2335536Srstrong@hp.com        Bitfield<8> a;
2341917SN/A        Bitfield<7> i;
2351917SN/A        Bitfield<6> f;
2365536Srstrong@hp.com        Bitfield<5> t;
2371917SN/A        Bitfield<4, 0> mode;
2381917SN/A    EndBitUnion(CPSR)
2391917SN/A
2402SN/A    // This mask selects bits of the CPSR that actually go in the CondCodes
2412SN/A    // integer register to allow renaming.
2422SN/A    static const uint32_t CondCodesMask = 0xF80F0000;
2432680Sktlim@umich.edu
2444182Sgblack@eecs.umich.edu    BitUnion32(SCTLR)
2452SN/A        Bitfield<31> ie;  // Instruction endianness
2464776Sgblack@eecs.umich.edu        Bitfield<30> te;  // Thumb Exception Enable
2474776Sgblack@eecs.umich.edu        Bitfield<29> afe; // Access flag enable
2482SN/A        Bitfield<28> tre; // TEX Remap bit
249393SN/A        Bitfield<27> nmfi;// Non-maskable fast interrupts enable
2507764Sgblack@eecs.umich.edu        Bitfield<25> ee;  // Exception Endianness bit
2517764Sgblack@eecs.umich.edu        Bitfield<24> ve;  // Interrupt vectors enable
2527764Sgblack@eecs.umich.edu        Bitfield<23> rao1;// Read as one
2534776Sgblack@eecs.umich.edu        Bitfield<22> u;   // Alignment (now unused)
2544776Sgblack@eecs.umich.edu        Bitfield<21> fi;  // Fast interrupts configuration enable
2554776Sgblack@eecs.umich.edu        Bitfield<19> dz;  // Divide by Zero fault enable bit
256393SN/A        Bitfield<18> rao2;// Read as one
257393SN/A        Bitfield<17> br;  // Background region bit
258393SN/A        Bitfield<16> rao3;// Read as one
259393SN/A        Bitfield<14> rr;  // Round robin cache replacement
260393SN/A        Bitfield<13> v;   // Base address for exception vectors
261393SN/A        Bitfield<12> i;   // instruction cache enable
262393SN/A        Bitfield<11> z;   // branch prediction enable bit
263393SN/A        Bitfield<10> sw;  // Enable swp/swpb
264393SN/A        Bitfield<6,3> rao4;// Read as one
265393SN/A        Bitfield<7>  b;   // Endianness support (unused)
266393SN/A        Bitfield<2>  c;   // Cache enable bit
267393SN/A        Bitfield<1>  a;   // Alignment fault checking
268393SN/A        Bitfield<0>  m;   // MMU enable bit
2692SN/A    EndBitUnion(SCTLR)
2704000Ssaidi@eecs.umich.edu
2714000Ssaidi@eecs.umich.edu    BitUnion32(CPACR)
2724000Ssaidi@eecs.umich.edu        Bitfield<1, 0> cp0;
2734000Ssaidi@eecs.umich.edu        Bitfield<3, 2> cp1;
2744000Ssaidi@eecs.umich.edu        Bitfield<5, 4> cp2;
2754000Ssaidi@eecs.umich.edu        Bitfield<7, 6> cp3;
2762SN/A        Bitfield<9, 8> cp4;
2775529Snate@binkert.org        Bitfield<11, 10> cp5;
2785529Snate@binkert.org        Bitfield<13, 12> cp6;
2795529Snate@binkert.org        Bitfield<15, 14> cp7;
2801400SN/A        Bitfield<17, 16> cp8;
2811191SN/A        Bitfield<19, 18> cp9;
2822SN/A        Bitfield<21, 20> cp10;
2831129SN/A        Bitfield<23, 22> cp11;
2841917SN/A        Bitfield<25, 24> cp12;
2852SN/A        Bitfield<27, 26> cp13;
2862SN/A        Bitfield<30> d32dis;
2876221Snate@binkert.org        Bitfield<31> asedis;
2882103SN/A    EndBitUnion(CPACR)
2892680Sktlim@umich.edu
290180SN/A    BitUnion32(FSR)
2911492SN/A        Bitfield<3, 0> fsLow;
2921492SN/A        Bitfield<7, 4> domain;
2932798Sktlim@umich.edu        Bitfield<10> fsHigh;
294180SN/A        Bitfield<11> wnr;
295180SN/A        Bitfield<12> ext;
296180SN/A    EndBitUnion(FSR)
2974192Sktlim@umich.edu};
298180SN/A
299124SN/A#endif // __ARCH_ARM_MISCREGS_HH__
300124SN/A