miscregs.cc revision 8549
17259Sgblack@eecs.umich.edu/*
27259Sgblack@eecs.umich.edu * Copyright (c) 2010 ARM Limited
37259Sgblack@eecs.umich.edu * All rights reserved
47259Sgblack@eecs.umich.edu *
57259Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall
67259Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual
77259Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating
87259Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software
97259Sgblack@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
107259Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
117259Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
127259Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form.
137259Sgblack@eecs.umich.edu *
147259Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
157259Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
167259Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
177259Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
187259Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
197259Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
207259Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
217259Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
227259Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
237259Sgblack@eecs.umich.edu * this software without specific prior written permission.
247259Sgblack@eecs.umich.edu *
257259Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
267259Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
277259Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
287259Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
297259Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
307259Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
317259Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
327259Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
337259Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
347259Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
357259Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
367259Sgblack@eecs.umich.edu *
377259Sgblack@eecs.umich.edu * Authors: Gabe Black
387405SAli.Saidi@ARM.com *          Ali Saidi
397259Sgblack@eecs.umich.edu */
407259Sgblack@eecs.umich.edu
417405SAli.Saidi@ARM.com#include "arch/arm/isa.hh"
427259Sgblack@eecs.umich.edu#include "arch/arm/miscregs.hh"
437404SAli.Saidi@ARM.com#include "base/misc.hh"
447259Sgblack@eecs.umich.edu
457259Sgblack@eecs.umich.edunamespace ArmISA
467259Sgblack@eecs.umich.edu{
477259Sgblack@eecs.umich.edu
487259Sgblack@eecs.umich.eduMiscRegIndex
497259Sgblack@eecs.umich.edudecodeCP15Reg(unsigned crn, unsigned opc1, unsigned crm, unsigned opc2)
507259Sgblack@eecs.umich.edu{
517259Sgblack@eecs.umich.edu    switch (crn) {
527259Sgblack@eecs.umich.edu      case 0:
537259Sgblack@eecs.umich.edu        switch (opc1) {
547259Sgblack@eecs.umich.edu          case 0:
557259Sgblack@eecs.umich.edu            switch (crm) {
567259Sgblack@eecs.umich.edu              case 0:
577259Sgblack@eecs.umich.edu                switch (opc2) {
587259Sgblack@eecs.umich.edu                  case 1:
597259Sgblack@eecs.umich.edu                    return MISCREG_CTR;
607259Sgblack@eecs.umich.edu                  case 2:
617259Sgblack@eecs.umich.edu                    return MISCREG_TCMTR;
627351Sgblack@eecs.umich.edu                  case 3:
637351Sgblack@eecs.umich.edu                    return MISCREG_TLBTR;
647259Sgblack@eecs.umich.edu                  case 5:
657259Sgblack@eecs.umich.edu                    return MISCREG_MPIDR;
667259Sgblack@eecs.umich.edu                  default:
677259Sgblack@eecs.umich.edu                    return MISCREG_MIDR;
687259Sgblack@eecs.umich.edu                }
697259Sgblack@eecs.umich.edu                break;
707259Sgblack@eecs.umich.edu              case 1:
717259Sgblack@eecs.umich.edu                switch (opc2) {
727259Sgblack@eecs.umich.edu                  case 0:
737259Sgblack@eecs.umich.edu                    return MISCREG_ID_PFR0;
747259Sgblack@eecs.umich.edu                  case 1:
757259Sgblack@eecs.umich.edu                    return MISCREG_ID_PFR1;
767259Sgblack@eecs.umich.edu                  case 2:
777259Sgblack@eecs.umich.edu                    return MISCREG_ID_DFR0;
787259Sgblack@eecs.umich.edu                  case 3:
797259Sgblack@eecs.umich.edu                    return MISCREG_ID_AFR0;
807259Sgblack@eecs.umich.edu                  case 4:
817259Sgblack@eecs.umich.edu                    return MISCREG_ID_MMFR0;
827259Sgblack@eecs.umich.edu                  case 5:
837259Sgblack@eecs.umich.edu                    return MISCREG_ID_MMFR1;
847259Sgblack@eecs.umich.edu                  case 6:
857259Sgblack@eecs.umich.edu                    return MISCREG_ID_MMFR2;
867259Sgblack@eecs.umich.edu                  case 7:
877259Sgblack@eecs.umich.edu                    return MISCREG_ID_MMFR3;
887259Sgblack@eecs.umich.edu                }
897259Sgblack@eecs.umich.edu                break;
907259Sgblack@eecs.umich.edu              case 2:
917259Sgblack@eecs.umich.edu                switch (opc2) {
927259Sgblack@eecs.umich.edu                  case 0:
937259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR0;
947259Sgblack@eecs.umich.edu                  case 1:
957259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR1;
967259Sgblack@eecs.umich.edu                  case 2:
977259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR2;
987259Sgblack@eecs.umich.edu                  case 3:
997259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR3;
1007259Sgblack@eecs.umich.edu                  case 4:
1017259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR4;
1027259Sgblack@eecs.umich.edu                  case 5:
1037259Sgblack@eecs.umich.edu                    return MISCREG_ID_ISAR5;
1047259Sgblack@eecs.umich.edu                  case 6:
1057259Sgblack@eecs.umich.edu                  case 7:
1067259Sgblack@eecs.umich.edu                    return MISCREG_RAZ; // read as zero
1077259Sgblack@eecs.umich.edu                }
1087259Sgblack@eecs.umich.edu                break;
1097259Sgblack@eecs.umich.edu              default:
1107259Sgblack@eecs.umich.edu                return MISCREG_RAZ; // read as zero
1117259Sgblack@eecs.umich.edu            }
1127259Sgblack@eecs.umich.edu            break;
1137259Sgblack@eecs.umich.edu          case 1:
1147259Sgblack@eecs.umich.edu            if (crm == 0) {
1157259Sgblack@eecs.umich.edu                switch (opc2) {
1167259Sgblack@eecs.umich.edu                  case 0:
1177259Sgblack@eecs.umich.edu                    return MISCREG_CCSIDR;
1187259Sgblack@eecs.umich.edu                  case 1:
1197259Sgblack@eecs.umich.edu                    return MISCREG_CLIDR;
1207259Sgblack@eecs.umich.edu                  case 7:
1217259Sgblack@eecs.umich.edu                    return MISCREG_AIDR;
1227259Sgblack@eecs.umich.edu                }
1237259Sgblack@eecs.umich.edu            }
1247259Sgblack@eecs.umich.edu            break;
1257259Sgblack@eecs.umich.edu          case 2:
1267259Sgblack@eecs.umich.edu            if (crm == 0 && opc2 == 0) {
1277259Sgblack@eecs.umich.edu                return MISCREG_CSSELR;
1287259Sgblack@eecs.umich.edu            }
1297259Sgblack@eecs.umich.edu            break;
1307259Sgblack@eecs.umich.edu        }
1317259Sgblack@eecs.umich.edu        break;
1327259Sgblack@eecs.umich.edu      case 1:
1337351Sgblack@eecs.umich.edu        if (opc1 == 0) {
1347351Sgblack@eecs.umich.edu            if (crm == 0) {
1357351Sgblack@eecs.umich.edu                switch (opc2) {
1367351Sgblack@eecs.umich.edu                  case 0:
1377351Sgblack@eecs.umich.edu                    return MISCREG_SCTLR;
1387351Sgblack@eecs.umich.edu                  case 1:
1397351Sgblack@eecs.umich.edu                    return MISCREG_ACTLR;
1407351Sgblack@eecs.umich.edu                  case 0x2:
1417351Sgblack@eecs.umich.edu                    return MISCREG_CPACR;
1427351Sgblack@eecs.umich.edu                }
1437351Sgblack@eecs.umich.edu            } else if (crm == 1) {
1447351Sgblack@eecs.umich.edu                switch (opc2) {
1457351Sgblack@eecs.umich.edu                  case 0:
1467351Sgblack@eecs.umich.edu                    return MISCREG_SCR;
1477351Sgblack@eecs.umich.edu                  case 1:
1487351Sgblack@eecs.umich.edu                    return MISCREG_SDER;
1497351Sgblack@eecs.umich.edu                  case 2:
1507351Sgblack@eecs.umich.edu                    return MISCREG_NSACR;
1517351Sgblack@eecs.umich.edu                }
1527351Sgblack@eecs.umich.edu            }
1537351Sgblack@eecs.umich.edu        }
1547351Sgblack@eecs.umich.edu        break;
1557351Sgblack@eecs.umich.edu      case 2:
1567406SAli.Saidi@ARM.com        if (opc1 == 0 && crm == 0) {
1577259Sgblack@eecs.umich.edu            switch (opc2) {
1587259Sgblack@eecs.umich.edu              case 0:
1597351Sgblack@eecs.umich.edu                return MISCREG_TTBR0;
1607259Sgblack@eecs.umich.edu              case 1:
1617351Sgblack@eecs.umich.edu                return MISCREG_TTBR1;
1627351Sgblack@eecs.umich.edu              case 2:
1637351Sgblack@eecs.umich.edu                return MISCREG_TTBCR;
1647259Sgblack@eecs.umich.edu            }
1657259Sgblack@eecs.umich.edu        }
1667259Sgblack@eecs.umich.edu        break;
1677351Sgblack@eecs.umich.edu      case 3:
1687351Sgblack@eecs.umich.edu        if (opc1 == 0 && crm == 0 && opc2 == 0) {
1697351Sgblack@eecs.umich.edu            return MISCREG_DACR;
1707351Sgblack@eecs.umich.edu        }
1717351Sgblack@eecs.umich.edu        break;
1727259Sgblack@eecs.umich.edu      case 5:
1737259Sgblack@eecs.umich.edu        if (opc1 == 0) {
1747259Sgblack@eecs.umich.edu            if (crm == 0) {
1757259Sgblack@eecs.umich.edu                if (opc2 == 0) {
1767259Sgblack@eecs.umich.edu                    return MISCREG_DFSR;
1777259Sgblack@eecs.umich.edu                } else if (opc2 == 1) {
1787259Sgblack@eecs.umich.edu                    return MISCREG_IFSR;
1797259Sgblack@eecs.umich.edu                }
1807259Sgblack@eecs.umich.edu            } else if (crm == 1) {
1817259Sgblack@eecs.umich.edu                if (opc2 == 0) {
1827259Sgblack@eecs.umich.edu                    return MISCREG_ADFSR;
1837259Sgblack@eecs.umich.edu                } else if (opc2 == 1) {
1847259Sgblack@eecs.umich.edu                    return MISCREG_AIFSR;
1857259Sgblack@eecs.umich.edu                }
1867259Sgblack@eecs.umich.edu            }
1877259Sgblack@eecs.umich.edu        }
1887259Sgblack@eecs.umich.edu        break;
1897259Sgblack@eecs.umich.edu      case 6:
1907351Sgblack@eecs.umich.edu        if (opc1 == 0 && crm == 0) {
1917351Sgblack@eecs.umich.edu            switch (opc2) {
1927259Sgblack@eecs.umich.edu              case 0:
1937351Sgblack@eecs.umich.edu                return MISCREG_DFAR;
1947259Sgblack@eecs.umich.edu              case 2:
1957351Sgblack@eecs.umich.edu                return MISCREG_IFAR;
1967259Sgblack@eecs.umich.edu            }
1977259Sgblack@eecs.umich.edu        }
1987259Sgblack@eecs.umich.edu        break;
1997259Sgblack@eecs.umich.edu      case 7:
2007259Sgblack@eecs.umich.edu        if (opc1 == 0) {
2017259Sgblack@eecs.umich.edu            switch (crm) {
2027259Sgblack@eecs.umich.edu              case 0:
2037259Sgblack@eecs.umich.edu                if (opc2 == 4) {
2047259Sgblack@eecs.umich.edu                    return MISCREG_NOP;
2057259Sgblack@eecs.umich.edu                }
2067259Sgblack@eecs.umich.edu                break;
2077259Sgblack@eecs.umich.edu              case 1:
2087259Sgblack@eecs.umich.edu                switch (opc2) {
2097259Sgblack@eecs.umich.edu                  case 0:
2107259Sgblack@eecs.umich.edu                    return MISCREG_ICIALLUIS;
2117259Sgblack@eecs.umich.edu                  case 6:
2127259Sgblack@eecs.umich.edu                    return MISCREG_BPIALLIS;
2137259Sgblack@eecs.umich.edu                }
2147259Sgblack@eecs.umich.edu                break;
2157351Sgblack@eecs.umich.edu              case 4:
2167351Sgblack@eecs.umich.edu                if (opc2 == 0) {
2177351Sgblack@eecs.umich.edu                    return MISCREG_PAR;
2187351Sgblack@eecs.umich.edu                }
2197351Sgblack@eecs.umich.edu                break;
2207259Sgblack@eecs.umich.edu              case 5:
2217259Sgblack@eecs.umich.edu                switch (opc2) {
2227259Sgblack@eecs.umich.edu                  case 0:
2237259Sgblack@eecs.umich.edu                    return MISCREG_ICIALLU;
2247259Sgblack@eecs.umich.edu                  case 1:
2257259Sgblack@eecs.umich.edu                    return MISCREG_ICIMVAU;
2267259Sgblack@eecs.umich.edu                  case 4:
2277259Sgblack@eecs.umich.edu                    return MISCREG_CP15ISB;
2287259Sgblack@eecs.umich.edu                  case 6:
2297259Sgblack@eecs.umich.edu                    return MISCREG_BPIALL;
2307259Sgblack@eecs.umich.edu                  case 7:
2317259Sgblack@eecs.umich.edu                    return MISCREG_BPIMVA;
2327259Sgblack@eecs.umich.edu                }
2337259Sgblack@eecs.umich.edu                break;
2347259Sgblack@eecs.umich.edu              case 6:
2357259Sgblack@eecs.umich.edu                if (opc2 == 1) {
2367259Sgblack@eecs.umich.edu                    return MISCREG_DCIMVAC;
2377259Sgblack@eecs.umich.edu                } else if (opc2 == 2) {
2387259Sgblack@eecs.umich.edu                    return MISCREG_DCISW;
2397259Sgblack@eecs.umich.edu                }
2407259Sgblack@eecs.umich.edu                break;
2417351Sgblack@eecs.umich.edu              case 8:
2427351Sgblack@eecs.umich.edu                switch (opc2) {
2437351Sgblack@eecs.umich.edu                  case 0:
2447351Sgblack@eecs.umich.edu                    return MISCREG_V2PCWPR;
2457351Sgblack@eecs.umich.edu                  case 1:
2467351Sgblack@eecs.umich.edu                    return MISCREG_V2PCWPW;
2477351Sgblack@eecs.umich.edu                  case 2:
2487351Sgblack@eecs.umich.edu                    return MISCREG_V2PCWUR;
2497351Sgblack@eecs.umich.edu                  case 3:
2507351Sgblack@eecs.umich.edu                    return MISCREG_V2PCWUW;
2517351Sgblack@eecs.umich.edu                  case 4:
2527351Sgblack@eecs.umich.edu                    return MISCREG_V2POWPR;
2537351Sgblack@eecs.umich.edu                  case 5:
2547351Sgblack@eecs.umich.edu                    return MISCREG_V2POWPW;
2557351Sgblack@eecs.umich.edu                  case 6:
2567351Sgblack@eecs.umich.edu                    return MISCREG_V2POWUR;
2577351Sgblack@eecs.umich.edu                  case 7:
2587351Sgblack@eecs.umich.edu                    return MISCREG_V2POWUW;
2597351Sgblack@eecs.umich.edu                }
2607351Sgblack@eecs.umich.edu                break;
2617259Sgblack@eecs.umich.edu              case 10:
2627259Sgblack@eecs.umich.edu                switch (opc2) {
2637259Sgblack@eecs.umich.edu                  case 1:
2647259Sgblack@eecs.umich.edu                    return MISCREG_DCCMVAC;
2657259Sgblack@eecs.umich.edu                  case 2:
2667259Sgblack@eecs.umich.edu                    return MISCREG_MCCSW;
2677259Sgblack@eecs.umich.edu                  case 4:
2687259Sgblack@eecs.umich.edu                    return MISCREG_CP15DSB;
2697259Sgblack@eecs.umich.edu                  case 5:
2707259Sgblack@eecs.umich.edu                    return MISCREG_CP15DMB;
2717259Sgblack@eecs.umich.edu                }
2727259Sgblack@eecs.umich.edu                break;
2737259Sgblack@eecs.umich.edu              case 11:
2747259Sgblack@eecs.umich.edu                if (opc2 == 1) {
2757259Sgblack@eecs.umich.edu                    return MISCREG_DCCMVAU;
2767259Sgblack@eecs.umich.edu                }
2777259Sgblack@eecs.umich.edu                break;
2787259Sgblack@eecs.umich.edu              case 13:
2797259Sgblack@eecs.umich.edu                if (opc2 == 1) {
2807259Sgblack@eecs.umich.edu                    return MISCREG_NOP;
2817259Sgblack@eecs.umich.edu                }
2827259Sgblack@eecs.umich.edu                break;
2837259Sgblack@eecs.umich.edu              case 14:
2847259Sgblack@eecs.umich.edu                if (opc2 == 1) {
2857259Sgblack@eecs.umich.edu                    return MISCREG_DCCIMVAC;
2867259Sgblack@eecs.umich.edu                } else if (opc2 == 2) {
2877259Sgblack@eecs.umich.edu                    return MISCREG_DCCISW;
2887259Sgblack@eecs.umich.edu                }
2897259Sgblack@eecs.umich.edu                break;
2907259Sgblack@eecs.umich.edu            }
2917259Sgblack@eecs.umich.edu        }
2927259Sgblack@eecs.umich.edu        break;
2937351Sgblack@eecs.umich.edu      case 8:
2947351Sgblack@eecs.umich.edu        if (opc1 == 0) {
2957351Sgblack@eecs.umich.edu            switch (crm) {
2967351Sgblack@eecs.umich.edu              case 3:
2977351Sgblack@eecs.umich.edu                switch (opc2) {
2987351Sgblack@eecs.umich.edu                  case 0:
2997351Sgblack@eecs.umich.edu                    return MISCREG_TLBIALLIS;
3007351Sgblack@eecs.umich.edu                  case 1:
3017351Sgblack@eecs.umich.edu                    return MISCREG_TLBIMVAIS;
3027351Sgblack@eecs.umich.edu                  case 2:
3037351Sgblack@eecs.umich.edu                    return MISCREG_TLBIASIDIS;
3047351Sgblack@eecs.umich.edu                  case 3:
3057351Sgblack@eecs.umich.edu                    return MISCREG_TLBIMVAAIS;
3067351Sgblack@eecs.umich.edu                }
3077351Sgblack@eecs.umich.edu                break;
3087351Sgblack@eecs.umich.edu              case 5:
3097351Sgblack@eecs.umich.edu                switch (opc2) {
3107351Sgblack@eecs.umich.edu                  case 0:
3117351Sgblack@eecs.umich.edu                    return MISCREG_ITLBIALL;
3127351Sgblack@eecs.umich.edu                  case 1:
3137351Sgblack@eecs.umich.edu                    return MISCREG_ITLBIMVA;
3147351Sgblack@eecs.umich.edu                  case 2:
3157351Sgblack@eecs.umich.edu                    return MISCREG_ITLBIASID;
3167351Sgblack@eecs.umich.edu                }
3177351Sgblack@eecs.umich.edu                break;
3187351Sgblack@eecs.umich.edu              case 6:
3197351Sgblack@eecs.umich.edu                switch (opc2) {
3207351Sgblack@eecs.umich.edu                  case 0:
3217351Sgblack@eecs.umich.edu                    return MISCREG_DTLBIALL;
3227351Sgblack@eecs.umich.edu                  case 1:
3237351Sgblack@eecs.umich.edu                    return MISCREG_DTLBIMVA;
3247351Sgblack@eecs.umich.edu                  case 2:
3257351Sgblack@eecs.umich.edu                    return MISCREG_DTLBIASID;
3267351Sgblack@eecs.umich.edu                }
3277351Sgblack@eecs.umich.edu                break;
3287351Sgblack@eecs.umich.edu              case 7:
3297351Sgblack@eecs.umich.edu                switch (opc2) {
3307351Sgblack@eecs.umich.edu                  case 0:
3317351Sgblack@eecs.umich.edu                    return MISCREG_TLBIALL;
3327351Sgblack@eecs.umich.edu                  case 1:
3337351Sgblack@eecs.umich.edu                    return MISCREG_TLBIMVA;
3347351Sgblack@eecs.umich.edu                  case 2:
3357351Sgblack@eecs.umich.edu                    return MISCREG_TLBIASID;
3367351Sgblack@eecs.umich.edu                  case 3:
3377351Sgblack@eecs.umich.edu                    return MISCREG_TLBIMVAA;
3387351Sgblack@eecs.umich.edu                }
3397351Sgblack@eecs.umich.edu                break;
3407351Sgblack@eecs.umich.edu            }
3417351Sgblack@eecs.umich.edu        }
3427351Sgblack@eecs.umich.edu        break;
3437259Sgblack@eecs.umich.edu      case 9:
3447583SAli.Saidi@arm.com        if (opc1 == 0) {
3457259Sgblack@eecs.umich.edu            switch (crm) {
3467259Sgblack@eecs.umich.edu              case 12:
3477583SAli.Saidi@arm.com                switch (opc2) {
3487583SAli.Saidi@arm.com                  case 0:
3497583SAli.Saidi@arm.com                    return MISCREG_PMCR;
3507583SAli.Saidi@arm.com                  case 1:
3517583SAli.Saidi@arm.com                    return MISCREG_PMCNTENSET;
3527583SAli.Saidi@arm.com                  case 2:
3537583SAli.Saidi@arm.com                    return MISCREG_PMCNTENCLR;
3547583SAli.Saidi@arm.com                  case 3:
3557583SAli.Saidi@arm.com                    return MISCREG_PMOVSR;
3567583SAli.Saidi@arm.com                  case 4:
3577583SAli.Saidi@arm.com                    return MISCREG_PMSWINC;
3587583SAli.Saidi@arm.com                  case 5:
3597583SAli.Saidi@arm.com                    return MISCREG_PMSELR;
3607583SAli.Saidi@arm.com                  case 6:
3617583SAli.Saidi@arm.com                    return MISCREG_PMCEID0;
3627583SAli.Saidi@arm.com                  case 7:
3637583SAli.Saidi@arm.com                    return MISCREG_PMCEID1;
3647583SAli.Saidi@arm.com                }
3657259Sgblack@eecs.umich.edu              case 13:
3667583SAli.Saidi@arm.com                switch (opc2) {
3677583SAli.Saidi@arm.com                  case 0:
3687583SAli.Saidi@arm.com                    return MISCREG_PMCCNTR;
3697583SAli.Saidi@arm.com                  case 1:
3707583SAli.Saidi@arm.com                    return MISCREG_PMC_OTHER;
3717583SAli.Saidi@arm.com                  case 2:
3727583SAli.Saidi@arm.com                    return MISCREG_PMXEVCNTR;
3737583SAli.Saidi@arm.com                }
3747259Sgblack@eecs.umich.edu              case 14:
3757583SAli.Saidi@arm.com                switch (opc2) {
3767583SAli.Saidi@arm.com                  case 0:
3777583SAli.Saidi@arm.com                    return MISCREG_PMUSERENR;
3787583SAli.Saidi@arm.com                  case 1:
3797583SAli.Saidi@arm.com                    return MISCREG_PMINTENSET;
3807583SAli.Saidi@arm.com                  case 2:
3817583SAli.Saidi@arm.com                    return MISCREG_PMINTENCLR;
3827583SAli.Saidi@arm.com                }
3837259Sgblack@eecs.umich.edu            }
3848058SAli.Saidi@ARM.com        } else if (opc1 == 1) {
3858549Sdaniel.johnson@arm.com            switch (crm) {
3868549Sdaniel.johnson@arm.com              case 0:
3878549Sdaniel.johnson@arm.com                switch (opc2) {
3888549Sdaniel.johnson@arm.com                  case 2: // L2CTLR, L2 Control Register
3898549Sdaniel.johnson@arm.com                    return MISCREG_L2CTLR;
3908549Sdaniel.johnson@arm.com                  default:
3918549Sdaniel.johnson@arm.com                    warn("Uknown miscregs: crn:%d crm:%d opc1:%d opc2:%d\n",
3928549Sdaniel.johnson@arm.com                         crn,crm, opc1,opc2);
3938549Sdaniel.johnson@arm.com                    break;
3948549Sdaniel.johnson@arm.com                }
3958549Sdaniel.johnson@arm.com              default:
3968549Sdaniel.johnson@arm.com                return MISCREG_L2LATENCY;
3978549Sdaniel.johnson@arm.com            }
3987259Sgblack@eecs.umich.edu        }
3997583SAli.Saidi@arm.com        //Reserved for Branch Predictor, Cache and TCM operations
4007259Sgblack@eecs.umich.edu        break;
4017351Sgblack@eecs.umich.edu      case 10:
4027351Sgblack@eecs.umich.edu        if (opc1 == 0) {
4037351Sgblack@eecs.umich.edu            // crm 0, 1, 4, and 8, with op2 0 - 7, reserved for TLB lockdown
4047351Sgblack@eecs.umich.edu            if (crm == 2) { // TEX Remap Registers
4057351Sgblack@eecs.umich.edu                if (opc2 == 0) {
4067351Sgblack@eecs.umich.edu                    return MISCREG_PRRR;
4077351Sgblack@eecs.umich.edu                } else if (opc2 == 1) {
4087351Sgblack@eecs.umich.edu                    return MISCREG_NMRR;
4097351Sgblack@eecs.umich.edu                }
4107351Sgblack@eecs.umich.edu            }
4117351Sgblack@eecs.umich.edu        }
4127351Sgblack@eecs.umich.edu        break;
4137259Sgblack@eecs.umich.edu      case 11:
4147259Sgblack@eecs.umich.edu        if (opc1 >= 0 && opc1 <=7) {
4157259Sgblack@eecs.umich.edu            switch (crm) {
4167259Sgblack@eecs.umich.edu              case 0:
4177259Sgblack@eecs.umich.edu              case 1:
4187259Sgblack@eecs.umich.edu              case 2:
4197259Sgblack@eecs.umich.edu              case 3:
4207259Sgblack@eecs.umich.edu              case 4:
4217259Sgblack@eecs.umich.edu              case 5:
4227259Sgblack@eecs.umich.edu              case 6:
4237259Sgblack@eecs.umich.edu              case 7:
4247259Sgblack@eecs.umich.edu              case 8:
4257259Sgblack@eecs.umich.edu              case 15:
4267259Sgblack@eecs.umich.edu                // Reserved for DMA operations for TCM access
4277259Sgblack@eecs.umich.edu                break;
4287259Sgblack@eecs.umich.edu            }
4297259Sgblack@eecs.umich.edu        }
4307259Sgblack@eecs.umich.edu        break;
4317351Sgblack@eecs.umich.edu      case 12:
4327351Sgblack@eecs.umich.edu        if (opc1 == 0) {
4337351Sgblack@eecs.umich.edu            if (crm == 0) {
4347351Sgblack@eecs.umich.edu                if (opc2 == 0) {
4357351Sgblack@eecs.umich.edu                    return MISCREG_VBAR;
4367351Sgblack@eecs.umich.edu                } else if (opc2 == 1) {
4377351Sgblack@eecs.umich.edu                    return MISCREG_MVBAR;
4387351Sgblack@eecs.umich.edu                }
4397351Sgblack@eecs.umich.edu            } else if (crm == 1) {
4407351Sgblack@eecs.umich.edu                if (opc2 == 0) {
4417351Sgblack@eecs.umich.edu                    return MISCREG_ISR;
4427351Sgblack@eecs.umich.edu                }
4437351Sgblack@eecs.umich.edu            }
4447351Sgblack@eecs.umich.edu        }
4457351Sgblack@eecs.umich.edu        break;
4467259Sgblack@eecs.umich.edu      case 13:
4477259Sgblack@eecs.umich.edu        if (opc1 == 0) {
4487259Sgblack@eecs.umich.edu            if (crm == 0) {
4497406SAli.Saidi@ARM.com                switch (opc2) {
4507351Sgblack@eecs.umich.edu                  case 0:
4517351Sgblack@eecs.umich.edu                    return MISCREG_FCEIDR;
4527259Sgblack@eecs.umich.edu                  case 1:
4537259Sgblack@eecs.umich.edu                    return MISCREG_CONTEXTIDR;
4547259Sgblack@eecs.umich.edu                  case 2:
4557259Sgblack@eecs.umich.edu                    return MISCREG_TPIDRURW;
4567259Sgblack@eecs.umich.edu                  case 3:
4577259Sgblack@eecs.umich.edu                    return MISCREG_TPIDRURO;
4587259Sgblack@eecs.umich.edu                  case 4:
4597259Sgblack@eecs.umich.edu                    return MISCREG_TPIDRPRW;
4607259Sgblack@eecs.umich.edu                }
4617259Sgblack@eecs.umich.edu            }
4627259Sgblack@eecs.umich.edu        }
4637259Sgblack@eecs.umich.edu        break;
4647259Sgblack@eecs.umich.edu      case 15:
4657259Sgblack@eecs.umich.edu        // Implementation defined
4667259Sgblack@eecs.umich.edu        break;
4677259Sgblack@eecs.umich.edu    }
4687259Sgblack@eecs.umich.edu    // Unrecognized register
4697259Sgblack@eecs.umich.edu    return NUM_MISCREGS;
4707259Sgblack@eecs.umich.edu}
4717259Sgblack@eecs.umich.edu
4727259Sgblack@eecs.umich.edu};
473