miscregs.hh revision 7267:fcbf902646a8
11689SN/A/*
21689SN/A * Copyright (c) 2010 ARM Limited
39919Ssteve.reinhardt@amd.com * All rights reserved
41689SN/A *
51689SN/A * The license below extends only to copyright in the software and shall
61689SN/A * not be construed as granting a license to any other intellectual
71689SN/A * property including but not limited to intellectual property relating
81689SN/A * to a hardware implementation of the functionality of the software
91689SN/A * licensed hereunder.  You may use the software subject to the license
101689SN/A * terms below provided that you ensure that this notice is replicated
111689SN/A * unmodified and in its entirety in all distributions of the software,
121689SN/A * modified or unmodified, in source code or in binary form.
131689SN/A *
141689SN/A * Copyright (c) 2009 The Regents of The University of Michigan
151689SN/A * All rights reserved.
161689SN/A *
171689SN/A * Redistribution and use in source and binary forms, with or without
181689SN/A * modification, are permitted provided that the following conditions are
191689SN/A * met: redistributions of source code must retain the above copyright
201689SN/A * notice, this list of conditions and the following disclaimer;
211689SN/A * redistributions in binary form must reproduce the above copyright
221689SN/A * notice, this list of conditions and the following disclaimer in the
231689SN/A * documentation and/or other materials provided with the distribution;
241689SN/A * neither the name of the copyright holders nor the names of its
251689SN/A * contributors may be used to endorse or promote products derived from
261689SN/A * this software without specific prior written permission.
271689SN/A *
282665Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292665Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
301689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
311689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322292SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332292SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
341060SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
358229Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
368229Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
378229Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
388229Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
391717SN/A *
408229Snate@binkert.org * Authors: Gabe Black
411717SN/A */
422292SN/A#ifndef __ARCH_ARM_MISCREGS_HH__
432292SN/A#define __ARCH_ARM_MISCREGS_HH__
441717SN/A
451717SN/A#include "base/bitunion.hh"
468229Snate@binkert.org
471717SN/Anamespace ArmISA
481717SN/A{
491717SN/A    enum ConditionCode {
501061SN/A        COND_EQ  =   0,
512348SN/A        COND_NE, //  1
522348SN/A        COND_CS, //  2
532348SN/A        COND_CC, //  3
542348SN/A        COND_MI, //  4
552348SN/A        COND_PL, //  5
562348SN/A        COND_VS, //  6
572348SN/A        COND_VC, //  7
582348SN/A        COND_HI, //  8
592348SN/A        COND_LS, //  9
601060SN/A        COND_GE, // 10
611060SN/A        COND_LT, // 11
621060SN/A        COND_GT, // 12
632348SN/A        COND_LE, // 13
649919Ssteve.reinhardt@amd.com        COND_AL, // 14
652348SN/A        COND_UC  // 15
669919Ssteve.reinhardt@amd.com    };
672348SN/A
685553Snate@binkert.org    enum MiscRegIndex {
692348SN/A        MISCREG_CPSR = 0,
701060SN/A        MISCREG_SPSR,
712348SN/A        MISCREG_SPSR_FIQ,
725553Snate@binkert.org        MISCREG_SPSR_IRQ,
732348SN/A        MISCREG_SPSR_SVC,
745553Snate@binkert.org        MISCREG_SPSR_MON,
752348SN/A        MISCREG_SPSR_UND,
765553Snate@binkert.org        MISCREG_SPSR_ABT,
771060SN/A        MISCREG_FPSR,
782348SN/A        MISCREG_FPSID,
792292SN/A        MISCREG_FPSCR,
802348SN/A        MISCREG_FPEXC,
812292SN/A
822348SN/A        // CP15 registers
832292SN/A        MISCREG_CP15_START,
842348SN/A        MISCREG_SCTLR = MISCREG_CP15_START,
852292SN/A        MISCREG_DCCISW,
862348SN/A        MISCREG_DCCIMVAC,
872292SN/A        MISCREG_CONTEXTIDR,
881061SN/A        MISCREG_TPIDRURW,
891061SN/A        MISCREG_TPIDRURO,
902292SN/A        MISCREG_TPIDRPRW,
911061SN/A        MISCREG_CP15_UNIMP_START,
921061SN/A        MISCREG_CTR = MISCREG_CP15_UNIMP_START,
932292SN/A        MISCREG_TCMTR,
941061SN/A        MISCREG_MPUIR,
951061SN/A        MISCREG_MPIDR,
962292SN/A        MISCREG_MIDR,
971061SN/A        MISCREG_ID_PFR0,
981061SN/A        MISCREG_ID_PFR1,
992292SN/A        MISCREG_ID_DFR0,
1001061SN/A        MISCREG_ID_AFR0,
1011061SN/A        MISCREG_ID_MMFR0,
1025553Snate@binkert.org        MISCREG_ID_MMFR1,
1031061SN/A        MISCREG_ID_MMFR2,
1041061SN/A        MISCREG_ID_MMFR3,
1052292SN/A        MISCREG_ID_ISAR0,
1061061SN/A        MISCREG_ID_ISAR1,
1071060SN/A        MISCREG_ID_ISAR2,
1081060SN/A        MISCREG_ID_ISAR3,
1092292SN/A        MISCREG_ID_ISAR4,
110        MISCREG_ID_ISAR5,
111        MISCREG_CCSIDR,
112        MISCREG_CLIDR,
113        MISCREG_AIDR,
114        MISCREG_CSSELR,
115        MISCREG_ACTLR,
116        MISCREG_CPACR,
117        MISCREG_DFSR,
118        MISCREG_IFSR,
119        MISCREG_ADFSR,
120        MISCREG_AIFSR,
121        MISCREG_DFAR,
122        MISCREG_IFAR,
123        MISCREG_DRBAR,
124        MISCREG_IRBAR,
125        MISCREG_DRSR,
126        MISCREG_IRSR,
127        MISCREG_DRACR,
128        MISCREG_IRACR,
129        MISCREG_RGNR,
130        MISCREG_ICIALLUIS,
131        MISCREG_BPIALLIS,
132        MISCREG_ICIALLU,
133        MISCREG_ICIMVAU,
134        MISCREG_CP15ISB,
135        MISCREG_BPIALL,
136        MISCREG_BPIMVA,
137        MISCREG_DCIMVAC,
138        MISCREG_DCISW,
139        MISCREG_DCCMVAC,
140        MISCREG_MCCSW,
141        MISCREG_CP15DSB,
142        MISCREG_CP15DMB,
143        MISCREG_DCCMVAU,
144
145        MISCREG_CP15_END,
146
147        // Dummy indices
148        MISCREG_NOP = MISCREG_CP15_END,
149        MISCREG_RAZ,
150
151        NUM_MISCREGS
152    };
153
154    MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
155                               unsigned crm, unsigned opc2);
156
157    const char * const miscRegName[NUM_MISCREGS] = {
158        "cpsr", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
159        "spsr_mon", "spsr_und", "spsr_abt",
160        "fpsr", "fpsid", "fpscr", "fpexc",
161        "sctlr", "dccisw", "dccimvac",
162        "contextidr", "tpidrurw", "tpidruro", "tpidrprw",
163        "ctr", "tcmtr", "mpuir", "mpidr", "midr",
164        "id_pfr0", "id_pfr1", "id_dfr0", "id_afr0",
165        "id_mmfr0", "id_mmfr1", "id_mmfr2", "id_mmfr3",
166        "id_isar0", "id_isar1", "id_isar2", "id_isar3", "id_isar4", "id_isar5",
167        "ccsidr", "clidr", "aidr", "csselr", "actlr", "cpacr",
168        "dfsr", "ifsr", "adfsr", "aifsr", "dfar", "ifar",
169        "drbar", "irbar", "drsr", "irsr", "dracr", "iracr",
170        "rgnr", "icialluis", "bpiallis", "iciallu", "icimvau",
171        "cp15isb", "bpiall", "bpimva", "dcimvac", "dcisw", "dccmvac", "mccsw",
172        "cp15dsb", "cp15dmb", "dccmvau",
173        "nop", "raz"
174    };
175
176    BitUnion32(CPSR)
177        Bitfield<31> n;
178        Bitfield<30> z;
179        Bitfield<29> c;
180        Bitfield<28> v;
181        Bitfield<27> q;
182        Bitfield<26,25> it1;
183        Bitfield<24> j;
184        Bitfield<19, 16> ge;
185        Bitfield<15,10> it2;
186        Bitfield<9> e;
187        Bitfield<8> a;
188        Bitfield<7> i;
189        Bitfield<6> f;
190        Bitfield<5> t;
191        Bitfield<4, 0> mode;
192    EndBitUnion(CPSR)
193
194    // This mask selects bits of the CPSR that actually go in the CondCodes
195    // integer register to allow renaming.
196    static const uint32_t CondCodesMask = 0xF80F0000;
197
198    // These otherwise unused bits of the PC are used to select a mode
199    // like the J and T bits of the CPSR.
200    static const Addr PcJBitShift = 33;
201    static const Addr PcTBitShift = 34;
202    static const Addr PcModeMask = (ULL(1) << PcJBitShift) |
203                                   (ULL(1) << PcTBitShift);
204
205    BitUnion32(SCTLR)
206        Bitfield<30> te;  // Thumb Exception Enable
207        Bitfield<29> afe; // Access flag enable
208        Bitfield<28> tre; // TEX Remap bit
209        Bitfield<27> nmfi;// Non-maskable fast interrupts enable
210        Bitfield<25> ee;  // Exception Endianness bit
211        Bitfield<24> ve;  // Interrupt vectors enable
212        Bitfield<23> rao1;// Read as one
213        Bitfield<22> u;   // Alignment (now unused)
214        Bitfield<21> fi;  // Fast interrupts configuration enable
215        Bitfield<18> rao2;// Read as one
216        Bitfield<17> ha;  // Hardware access flag enable
217        Bitfield<16> rao3;// Read as one
218        Bitfield<14> rr;  // Round robin cache replacement
219        Bitfield<13> v;   // Base address for exception vectors
220        Bitfield<12> i;   // instruction cache enable
221        Bitfield<11> z;   // branch prediction enable bit
222        Bitfield<10> sw;  // Enable swp/swpb
223        Bitfield<6,3> rao4;// Read as one
224        Bitfield<7>  b;   // Endianness support (unused)
225        Bitfield<2>  c;   // Cache enable bit
226        Bitfield<1>  a;   // Alignment fault checking
227        Bitfield<0>  m;   // MMU enable bit
228    EndBitUnion(SCTLR)
229};
230
231#endif // __ARCH_ARM_MISCREGS_HH__
232