miscregs.hh revision 7362
12623SN/A/*
22623SN/A * Copyright (c) 2010 ARM Limited
32623SN/A * All rights reserved
42623SN/A *
52623SN/A * The license below extends only to copyright in the software and shall
62623SN/A * not be construed as granting a license to any other intellectual
72623SN/A * property including but not limited to intellectual property relating
82623SN/A * to a hardware implementation of the functionality of the software
92623SN/A * licensed hereunder.  You may use the software subject to the license
102623SN/A * terms below provided that you ensure that this notice is replicated
112623SN/A * unmodified and in its entirety in all distributions of the software,
122623SN/A * modified or unmodified, in source code or in binary form.
132623SN/A *
142623SN/A * Copyright (c) 2009 The Regents of The University of Michigan
152623SN/A * All rights reserved.
162623SN/A *
172623SN/A * Redistribution and use in source and binary forms, with or without
182623SN/A * modification, are permitted provided that the following conditions are
192623SN/A * met: redistributions of source code must retain the above copyright
202623SN/A * notice, this list of conditions and the following disclaimer;
212623SN/A * redistributions in binary form must reproduce the above copyright
222623SN/A * notice, this list of conditions and the following disclaimer in the
232623SN/A * documentation and/or other materials provided with the distribution;
242623SN/A * neither the name of the copyright holders nor the names of its
252623SN/A * contributors may be used to endorse or promote products derived from
262623SN/A * this software without specific prior written permission.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
313170Sstever@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372901Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392623SN/A *
402623SN/A * Authors: Gabe Black
412623SN/A */
422623SN/A#ifndef __ARCH_ARM_MISCREGS_HH__
432623SN/A#define __ARCH_ARM_MISCREGS_HH__
442623SN/A
452623SN/A#include "base/bitunion.hh"
462623SN/A
472623SN/Anamespace ArmISA
482623SN/A{
492623SN/A    enum ConditionCode {
502623SN/A        COND_EQ  =   0,
512623SN/A        COND_NE, //  1
522623SN/A        COND_CS, //  2
532623SN/A        COND_CC, //  3
542623SN/A        COND_MI, //  4
552623SN/A        COND_PL, //  5
562623SN/A        COND_VS, //  6
572623SN/A        COND_VC, //  7
582623SN/A        COND_HI, //  8
592623SN/A        COND_LS, //  9
602856Srdreslin@umich.edu        COND_GE, // 10
612856Srdreslin@umich.edu        COND_LT, // 11
622856Srdreslin@umich.edu        COND_GT, // 12
632856Srdreslin@umich.edu        COND_LE, // 13
642856Srdreslin@umich.edu        COND_AL, // 14
652856Srdreslin@umich.edu        COND_UC  // 15
662856Srdreslin@umich.edu    };
672856Srdreslin@umich.edu
682856Srdreslin@umich.edu    enum MiscRegIndex {
692856Srdreslin@umich.edu        MISCREG_CPSR = 0,
702623SN/A        MISCREG_SPSR,
712623SN/A        MISCREG_SPSR_FIQ,
722623SN/A        MISCREG_SPSR_IRQ,
732623SN/A        MISCREG_SPSR_SVC,
742623SN/A        MISCREG_SPSR_MON,
752856Srdreslin@umich.edu        MISCREG_SPSR_UND,
762856Srdreslin@umich.edu        MISCREG_SPSR_ABT,
772856Srdreslin@umich.edu        MISCREG_FPSR,
782623SN/A        MISCREG_FPSID,
792856Srdreslin@umich.edu        MISCREG_FPSCR,
802856Srdreslin@umich.edu        MISCREG_FPEXC,
812856Srdreslin@umich.edu        MISCREG_MVFR0,
822623SN/A        MISCREG_MVFR1,
832623SN/A        MISCREG_SEV_MAILBOX,
842623SN/A
852680Sktlim@umich.edu        // CP15 registers
862680Sktlim@umich.edu        MISCREG_CP15_START,
872623SN/A        MISCREG_SCTLR = MISCREG_CP15_START,
882623SN/A        MISCREG_DCCISW,
892680Sktlim@umich.edu        MISCREG_DCCIMVAC,
902623SN/A        MISCREG_DCCMVAC,
912623SN/A        MISCREG_CONTEXTIDR,
922623SN/A        MISCREG_TPIDRURW,
932623SN/A        MISCREG_TPIDRURO,
942623SN/A        MISCREG_TPIDRPRW,
952630SN/A        MISCREG_CP15ISB,
962623SN/A        MISCREG_CP15DSB,
973184Srdreslin@umich.edu        MISCREG_CP15DMB,
982623SN/A        MISCREG_CPACR,
992623SN/A        MISCREG_CLIDR,
1002623SN/A        MISCREG_CCSIDR,
1012623SN/A        MISCREG_CSSELR,
1022630SN/A        MISCREG_ICIALLUIS,
1032623SN/A        MISCREG_ICIALLU,
1042623SN/A        MISCREG_ICIMVAU,
1052623SN/A        MISCREG_BPIMVA,
1062623SN/A        MISCREG_BPIALLIS,
1072623SN/A        MISCREG_BPIALL,
1082623SN/A        MISCREG_MIDR,
1092630SN/A        MISCREG_TTBR0,
1102623SN/A        MISCREG_TTBR1,
1113184Srdreslin@umich.edu        MISCREG_TLBTR,
1123184Srdreslin@umich.edu        MISCREG_DACR,
1132623SN/A        MISCREG_TLBIALLIS,
1142623SN/A        MISCREG_TLBIMVAIS,
1152623SN/A        MISCREG_TLBIASIDIS,
1162623SN/A        MISCREG_TLBIMVAAIS,
1172623SN/A        MISCREG_ITLBIALL,
1182626SN/A        MISCREG_ITLBIMVA,
1192626SN/A        MISCREG_ITLBIASID,
1202626SN/A        MISCREG_DTLBIALL,
1212623SN/A        MISCREG_DTLBIMVA,
1222623SN/A        MISCREG_DTLBIASID,
1232623SN/A        MISCREG_TLBIALL,
1242657Ssaidi@eecs.umich.edu        MISCREG_TLBIMVA,
1252623SN/A        MISCREG_TLBIASID,
1262623SN/A        MISCREG_TLBIMVAA,
1272623SN/A        MISCREG_DFSR,
1282623SN/A        MISCREG_IFSR,
1292623SN/A        MISCREG_DFAR,
1302623SN/A        MISCREG_IFAR,
1312623SN/A        MISCREG_CP15_UNIMP_START,
1322623SN/A        MISCREG_CTR = MISCREG_CP15_UNIMP_START,
1332623SN/A        MISCREG_TCMTR,
1342640Sstever@eecs.umich.edu        MISCREG_MPIDR,
1352623SN/A        MISCREG_ID_PFR0,
1362623SN/A        MISCREG_ID_PFR1,
1372623SN/A        MISCREG_ID_DFR0,
1382663Sstever@eecs.umich.edu        MISCREG_ID_AFR0,
1393170Sstever@eecs.umich.edu        MISCREG_ID_MMFR0,
1402641Sstever@eecs.umich.edu        MISCREG_ID_MMFR1,
1412623SN/A        MISCREG_ID_MMFR2,
1422623SN/A        MISCREG_ID_MMFR3,
1432663Sstever@eecs.umich.edu        MISCREG_ID_ISAR0,
1443170Sstever@eecs.umich.edu        MISCREG_ID_ISAR1,
1452641Sstever@eecs.umich.edu        MISCREG_ID_ISAR2,
1462641Sstever@eecs.umich.edu        MISCREG_ID_ISAR3,
1472623SN/A        MISCREG_ID_ISAR4,
1482623SN/A        MISCREG_ID_ISAR5,
1492663Sstever@eecs.umich.edu        MISCREG_PAR,
1503170Sstever@eecs.umich.edu        MISCREG_AIDR,
1512641Sstever@eecs.umich.edu        MISCREG_ACTLR,
1522641Sstever@eecs.umich.edu        MISCREG_ADFSR,
1532623SN/A        MISCREG_AIFSR,
1542623SN/A        MISCREG_DCIMVAC,
1552623SN/A        MISCREG_DCISW,
1562623SN/A        MISCREG_MCCSW,
1572623SN/A        MISCREG_DCCMVAU,
1582623SN/A        MISCREG_SCR,
1592623SN/A        MISCREG_SDER,
1602623SN/A        MISCREG_NSACR,
1612623SN/A        MISCREG_TTBCR,
1622623SN/A        MISCREG_V2PCWPR,
1632915Sktlim@umich.edu        MISCREG_V2PCWPW,
1642915Sktlim@umich.edu        MISCREG_V2PCWUR,
1653177Shsul@eecs.umich.edu        MISCREG_V2PCWUW,
1663177Shsul@eecs.umich.edu        MISCREG_V2POWPR,
1673145Shsul@eecs.umich.edu        MISCREG_V2POWPW,
1682623SN/A        MISCREG_V2POWUR,
1692623SN/A        MISCREG_V2POWUW,
1702623SN/A        MISCREG_PRRR,
1712623SN/A        MISCREG_NMRR,
1722623SN/A        MISCREG_VBAR,
1732623SN/A        MISCREG_MVBAR,
1742623SN/A        MISCREG_ISR,
1752915Sktlim@umich.edu        MISCREG_FCEIDR,
1762915Sktlim@umich.edu
1773177Shsul@eecs.umich.edu
1783145Shsul@eecs.umich.edu        MISCREG_CP15_END,
1792915Sktlim@umich.edu
1802915Sktlim@umich.edu        // Dummy indices
1812915Sktlim@umich.edu        MISCREG_NOP = MISCREG_CP15_END,
1822915Sktlim@umich.edu        MISCREG_RAZ,
1832915Sktlim@umich.edu
1842915Sktlim@umich.edu        NUM_MISCREGS
1852926Sktlim@umich.edu    };
1862915Sktlim@umich.edu
1873201Shsul@eecs.umich.edu    MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
1882915Sktlim@umich.edu                               unsigned crm, unsigned opc2);
1892915Sktlim@umich.edu
1902915Sktlim@umich.edu    const char * const miscRegName[NUM_MISCREGS] = {
1912623SN/A        "cpsr", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
1922623SN/A        "spsr_mon", "spsr_und", "spsr_abt",
1932623SN/A        "fpsr", "fpsid", "fpscr", "fpexc", "mvfr0", "mvfr1",
1942798Sktlim@umich.edu        "sev_mailbox",
1952623SN/A        "sctlr", "dccisw", "dccimvac", "dccmvac",
1962798Sktlim@umich.edu        "contextidr", "tpidrurw", "tpidruro", "tpidrprw",
1972798Sktlim@umich.edu        "cp15isb", "cp15dsb", "cp15dmb", "cpacr",
1982623SN/A        "clidr", "ccsidr", "csselr",
1992798Sktlim@umich.edu        "icialluis", "iciallu", "icimvau",
2002623SN/A        "bpimva", "bpiallis", "bpiall",
2012623SN/A        "midr", "ttbr0", "ttbr1", "tlbtr", "dacr",
2022623SN/A        "tlbiallis", "tlbimvais", "tlbiasidis", "tlbimvaais",
2032623SN/A        "itlbiall", "itlbimva", "itlbiasid",
2042623SN/A        "dtlbiall", "dtlbimva", "dtlbiasid",
2052623SN/A        "tlbiall", "tlbimva", "tlbiasid", "tlbimvaa",
2062623SN/A        "dfsr", "ifsr", "dfar", "ifar",
2072623SN/A        "ctr", "tcmtr", "mpidr",
2082623SN/A        "id_pfr0", "id_pfr1", "id_dfr0", "id_afr0",
2092623SN/A        "id_mmfr0", "id_mmfr1", "id_mmfr2", "id_mmfr3",
2102680Sktlim@umich.edu        "id_isar0", "id_isar1", "id_isar2", "id_isar3", "id_isar4", "id_isar5",
2112623SN/A        "par", "aidr", "actlr",
2122680Sktlim@umich.edu        "adfsr", "aifsr",
2132680Sktlim@umich.edu        "dcimvac", "dcisw", "mccsw",
2142680Sktlim@umich.edu        "dccmvau",
2152623SN/A        "scr", "sder", "nsacr", "ttbcr",
2162623SN/A        "v2pcwpr", "v2pcwpw", "v2pcwur", "v2pcwuw",
2172623SN/A        "v2powpr", "v2powpw", "v2powur", "v2powuw",
2182623SN/A        "prrr", "nmrr", "vbar", "mvbar", "isr", "fceidr",
2192623SN/A        "nop", "raz"
2202623SN/A    };
2212623SN/A
2222623SN/A    BitUnion32(CPSR)
2232623SN/A        Bitfield<31> n;
2242623SN/A        Bitfield<30> z;
2252623SN/A        Bitfield<29> c;
2262623SN/A        Bitfield<28> v;
2272683Sktlim@umich.edu        Bitfield<27> q;
2282623SN/A        Bitfield<26,25> it1;
2292623SN/A        Bitfield<24> j;
2302623SN/A        Bitfield<19, 16> ge;
2312623SN/A        Bitfield<15,10> it2;
2322623SN/A        Bitfield<9> e;
2332623SN/A        Bitfield<8> a;
2342623SN/A        Bitfield<7> i;
2352623SN/A        Bitfield<6> f;
2362623SN/A        Bitfield<5> t;
2372623SN/A        Bitfield<4, 0> mode;
2382623SN/A    EndBitUnion(CPSR)
2392623SN/A
2402623SN/A    // This mask selects bits of the CPSR that actually go in the CondCodes
2412623SN/A    // integer register to allow renaming.
2422683Sktlim@umich.edu    static const uint32_t CondCodesMask = 0xF80F0000;
2432623SN/A
2442623SN/A    BitUnion32(SCTLR)
2452626SN/A        Bitfield<31> ie;  // Instruction endianness
2462626SN/A        Bitfield<30> te;  // Thumb Exception Enable
2472626SN/A        Bitfield<29> afe; // Access flag enable
2482626SN/A        Bitfield<28> tre; // TEX Remap bit
2492626SN/A        Bitfield<27> nmfi;// Non-maskable fast interrupts enable
2502623SN/A        Bitfield<25> ee;  // Exception Endianness bit
2512623SN/A        Bitfield<24> ve;  // Interrupt vectors enable
2522623SN/A        Bitfield<23> rao1;// Read as one
2532623SN/A        Bitfield<22> u;   // Alignment (now unused)
2542623SN/A        Bitfield<21> fi;  // Fast interrupts configuration enable
2552623SN/A        Bitfield<19> dz;  // Divide by Zero fault enable bit
2562623SN/A        Bitfield<18> rao2;// Read as one
2572623SN/A        Bitfield<17> br;  // Background region bit
2582623SN/A        Bitfield<16> rao3;// Read as one
2592623SN/A        Bitfield<14> rr;  // Round robin cache replacement
2603169Sstever@eecs.umich.edu        Bitfield<13> v;   // Base address for exception vectors
2613169Sstever@eecs.umich.edu        Bitfield<12> i;   // instruction cache enable
2623169Sstever@eecs.umich.edu        Bitfield<11> z;   // branch prediction enable bit
2633169Sstever@eecs.umich.edu        Bitfield<10> sw;  // Enable swp/swpb
2643169Sstever@eecs.umich.edu        Bitfield<6,3> rao4;// Read as one
2652623SN/A        Bitfield<7>  b;   // Endianness support (unused)
2662623SN/A        Bitfield<2>  c;   // Cache enable bit
2672623SN/A        Bitfield<1>  a;   // Alignment fault checking
2682623SN/A        Bitfield<0>  m;   // MMU enable bit
2692623SN/A    EndBitUnion(SCTLR)
2702623SN/A
2713169Sstever@eecs.umich.edu    BitUnion32(CPACR)
2722623SN/A        Bitfield<1, 0> cp0;
2732623SN/A        Bitfield<3, 2> cp1;
2742623SN/A        Bitfield<5, 4> cp2;
2753169Sstever@eecs.umich.edu        Bitfield<7, 6> cp3;
2762623SN/A        Bitfield<9, 8> cp4;
2773169Sstever@eecs.umich.edu        Bitfield<11, 10> cp5;
2782623SN/A        Bitfield<13, 12> cp6;
2792623SN/A        Bitfield<15, 14> cp7;
2803169Sstever@eecs.umich.edu        Bitfield<17, 16> cp8;
2813169Sstever@eecs.umich.edu        Bitfield<19, 18> cp9;
2823170Sstever@eecs.umich.edu        Bitfield<21, 20> cp10;
2833170Sstever@eecs.umich.edu        Bitfield<23, 22> cp11;
2843170Sstever@eecs.umich.edu        Bitfield<25, 24> cp12;
2853170Sstever@eecs.umich.edu        Bitfield<27, 26> cp13;
2862623SN/A        Bitfield<30> d32dis;
2872623SN/A        Bitfield<31> asedis;
2882623SN/A    EndBitUnion(CPACR)
2893172Sstever@eecs.umich.edu
2902623SN/A    BitUnion32(FSR)
2912623SN/A        Bitfield<3, 0> fsLow;
2922623SN/A        Bitfield<7, 4> domain;
2932623SN/A        Bitfield<10> fsHigh;
2942623SN/A        Bitfield<11> wnr;
2952623SN/A        Bitfield<12> ext;
2962623SN/A    EndBitUnion(FSR)
2972623SN/A};
2982623SN/A
2992623SN/A#endif // __ARCH_ARM_MISCREGS_HH__
3002623SN/A