miscregs.hh revision 7354
16242Sgblack@eecs.umich.edu/*
27093Sgblack@eecs.umich.edu * Copyright (c) 2010 ARM Limited
37093Sgblack@eecs.umich.edu * All rights reserved
47093Sgblack@eecs.umich.edu *
57093Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall
67093Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual
77093Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating
87093Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software
97093Sgblack@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
107093Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
117093Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
127093Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form.
137093Sgblack@eecs.umich.edu *
146242Sgblack@eecs.umich.edu * Copyright (c) 2009 The Regents of The University of Michigan
156242Sgblack@eecs.umich.edu * All rights reserved.
166242Sgblack@eecs.umich.edu *
176242Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
186242Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
196242Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
206242Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
216242Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
226242Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
236242Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
246242Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
256242Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
266242Sgblack@eecs.umich.edu * this software without specific prior written permission.
276242Sgblack@eecs.umich.edu *
286242Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
296242Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
306242Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
316242Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
326242Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
336242Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
346242Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
356242Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
366242Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
376242Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386242Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396242Sgblack@eecs.umich.edu *
406242Sgblack@eecs.umich.edu * Authors: Gabe Black
416242Sgblack@eecs.umich.edu */
426242Sgblack@eecs.umich.edu#ifndef __ARCH_ARM_MISCREGS_HH__
436242Sgblack@eecs.umich.edu#define __ARCH_ARM_MISCREGS_HH__
446242Sgblack@eecs.umich.edu
456242Sgblack@eecs.umich.edu#include "base/bitunion.hh"
466242Sgblack@eecs.umich.edu
476242Sgblack@eecs.umich.edunamespace ArmISA
486242Sgblack@eecs.umich.edu{
496242Sgblack@eecs.umich.edu    enum ConditionCode {
506242Sgblack@eecs.umich.edu        COND_EQ  =   0,
516242Sgblack@eecs.umich.edu        COND_NE, //  1
526242Sgblack@eecs.umich.edu        COND_CS, //  2
536242Sgblack@eecs.umich.edu        COND_CC, //  3
546242Sgblack@eecs.umich.edu        COND_MI, //  4
556242Sgblack@eecs.umich.edu        COND_PL, //  5
566242Sgblack@eecs.umich.edu        COND_VS, //  6
576242Sgblack@eecs.umich.edu        COND_VC, //  7
586242Sgblack@eecs.umich.edu        COND_HI, //  8
596242Sgblack@eecs.umich.edu        COND_LS, //  9
606242Sgblack@eecs.umich.edu        COND_GE, // 10
616242Sgblack@eecs.umich.edu        COND_LT, // 11
626242Sgblack@eecs.umich.edu        COND_GT, // 12
636242Sgblack@eecs.umich.edu        COND_LE, // 13
646242Sgblack@eecs.umich.edu        COND_AL, // 14
657111Sgblack@eecs.umich.edu        COND_UC  // 15
666242Sgblack@eecs.umich.edu    };
676242Sgblack@eecs.umich.edu
686242Sgblack@eecs.umich.edu    enum MiscRegIndex {
696242Sgblack@eecs.umich.edu        MISCREG_CPSR = 0,
706735Sgblack@eecs.umich.edu        MISCREG_SPSR,
716242Sgblack@eecs.umich.edu        MISCREG_SPSR_FIQ,
726242Sgblack@eecs.umich.edu        MISCREG_SPSR_IRQ,
736242Sgblack@eecs.umich.edu        MISCREG_SPSR_SVC,
746723Sgblack@eecs.umich.edu        MISCREG_SPSR_MON,
756242Sgblack@eecs.umich.edu        MISCREG_SPSR_UND,
766242Sgblack@eecs.umich.edu        MISCREG_SPSR_ABT,
776261Sgblack@eecs.umich.edu        MISCREG_FPSR,
786403Sgblack@eecs.umich.edu        MISCREG_FPSID,
796403Sgblack@eecs.umich.edu        MISCREG_FPSCR,
806403Sgblack@eecs.umich.edu        MISCREG_FPEXC,
817325Sgblack@eecs.umich.edu        MISCREG_MVFR0,
827325Sgblack@eecs.umich.edu        MISCREG_MVFR1,
837350SAli.Saidi@ARM.com        MISCREG_SEV_MAILBOX,
847259Sgblack@eecs.umich.edu
857259Sgblack@eecs.umich.edu        // CP15 registers
867259Sgblack@eecs.umich.edu        MISCREG_CP15_START,
877259Sgblack@eecs.umich.edu        MISCREG_SCTLR = MISCREG_CP15_START,
887264Sgblack@eecs.umich.edu        MISCREG_DCCISW,
897267Sgblack@eecs.umich.edu        MISCREG_DCCIMVAC,
907285Sgblack@eecs.umich.edu        MISCREG_DCCMVAC,
917265Sgblack@eecs.umich.edu        MISCREG_CONTEXTIDR,
927266Sgblack@eecs.umich.edu        MISCREG_TPIDRURW,
937266Sgblack@eecs.umich.edu        MISCREG_TPIDRURO,
947266Sgblack@eecs.umich.edu        MISCREG_TPIDRPRW,
957268Sgblack@eecs.umich.edu        MISCREG_CP15ISB,
967272Sgblack@eecs.umich.edu        MISCREG_CP15DSB,
977272Sgblack@eecs.umich.edu        MISCREG_CP15DMB,
987271Sgblack@eecs.umich.edu        MISCREG_CPACR,
997273Sgblack@eecs.umich.edu        MISCREG_CLIDR,
1007287Sgblack@eecs.umich.edu        MISCREG_CCSIDR,
1017287Sgblack@eecs.umich.edu        MISCREG_CSSELR,
1027274Sgblack@eecs.umich.edu        MISCREG_ICIALLUIS,
1037275Sgblack@eecs.umich.edu        MISCREG_ICIALLU,
1047276Sgblack@eecs.umich.edu        MISCREG_ICIMVAU,
1057286Sgblack@eecs.umich.edu        MISCREG_BPIMVA,
1067297Sgblack@eecs.umich.edu        MISCREG_BPIALLIS,
1077297Sgblack@eecs.umich.edu        MISCREG_BPIALL,
1087298Sgblack@eecs.umich.edu        MISCREG_MIDR,
1097352Sgblack@eecs.umich.edu        MISCREG_TTBR0,
1107352Sgblack@eecs.umich.edu        MISCREG_TTBR1,
1117354Sgblack@eecs.umich.edu        MISCREG_TLBTR,
1127353Sgblack@eecs.umich.edu        MISCREG_DACR,
1137259Sgblack@eecs.umich.edu        MISCREG_CP15_UNIMP_START,
1147259Sgblack@eecs.umich.edu        MISCREG_CTR = MISCREG_CP15_UNIMP_START,
1157259Sgblack@eecs.umich.edu        MISCREG_TCMTR,
1167259Sgblack@eecs.umich.edu        MISCREG_MPIDR,
1177259Sgblack@eecs.umich.edu        MISCREG_ID_PFR0,
1187259Sgblack@eecs.umich.edu        MISCREG_ID_PFR1,
1197259Sgblack@eecs.umich.edu        MISCREG_ID_DFR0,
1207259Sgblack@eecs.umich.edu        MISCREG_ID_AFR0,
1217259Sgblack@eecs.umich.edu        MISCREG_ID_MMFR0,
1227259Sgblack@eecs.umich.edu        MISCREG_ID_MMFR1,
1237259Sgblack@eecs.umich.edu        MISCREG_ID_MMFR2,
1247259Sgblack@eecs.umich.edu        MISCREG_ID_MMFR3,
1257259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR0,
1267259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR1,
1277259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR2,
1287259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR3,
1297259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR4,
1307259Sgblack@eecs.umich.edu        MISCREG_ID_ISAR5,
1317351Sgblack@eecs.umich.edu        MISCREG_PAR,
1327259Sgblack@eecs.umich.edu        MISCREG_AIDR,
1337259Sgblack@eecs.umich.edu        MISCREG_ACTLR,
1347259Sgblack@eecs.umich.edu        MISCREG_DFSR,
1357259Sgblack@eecs.umich.edu        MISCREG_IFSR,
1367259Sgblack@eecs.umich.edu        MISCREG_ADFSR,
1377259Sgblack@eecs.umich.edu        MISCREG_AIFSR,
1387259Sgblack@eecs.umich.edu        MISCREG_DFAR,
1397259Sgblack@eecs.umich.edu        MISCREG_IFAR,
1407259Sgblack@eecs.umich.edu        MISCREG_DCIMVAC,
1417259Sgblack@eecs.umich.edu        MISCREG_DCISW,
1427259Sgblack@eecs.umich.edu        MISCREG_MCCSW,
1437259Sgblack@eecs.umich.edu        MISCREG_DCCMVAU,
1447351Sgblack@eecs.umich.edu        MISCREG_SCR,
1457351Sgblack@eecs.umich.edu        MISCREG_SDER,
1467351Sgblack@eecs.umich.edu        MISCREG_NSACR,
1477351Sgblack@eecs.umich.edu        MISCREG_TTBCR,
1487351Sgblack@eecs.umich.edu        MISCREG_V2PCWPR,
1497351Sgblack@eecs.umich.edu        MISCREG_V2PCWPW,
1507351Sgblack@eecs.umich.edu        MISCREG_V2PCWUR,
1517351Sgblack@eecs.umich.edu        MISCREG_V2PCWUW,
1527351Sgblack@eecs.umich.edu        MISCREG_V2POWPR,
1537351Sgblack@eecs.umich.edu        MISCREG_V2POWPW,
1547351Sgblack@eecs.umich.edu        MISCREG_V2POWUR,
1557351Sgblack@eecs.umich.edu        MISCREG_V2POWUW,
1567351Sgblack@eecs.umich.edu        MISCREG_TLBIALLIS,
1577351Sgblack@eecs.umich.edu        MISCREG_TLBIMVAIS,
1587351Sgblack@eecs.umich.edu        MISCREG_TLBIASIDIS,
1597351Sgblack@eecs.umich.edu        MISCREG_TLBIMVAAIS,
1607351Sgblack@eecs.umich.edu        MISCREG_ITLBIALL,
1617351Sgblack@eecs.umich.edu        MISCREG_ITLBIMVA,
1627351Sgblack@eecs.umich.edu        MISCREG_ITLBIASID,
1637351Sgblack@eecs.umich.edu        MISCREG_DTLBIALL,
1647351Sgblack@eecs.umich.edu        MISCREG_DTLBIMVA,
1657351Sgblack@eecs.umich.edu        MISCREG_DTLBIASID,
1667351Sgblack@eecs.umich.edu        MISCREG_TLBIALL,
1677351Sgblack@eecs.umich.edu        MISCREG_TLBIMVA,
1687351Sgblack@eecs.umich.edu        MISCREG_TLBIASID,
1697351Sgblack@eecs.umich.edu        MISCREG_TLBIMVAA,
1707351Sgblack@eecs.umich.edu        MISCREG_PRRR,
1717351Sgblack@eecs.umich.edu        MISCREG_NMRR,
1727351Sgblack@eecs.umich.edu        MISCREG_VBAR,
1737351Sgblack@eecs.umich.edu        MISCREG_MVBAR,
1747351Sgblack@eecs.umich.edu        MISCREG_ISR,
1757351Sgblack@eecs.umich.edu        MISCREG_FCEIDR,
1767351Sgblack@eecs.umich.edu
1777259Sgblack@eecs.umich.edu
1787259Sgblack@eecs.umich.edu        MISCREG_CP15_END,
1797259Sgblack@eecs.umich.edu
1807259Sgblack@eecs.umich.edu        // Dummy indices
1817259Sgblack@eecs.umich.edu        MISCREG_NOP = MISCREG_CP15_END,
1827259Sgblack@eecs.umich.edu        MISCREG_RAZ,
1837259Sgblack@eecs.umich.edu
1846735Sgblack@eecs.umich.edu        NUM_MISCREGS
1856261Sgblack@eecs.umich.edu    };
1866261Sgblack@eecs.umich.edu
1877259Sgblack@eecs.umich.edu    MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
1887259Sgblack@eecs.umich.edu                               unsigned crm, unsigned opc2);
1897259Sgblack@eecs.umich.edu
1906261Sgblack@eecs.umich.edu    const char * const miscRegName[NUM_MISCREGS] = {
1917259Sgblack@eecs.umich.edu        "cpsr", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
1927259Sgblack@eecs.umich.edu        "spsr_mon", "spsr_und", "spsr_abt",
1937351Sgblack@eecs.umich.edu        "fpsr", "fpsid", "fpscr", "fpexc", "mvfr0", "mvfr1",
1947351Sgblack@eecs.umich.edu        "sev_mailbox",
1957285Sgblack@eecs.umich.edu        "sctlr", "dccisw", "dccimvac", "dccmvac",
1967267Sgblack@eecs.umich.edu        "contextidr", "tpidrurw", "tpidruro", "tpidrprw",
1977287Sgblack@eecs.umich.edu        "cp15isb", "cp15dsb", "cp15dmb", "cpacr",
1987287Sgblack@eecs.umich.edu        "clidr", "ccsidr", "csselr",
1997297Sgblack@eecs.umich.edu        "icialluis", "iciallu", "icimvau",
2007297Sgblack@eecs.umich.edu        "bpimva", "bpiallis", "bpiall",
2017354Sgblack@eecs.umich.edu        "midr", "ttbr0", "ttbr1", "tlbtr", "dacr", "ctr", "tcmtr", "mpidr",
2027259Sgblack@eecs.umich.edu        "id_pfr0", "id_pfr1", "id_dfr0", "id_afr0",
2037259Sgblack@eecs.umich.edu        "id_mmfr0", "id_mmfr1", "id_mmfr2", "id_mmfr3",
2047259Sgblack@eecs.umich.edu        "id_isar0", "id_isar1", "id_isar2", "id_isar3", "id_isar4", "id_isar5",
2057353Sgblack@eecs.umich.edu        "par", "aidr", "actlr",
2067259Sgblack@eecs.umich.edu        "dfsr", "ifsr", "adfsr", "aifsr", "dfar", "ifar",
2077297Sgblack@eecs.umich.edu        "dcimvac", "dcisw", "mccsw",
2087272Sgblack@eecs.umich.edu        "dccmvau",
2097352Sgblack@eecs.umich.edu        "scr", "sder", "nsacr", "ttbcr",
2107351Sgblack@eecs.umich.edu        "v2pcwpr", "v2pcwpw", "v2pcwur", "v2pcwuw",
2117351Sgblack@eecs.umich.edu        "v2powpr", "v2powpw", "v2powur", "v2powuw",
2127351Sgblack@eecs.umich.edu        "tlbiallis", "tlbimvais", "tlbiasidis", "tlbimvaais",
2137351Sgblack@eecs.umich.edu        "itlbiall", "itlbimva", "itlbiasid",
2147351Sgblack@eecs.umich.edu        "dtlbiall", "dtlbimva", "dtlbiasid",
2157351Sgblack@eecs.umich.edu        "tlbiall", "tlbimva", "tlbiasid", "tlbimvaa",
2167351Sgblack@eecs.umich.edu        "prrr", "nmrr", "vbar", "mvbar", "isr", "fceidr",
2177259Sgblack@eecs.umich.edu        "nop", "raz"
2186242Sgblack@eecs.umich.edu    };
2196242Sgblack@eecs.umich.edu
2206242Sgblack@eecs.umich.edu    BitUnion32(CPSR)
2216242Sgblack@eecs.umich.edu        Bitfield<31> n;
2226242Sgblack@eecs.umich.edu        Bitfield<30> z;
2236242Sgblack@eecs.umich.edu        Bitfield<29> c;
2246242Sgblack@eecs.umich.edu        Bitfield<28> v;
2256242Sgblack@eecs.umich.edu        Bitfield<27> q;
2266735Sgblack@eecs.umich.edu        Bitfield<26,25> it1;
2276242Sgblack@eecs.umich.edu        Bitfield<24> j;
2286242Sgblack@eecs.umich.edu        Bitfield<19, 16> ge;
2296735Sgblack@eecs.umich.edu        Bitfield<15,10> it2;
2306242Sgblack@eecs.umich.edu        Bitfield<9> e;
2316242Sgblack@eecs.umich.edu        Bitfield<8> a;
2326242Sgblack@eecs.umich.edu        Bitfield<7> i;
2336242Sgblack@eecs.umich.edu        Bitfield<6> f;
2346242Sgblack@eecs.umich.edu        Bitfield<5> t;
2356242Sgblack@eecs.umich.edu        Bitfield<4, 0> mode;
2366242Sgblack@eecs.umich.edu    EndBitUnion(CPSR)
2376735Sgblack@eecs.umich.edu
2386750Sgblack@eecs.umich.edu    // This mask selects bits of the CPSR that actually go in the CondCodes
2396750Sgblack@eecs.umich.edu    // integer register to allow renaming.
2406750Sgblack@eecs.umich.edu    static const uint32_t CondCodesMask = 0xF80F0000;
2416750Sgblack@eecs.umich.edu
2426735Sgblack@eecs.umich.edu    BitUnion32(SCTLR)
2436735Sgblack@eecs.umich.edu        Bitfield<30> te;  // Thumb Exception Enable
2446735Sgblack@eecs.umich.edu        Bitfield<29> afe; // Access flag enable
2456735Sgblack@eecs.umich.edu        Bitfield<28> tre; // TEX Remap bit
2466735Sgblack@eecs.umich.edu        Bitfield<27> nmfi;// Non-maskable fast interrupts enable
2476735Sgblack@eecs.umich.edu        Bitfield<25> ee;  // Exception Endianness bit
2486735Sgblack@eecs.umich.edu        Bitfield<24> ve;  // Interrupt vectors enable
2496735Sgblack@eecs.umich.edu        Bitfield<23> rao1;// Read as one
2506735Sgblack@eecs.umich.edu        Bitfield<22> u;   // Alignment (now unused)
2516735Sgblack@eecs.umich.edu        Bitfield<21> fi;  // Fast interrupts configuration enable
2526735Sgblack@eecs.umich.edu        Bitfield<18> rao2;// Read as one
2536735Sgblack@eecs.umich.edu        Bitfield<17> ha;  // Hardware access flag enable
2546735Sgblack@eecs.umich.edu        Bitfield<16> rao3;// Read as one
2556735Sgblack@eecs.umich.edu        Bitfield<14> rr;  // Round robin cache replacement
2566735Sgblack@eecs.umich.edu        Bitfield<13> v;   // Base address for exception vectors
2576735Sgblack@eecs.umich.edu        Bitfield<12> i;   // instruction cache enable
2586735Sgblack@eecs.umich.edu        Bitfield<11> z;   // branch prediction enable bit
2596735Sgblack@eecs.umich.edu        Bitfield<10> sw;  // Enable swp/swpb
2606735Sgblack@eecs.umich.edu        Bitfield<6,3> rao4;// Read as one
2616735Sgblack@eecs.umich.edu        Bitfield<7>  b;   // Endianness support (unused)
2626735Sgblack@eecs.umich.edu        Bitfield<2>  c;   // Cache enable bit
2636735Sgblack@eecs.umich.edu        Bitfield<1>  a;   // Alignment fault checking
2646735Sgblack@eecs.umich.edu        Bitfield<0>  m;   // MMU enable bit
2656735Sgblack@eecs.umich.edu    EndBitUnion(SCTLR)
2667320Sgblack@eecs.umich.edu
2677320Sgblack@eecs.umich.edu    BitUnion32(CPACR)
2687320Sgblack@eecs.umich.edu        Bitfield<1, 0> cp0;
2697320Sgblack@eecs.umich.edu        Bitfield<3, 2> cp1;
2707320Sgblack@eecs.umich.edu        Bitfield<5, 4> cp2;
2717320Sgblack@eecs.umich.edu        Bitfield<7, 6> cp3;
2727320Sgblack@eecs.umich.edu        Bitfield<9, 8> cp4;
2737320Sgblack@eecs.umich.edu        Bitfield<11, 10> cp5;
2747320Sgblack@eecs.umich.edu        Bitfield<13, 12> cp6;
2757320Sgblack@eecs.umich.edu        Bitfield<15, 14> cp7;
2767320Sgblack@eecs.umich.edu        Bitfield<17, 16> cp8;
2777320Sgblack@eecs.umich.edu        Bitfield<19, 18> cp9;
2787320Sgblack@eecs.umich.edu        Bitfield<21, 20> cp10;
2797320Sgblack@eecs.umich.edu        Bitfield<23, 22> cp11;
2807320Sgblack@eecs.umich.edu        Bitfield<25, 24> cp12;
2817320Sgblack@eecs.umich.edu        Bitfield<27, 26> cp13;
2827320Sgblack@eecs.umich.edu        Bitfield<30> d32dis;
2837320Sgblack@eecs.umich.edu        Bitfield<31> asedis;
2847320Sgblack@eecs.umich.edu    EndBitUnion(CPACR)
2856242Sgblack@eecs.umich.edu};
2866242Sgblack@eecs.umich.edu
2876242Sgblack@eecs.umich.edu#endif // __ARCH_ARM_MISCREGS_HH__
288