gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
miscregs.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2009 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __ARCH_ARM_MISCREGS_HH__
42 #define __ARCH_ARM_MISCREGS_HH__
43 
44 #include <bitset>
45 #include <tuple>
46 
48 #include "base/compiler.hh"
50 
51 class ThreadContext;
52 
53 
54 namespace ArmISA
55 {
56  enum MiscRegIndex {
72 
73  // Helper registers
89 
90  // AArch32 CP14 registers (debug/trace/ThumbEE/Jazelle control)
136  MISCREG_TEECR, // not in ARM DDI 0487A.b+
138  MISCREG_TEEHBR, // not in ARM DDI 0487A.b+
141 
142  // AArch32 CP15 registers (system control)
347  // BEGIN Generic Timer (AArch32)
369  // END Generic Timer (AArch32)
386 
387  // AArch64 registers (Op0=2)
426  MISCREG_TEECR32_EL1, // not in ARM DDI 0487A.b+
427  MISCREG_TEEHBR32_EL1, // not in ARM DDI 0487A.b+
428 
429  // AArch64 registers (Op0=1,3)
624  // BEGIN Generic Timer (AArch64)
649  // IF Armv8.1-VHE
653  // ENDIF Armv8.1-VHE
655  // END Generic Timer (AArch64)
684 
685  // Introduced in ARMv8.1
687 
689 
690  //PAuth Key Regsiters
701 
702  // GICv3, CPU interface
749 
750  // GICv3, CPU interface, virtualization
781 
824 
871 
918 
919  // SVE
925 
926  // NUM_PHYS_MISCREGS specifies the number of actual physical
927  // registers, not considering the following pseudo-registers
928  // (dummy registers), like UNKNOWN, CP15_UNIMPL, MISCREG_IMPDEF_UNIMPL.
929  // Checkpointing should use this physical index when
930  // saving/restoring register values.
932 
933  // Dummy registers
939 
940  // Implementation defined register: this represent
941  // a pool of unimplemented registers whose access can throw
942  // either UNDEFINED or hypervisor trap exception.
944 
945  // RAS extension (unimplemented)
957 
958  // PSTATE
960 
961  // Total number of Misc Registers: Physical + Dummy
963  };
964 
965  enum MiscRegInfo {
967  MISCREG_UNVERIFIABLE, // Does the value change on every read (e.g. a
968  // arch generic counter)
969  MISCREG_WARN_NOT_FAIL, // If MISCREG_IMPLEMENTED is deasserted, it
970  // tells whether the instruction should raise a
971  // warning or fail
972  MISCREG_MUTEX, // True if the register corresponds to a pair of
973  // mutually exclusive registers
974  MISCREG_BANKED, // True if the register is banked between the two
975  // security states, and this is the parent node of the
976  // two banked registers
977  MISCREG_BANKED64, // True if the register is banked between the two
978  // security states, and this is the parent node of
979  // the two banked registers. Used in AA64 only.
980  MISCREG_BANKED_CHILD, // The entry is one of the child registers that
981  // forms a banked set of regs (along with the
982  // other child regs)
983 
984  // Access permissions
985  // User mode
990  // Privileged modes other than hypervisor or monitor
995  // Hypervisor mode
998  // Hypervisor mode, HCR_EL2.E2H == 1
1001  // Monitor mode, SCR.NS == 0
1004  // Monitor mode, SCR.NS == 1
1007  // Monitor mode, HCR_EL2.E2H == 1
1010 
1012  };
1013 
1014  extern std::bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS];
1015 
1016  // Decodes 32-bit CP14 registers accessible through MCR/MRC instructions
1017  MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1,
1018  unsigned crm, unsigned opc2);
1019  MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1,
1020  unsigned crn, unsigned crm,
1021  unsigned op2);
1022  // Whether a particular AArch64 system register is -always- read only.
1023  bool aarch64SysRegReadOnly(MiscRegIndex miscReg);
1024 
1025  // Decodes 32-bit CP15 registers accessible through MCR/MRC instructions
1026  MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
1027  unsigned crm, unsigned opc2);
1028 
1029  // Decodes 64-bit CP15 registers accessible through MCRR/MRRC instructions
1030  MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1);
1031 
1032 
1033  const char * const miscRegName[] = {
1034  "cpsr",
1035  "spsr",
1036  "spsr_fiq",
1037  "spsr_irq",
1038  "spsr_svc",
1039  "spsr_mon",
1040  "spsr_abt",
1041  "spsr_hyp",
1042  "spsr_und",
1043  "elr_hyp",
1044  "fpsid",
1045  "fpscr",
1046  "mvfr1",
1047  "mvfr0",
1048  "fpexc",
1049 
1050  // Helper registers
1051  "cpsr_mode",
1052  "cpsr_q",
1053  "fpscr_exc",
1054  "fpscr_qc",
1055  "lockaddr",
1056  "lockflag",
1057  "prrr_mair0",
1058  "prrr_mair0_ns",
1059  "prrr_mair0_s",
1060  "nmrr_mair1",
1061  "nmrr_mair1_ns",
1062  "nmrr_mair1_s",
1063  "pmxevtyper_pmccfiltr",
1064  "sctlr_rst",
1065  "sev_mailbox",
1066 
1067  // AArch32 CP14 registers
1068  "dbgdidr",
1069  "dbgdscrint",
1070  "dbgdccint",
1071  "dbgdtrtxint",
1072  "dbgdtrrxint",
1073  "dbgwfar",
1074  "dbgvcr",
1075  "dbgdtrrxext",
1076  "dbgdscrext",
1077  "dbgdtrtxext",
1078  "dbgoseccr",
1079  "dbgbvr0",
1080  "dbgbvr1",
1081  "dbgbvr2",
1082  "dbgbvr3",
1083  "dbgbvr4",
1084  "dbgbvr5",
1085  "dbgbcr0",
1086  "dbgbcr1",
1087  "dbgbcr2",
1088  "dbgbcr3",
1089  "dbgbcr4",
1090  "dbgbcr5",
1091  "dbgwvr0",
1092  "dbgwvr1",
1093  "dbgwvr2",
1094  "dbgwvr3",
1095  "dbgwcr0",
1096  "dbgwcr1",
1097  "dbgwcr2",
1098  "dbgwcr3",
1099  "dbgdrar",
1100  "dbgbxvr4",
1101  "dbgbxvr5",
1102  "dbgoslar",
1103  "dbgoslsr",
1104  "dbgosdlr",
1105  "dbgprcr",
1106  "dbgdsar",
1107  "dbgclaimset",
1108  "dbgclaimclr",
1109  "dbgauthstatus",
1110  "dbgdevid2",
1111  "dbgdevid1",
1112  "dbgdevid0",
1113  "teecr",
1114  "jidr",
1115  "teehbr",
1116  "joscr",
1117  "jmcr",
1118 
1119  // AArch32 CP15 registers
1120  "midr",
1121  "ctr",
1122  "tcmtr",
1123  "tlbtr",
1124  "mpidr",
1125  "revidr",
1126  "id_pfr0",
1127  "id_pfr1",
1128  "id_dfr0",
1129  "id_afr0",
1130  "id_mmfr0",
1131  "id_mmfr1",
1132  "id_mmfr2",
1133  "id_mmfr3",
1134  "id_isar0",
1135  "id_isar1",
1136  "id_isar2",
1137  "id_isar3",
1138  "id_isar4",
1139  "id_isar5",
1140  "ccsidr",
1141  "clidr",
1142  "aidr",
1143  "csselr",
1144  "csselr_ns",
1145  "csselr_s",
1146  "vpidr",
1147  "vmpidr",
1148  "sctlr",
1149  "sctlr_ns",
1150  "sctlr_s",
1151  "actlr",
1152  "actlr_ns",
1153  "actlr_s",
1154  "cpacr",
1155  "scr",
1156  "sder",
1157  "nsacr",
1158  "hsctlr",
1159  "hactlr",
1160  "hcr",
1161  "hcr2",
1162  "hdcr",
1163  "hcptr",
1164  "hstr",
1165  "hacr",
1166  "ttbr0",
1167  "ttbr0_ns",
1168  "ttbr0_s",
1169  "ttbr1",
1170  "ttbr1_ns",
1171  "ttbr1_s",
1172  "ttbcr",
1173  "ttbcr_ns",
1174  "ttbcr_s",
1175  "htcr",
1176  "vtcr",
1177  "dacr",
1178  "dacr_ns",
1179  "dacr_s",
1180  "dfsr",
1181  "dfsr_ns",
1182  "dfsr_s",
1183  "ifsr",
1184  "ifsr_ns",
1185  "ifsr_s",
1186  "adfsr",
1187  "adfsr_ns",
1188  "adfsr_s",
1189  "aifsr",
1190  "aifsr_ns",
1191  "aifsr_s",
1192  "hadfsr",
1193  "haifsr",
1194  "hsr",
1195  "dfar",
1196  "dfar_ns",
1197  "dfar_s",
1198  "ifar",
1199  "ifar_ns",
1200  "ifar_s",
1201  "hdfar",
1202  "hifar",
1203  "hpfar",
1204  "icialluis",
1205  "bpiallis",
1206  "par",
1207  "par_ns",
1208  "par_s",
1209  "iciallu",
1210  "icimvau",
1211  "cp15isb",
1212  "bpiall",
1213  "bpimva",
1214  "dcimvac",
1215  "dcisw",
1216  "ats1cpr",
1217  "ats1cpw",
1218  "ats1cur",
1219  "ats1cuw",
1220  "ats12nsopr",
1221  "ats12nsopw",
1222  "ats12nsour",
1223  "ats12nsouw",
1224  "dccmvac",
1225  "dccsw",
1226  "cp15dsb",
1227  "cp15dmb",
1228  "dccmvau",
1229  "dccimvac",
1230  "dccisw",
1231  "ats1hr",
1232  "ats1hw",
1233  "tlbiallis",
1234  "tlbimvais",
1235  "tlbiasidis",
1236  "tlbimvaais",
1237  "tlbimvalis",
1238  "tlbimvaalis",
1239  "itlbiall",
1240  "itlbimva",
1241  "itlbiasid",
1242  "dtlbiall",
1243  "dtlbimva",
1244  "dtlbiasid",
1245  "tlbiall",
1246  "tlbimva",
1247  "tlbiasid",
1248  "tlbimvaa",
1249  "tlbimval",
1250  "tlbimvaal",
1251  "tlbiipas2is",
1252  "tlbiipas2lis",
1253  "tlbiallhis",
1254  "tlbimvahis",
1255  "tlbiallnsnhis",
1256  "tlbimvalhis",
1257  "tlbiipas2",
1258  "tlbiipas2l",
1259  "tlbiallh",
1260  "tlbimvah",
1261  "tlbiallnsnh",
1262  "tlbimvalh",
1263  "pmcr",
1264  "pmcntenset",
1265  "pmcntenclr",
1266  "pmovsr",
1267  "pmswinc",
1268  "pmselr",
1269  "pmceid0",
1270  "pmceid1",
1271  "pmccntr",
1272  "pmxevtyper",
1273  "pmccfiltr",
1274  "pmxevcntr",
1275  "pmuserenr",
1276  "pmintenset",
1277  "pmintenclr",
1278  "pmovsset",
1279  "l2ctlr",
1280  "l2ectlr",
1281  "prrr",
1282  "prrr_ns",
1283  "prrr_s",
1284  "mair0",
1285  "mair0_ns",
1286  "mair0_s",
1287  "nmrr",
1288  "nmrr_ns",
1289  "nmrr_s",
1290  "mair1",
1291  "mair1_ns",
1292  "mair1_s",
1293  "amair0",
1294  "amair0_ns",
1295  "amair0_s",
1296  "amair1",
1297  "amair1_ns",
1298  "amair1_s",
1299  "hmair0",
1300  "hmair1",
1301  "hamair0",
1302  "hamair1",
1303  "vbar",
1304  "vbar_ns",
1305  "vbar_s",
1306  "mvbar",
1307  "rmr",
1308  "isr",
1309  "hvbar",
1310  "fcseidr",
1311  "contextidr",
1312  "contextidr_ns",
1313  "contextidr_s",
1314  "tpidrurw",
1315  "tpidrurw_ns",
1316  "tpidrurw_s",
1317  "tpidruro",
1318  "tpidruro_ns",
1319  "tpidruro_s",
1320  "tpidrprw",
1321  "tpidrprw_ns",
1322  "tpidrprw_s",
1323  "htpidr",
1324  "cntfrq",
1325  "cntpct",
1326  "cntvct",
1327  "cntp_ctl",
1328  "cntp_ctl_ns",
1329  "cntp_ctl_s",
1330  "cntp_cval",
1331  "cntp_cval_ns",
1332  "cntp_cval_s",
1333  "cntp_tval",
1334  "cntp_tval_ns",
1335  "cntp_tval_s",
1336  "cntv_ctl",
1337  "cntv_cval",
1338  "cntv_tval",
1339  "cntkctl",
1340  "cnthctl",
1341  "cnthp_ctl",
1342  "cnthp_cval",
1343  "cnthp_tval",
1344  "cntvoff",
1345  "il1data0",
1346  "il1data1",
1347  "il1data2",
1348  "il1data3",
1349  "dl1data0",
1350  "dl1data1",
1351  "dl1data2",
1352  "dl1data3",
1353  "dl1data4",
1354  "ramindex",
1355  "l2actlr",
1356  "cbar",
1357  "httbr",
1358  "vttbr",
1359  "cpumerrsr",
1360  "l2merrsr",
1361 
1362  // AArch64 registers (Op0=2)
1363  "mdccint_el1",
1364  "osdtrrx_el1",
1365  "mdscr_el1",
1366  "osdtrtx_el1",
1367  "oseccr_el1",
1368  "dbgbvr0_el1",
1369  "dbgbvr1_el1",
1370  "dbgbvr2_el1",
1371  "dbgbvr3_el1",
1372  "dbgbvr4_el1",
1373  "dbgbvr5_el1",
1374  "dbgbcr0_el1",
1375  "dbgbcr1_el1",
1376  "dbgbcr2_el1",
1377  "dbgbcr3_el1",
1378  "dbgbcr4_el1",
1379  "dbgbcr5_el1",
1380  "dbgwvr0_el1",
1381  "dbgwvr1_el1",
1382  "dbgwvr2_el1",
1383  "dbgwvr3_el1",
1384  "dbgwcr0_el1",
1385  "dbgwcr1_el1",
1386  "dbgwcr2_el1",
1387  "dbgwcr3_el1",
1388  "mdccsr_el0",
1389  "mddtr_el0",
1390  "mddtrtx_el0",
1391  "mddtrrx_el0",
1392  "dbgvcr32_el2",
1393  "mdrar_el1",
1394  "oslar_el1",
1395  "oslsr_el1",
1396  "osdlr_el1",
1397  "dbgprcr_el1",
1398  "dbgclaimset_el1",
1399  "dbgclaimclr_el1",
1400  "dbgauthstatus_el1",
1401  "teecr32_el1",
1402  "teehbr32_el1",
1403 
1404  // AArch64 registers (Op0=1,3)
1405  "midr_el1",
1406  "mpidr_el1",
1407  "revidr_el1",
1408  "id_pfr0_el1",
1409  "id_pfr1_el1",
1410  "id_dfr0_el1",
1411  "id_afr0_el1",
1412  "id_mmfr0_el1",
1413  "id_mmfr1_el1",
1414  "id_mmfr2_el1",
1415  "id_mmfr3_el1",
1416  "id_isar0_el1",
1417  "id_isar1_el1",
1418  "id_isar2_el1",
1419  "id_isar3_el1",
1420  "id_isar4_el1",
1421  "id_isar5_el1",
1422  "mvfr0_el1",
1423  "mvfr1_el1",
1424  "mvfr2_el1",
1425  "id_aa64pfr0_el1",
1426  "id_aa64pfr1_el1",
1427  "id_aa64dfr0_el1",
1428  "id_aa64dfr1_el1",
1429  "id_aa64afr0_el1",
1430  "id_aa64afr1_el1",
1431  "id_aa64isar0_el1",
1432  "id_aa64isar1_el1",
1433  "id_aa64mmfr0_el1",
1434  "id_aa64mmfr1_el1",
1435  "ccsidr_el1",
1436  "clidr_el1",
1437  "aidr_el1",
1438  "csselr_el1",
1439  "ctr_el0",
1440  "dczid_el0",
1441  "vpidr_el2",
1442  "vmpidr_el2",
1443  "sctlr_el1",
1444  "actlr_el1",
1445  "cpacr_el1",
1446  "sctlr_el2",
1447  "actlr_el2",
1448  "hcr_el2",
1449  "mdcr_el2",
1450  "cptr_el2",
1451  "hstr_el2",
1452  "hacr_el2",
1453  "sctlr_el3",
1454  "actlr_el3",
1455  "scr_el3",
1456  "sder32_el3",
1457  "cptr_el3",
1458  "mdcr_el3",
1459  "ttbr0_el1",
1460  "ttbr1_el1",
1461  "tcr_el1",
1462  "ttbr0_el2",
1463  "tcr_el2",
1464  "vttbr_el2",
1465  "vtcr_el2",
1466  "ttbr0_el3",
1467  "tcr_el3",
1468  "dacr32_el2",
1469  "spsr_el1",
1470  "elr_el1",
1471  "sp_el0",
1472  "spsel",
1473  "currentel",
1474  "nzcv",
1475  "daif",
1476  "fpcr",
1477  "fpsr",
1478  "dspsr_el0",
1479  "dlr_el0",
1480  "spsr_el2",
1481  "elr_el2",
1482  "sp_el1",
1483  "spsr_irq_aa64",
1484  "spsr_abt_aa64",
1485  "spsr_und_aa64",
1486  "spsr_fiq_aa64",
1487  "spsr_el3",
1488  "elr_el3",
1489  "sp_el2",
1490  "afsr0_el1",
1491  "afsr1_el1",
1492  "esr_el1",
1493  "ifsr32_el2",
1494  "afsr0_el2",
1495  "afsr1_el2",
1496  "esr_el2",
1497  "fpexc32_el2",
1498  "afsr0_el3",
1499  "afsr1_el3",
1500  "esr_el3",
1501  "far_el1",
1502  "far_el2",
1503  "hpfar_el2",
1504  "far_el3",
1505  "ic_ialluis",
1506  "par_el1",
1507  "ic_iallu",
1508  "dc_ivac_xt",
1509  "dc_isw_xt",
1510  "at_s1e1r_xt",
1511  "at_s1e1w_xt",
1512  "at_s1e0r_xt",
1513  "at_s1e0w_xt",
1514  "dc_csw_xt",
1515  "dc_cisw_xt",
1516  "dc_zva_xt",
1517  "ic_ivau_xt",
1518  "dc_cvac_xt",
1519  "dc_cvau_xt",
1520  "dc_civac_xt",
1521  "at_s1e2r_xt",
1522  "at_s1e2w_xt",
1523  "at_s12e1r_xt",
1524  "at_s12e1w_xt",
1525  "at_s12e0r_xt",
1526  "at_s12e0w_xt",
1527  "at_s1e3r_xt",
1528  "at_s1e3w_xt",
1529  "tlbi_vmalle1is",
1530  "tlbi_vae1is_xt",
1531  "tlbi_aside1is_xt",
1532  "tlbi_vaae1is_xt",
1533  "tlbi_vale1is_xt",
1534  "tlbi_vaale1is_xt",
1535  "tlbi_vmalle1",
1536  "tlbi_vae1_xt",
1537  "tlbi_aside1_xt",
1538  "tlbi_vaae1_xt",
1539  "tlbi_vale1_xt",
1540  "tlbi_vaale1_xt",
1541  "tlbi_ipas2e1is_xt",
1542  "tlbi_ipas2le1is_xt",
1543  "tlbi_alle2is",
1544  "tlbi_vae2is_xt",
1545  "tlbi_alle1is",
1546  "tlbi_vale2is_xt",
1547  "tlbi_vmalls12e1is",
1548  "tlbi_ipas2e1_xt",
1549  "tlbi_ipas2le1_xt",
1550  "tlbi_alle2",
1551  "tlbi_vae2_xt",
1552  "tlbi_alle1",
1553  "tlbi_vale2_xt",
1554  "tlbi_vmalls12e1",
1555  "tlbi_alle3is",
1556  "tlbi_vae3is_xt",
1557  "tlbi_vale3is_xt",
1558  "tlbi_alle3",
1559  "tlbi_vae3_xt",
1560  "tlbi_vale3_xt",
1561  "pmintenset_el1",
1562  "pmintenclr_el1",
1563  "pmcr_el0",
1564  "pmcntenset_el0",
1565  "pmcntenclr_el0",
1566  "pmovsclr_el0",
1567  "pmswinc_el0",
1568  "pmselr_el0",
1569  "pmceid0_el0",
1570  "pmceid1_el0",
1571  "pmccntr_el0",
1572  "pmxevtyper_el0",
1573  "pmccfiltr_el0",
1574  "pmxevcntr_el0",
1575  "pmuserenr_el0",
1576  "pmovsset_el0",
1577  "mair_el1",
1578  "amair_el1",
1579  "mair_el2",
1580  "amair_el2",
1581  "mair_el3",
1582  "amair_el3",
1583  "l2ctlr_el1",
1584  "l2ectlr_el1",
1585  "vbar_el1",
1586  "rvbar_el1",
1587  "isr_el1",
1588  "vbar_el2",
1589  "rvbar_el2",
1590  "vbar_el3",
1591  "rvbar_el3",
1592  "rmr_el3",
1593  "contextidr_el1",
1594  "tpidr_el1",
1595  "tpidr_el0",
1596  "tpidrro_el0",
1597  "tpidr_el2",
1598  "tpidr_el3",
1599  "cntfrq_el0",
1600  "cntpct_el0",
1601  "cntvct_el0",
1602  "cntp_ctl_el0",
1603  "cntp_cval_el0",
1604  "cntp_tval_el0",
1605  "cntv_ctl_el0",
1606  "cntv_cval_el0",
1607  "cntv_tval_el0",
1608  "cntp_ctl_el02",
1609  "cntp_cval_el02",
1610  "cntp_tval_el02",
1611  "cntv_ctl_el02",
1612  "cntv_cval_el02",
1613  "cntv_tval_el02",
1614  "cntkctl_el1",
1615  "cntkctl_el12",
1616  "cntps_ctl_el1",
1617  "cntps_cval_el1",
1618  "cntps_tval_el1",
1619  "cnthctl_el2",
1620  "cnthp_ctl_el2",
1621  "cnthp_cval_el2",
1622  "cnthp_tval_el2",
1623  "cnthv_ctl_el2",
1624  "cnthv_cval_el2",
1625  "cnthv_tval_el2",
1626  "cntvoff_el2",
1627  "pmevcntr0_el0",
1628  "pmevcntr1_el0",
1629  "pmevcntr2_el0",
1630  "pmevcntr3_el0",
1631  "pmevcntr4_el0",
1632  "pmevcntr5_el0",
1633  "pmevtyper0_el0",
1634  "pmevtyper1_el0",
1635  "pmevtyper2_el0",
1636  "pmevtyper3_el0",
1637  "pmevtyper4_el0",
1638  "pmevtyper5_el0",
1639  "il1data0_el1",
1640  "il1data1_el1",
1641  "il1data2_el1",
1642  "il1data3_el1",
1643  "dl1data0_el1",
1644  "dl1data1_el1",
1645  "dl1data2_el1",
1646  "dl1data3_el1",
1647  "dl1data4_el1",
1648  "l2actlr_el1",
1649  "cpuactlr_el1",
1650  "cpuectlr_el1",
1651  "cpumerrsr_el1",
1652  "l2merrsr_el1",
1653  "cbar_el1",
1654  "contextidr_el2",
1655 
1656  "ttbr1_el2",
1657  "id_aa64mmfr2_el1",
1658 
1659  "apdakeyhi_el1",
1660  "apdakeylo_el1",
1661  "apdbkeyhi_el1",
1662  "apdbkeylo_el1",
1663  "apgakeyhi_el1",
1664  "apgakeylo_el1",
1665  "apiakeyhi_el1",
1666  "apiakeylo_el1",
1667  "apibkeyhi_el1",
1668  "apibkeylo_el1",
1669  // GICv3, CPU interface
1670  "icc_pmr_el1",
1671  "icc_iar0_el1",
1672  "icc_eoir0_el1",
1673  "icc_hppir0_el1",
1674  "icc_bpr0_el1",
1675  "icc_ap0r0_el1",
1676  "icc_ap0r1_el1",
1677  "icc_ap0r2_el1",
1678  "icc_ap0r3_el1",
1679  "icc_ap1r0_el1",
1680  "icc_ap1r0_el1_ns",
1681  "icc_ap1r0_el1_s",
1682  "icc_ap1r1_el1",
1683  "icc_ap1r1_el1_ns",
1684  "icc_ap1r1_el1_s",
1685  "icc_ap1r2_el1",
1686  "icc_ap1r2_el1_ns",
1687  "icc_ap1r2_el1_s",
1688  "icc_ap1r3_el1",
1689  "icc_ap1r3_el1_ns",
1690  "icc_ap1r3_el1_s",
1691  "icc_dir_el1",
1692  "icc_rpr_el1",
1693  "icc_sgi1r_el1",
1694  "icc_asgi1r_el1",
1695  "icc_sgi0r_el1",
1696  "icc_iar1_el1",
1697  "icc_eoir1_el1",
1698  "icc_hppir1_el1",
1699  "icc_bpr1_el1",
1700  "icc_bpr1_el1_ns",
1701  "icc_bpr1_el1_s",
1702  "icc_ctlr_el1",
1703  "icc_ctlr_el1_ns",
1704  "icc_ctlr_el1_s",
1705  "icc_sre_el1",
1706  "icc_sre_el1_ns",
1707  "icc_sre_el1_s",
1708  "icc_igrpen0_el1",
1709  "icc_igrpen1_el1",
1710  "icc_igrpen1_el1_ns",
1711  "icc_igrpen1_el1_s",
1712  "icc_sre_el2",
1713  "icc_ctlr_el3",
1714  "icc_sre_el3",
1715  "icc_igrpen1_el3",
1716 
1717  // GICv3, CPU interface, virtualization
1718  "ich_ap0r0_el2",
1719  "ich_ap0r1_el2",
1720  "ich_ap0r2_el2",
1721  "ich_ap0r3_el2",
1722  "ich_ap1r0_el2",
1723  "ich_ap1r1_el2",
1724  "ich_ap1r2_el2",
1725  "ich_ap1r3_el2",
1726  "ich_hcr_el2",
1727  "ich_vtr_el2",
1728  "ich_misr_el2",
1729  "ich_eisr_el2",
1730  "ich_elrsr_el2",
1731  "ich_vmcr_el2",
1732  "ich_lr0_el2",
1733  "ich_lr1_el2",
1734  "ich_lr2_el2",
1735  "ich_lr3_el2",
1736  "ich_lr4_el2",
1737  "ich_lr5_el2",
1738  "ich_lr6_el2",
1739  "ich_lr7_el2",
1740  "ich_lr8_el2",
1741  "ich_lr9_el2",
1742  "ich_lr10_el2",
1743  "ich_lr11_el2",
1744  "ich_lr12_el2",
1745  "ich_lr13_el2",
1746  "ich_lr14_el2",
1747  "ich_lr15_el2",
1748 
1749  "icv_pmr_el1",
1750  "icv_iar0_el1",
1751  "icv_eoir0_el1",
1752  "icv_hppir0_el1",
1753  "icv_bpr0_el1",
1754  "icv_ap0r0_el1",
1755  "icv_ap0r1_el1",
1756  "icv_ap0r2_el1",
1757  "icv_ap0r3_el1",
1758  "icv_ap1r0_el1",
1759  "icv_ap1r0_el1_ns",
1760  "icv_ap1r0_el1_s",
1761  "icv_ap1r1_el1",
1762  "icv_ap1r1_el1_ns",
1763  "icv_ap1r1_el1_s",
1764  "icv_ap1r2_el1",
1765  "icv_ap1r2_el1_ns",
1766  "icv_ap1r2_el1_s",
1767  "icv_ap1r3_el1",
1768  "icv_ap1r3_el1_ns",
1769  "icv_ap1r3_el1_s",
1770  "icv_dir_el1",
1771  "icv_rpr_el1",
1772  "icv_sgi1r_el1",
1773  "icv_asgi1r_el1",
1774  "icv_sgi0r_el1",
1775  "icv_iar1_el1",
1776  "icv_eoir1_el1",
1777  "icv_hppir1_el1",
1778  "icv_bpr1_el1",
1779  "icv_bpr1_el1_ns",
1780  "icv_bpr1_el1_s",
1781  "icv_ctlr_el1",
1782  "icv_ctlr_el1_ns",
1783  "icv_ctlr_el1_s",
1784  "icv_sre_el1",
1785  "icv_sre_el1_ns",
1786  "icv_sre_el1_s",
1787  "icv_igrpen0_el1",
1788  "icv_igrpen1_el1",
1789  "icv_igrpen1_el1_ns",
1790  "icv_igrpen1_el1_s",
1791 
1792  "icc_ap0r0",
1793  "icc_ap0r1",
1794  "icc_ap0r2",
1795  "icc_ap0r3",
1796  "icc_ap1r0",
1797  "icc_ap1r0_ns",
1798  "icc_ap1r0_s",
1799  "icc_ap1r1",
1800  "icc_ap1r1_ns",
1801  "icc_ap1r1_s",
1802  "icc_ap1r2",
1803  "icc_ap1r2_ns",
1804  "icc_ap1r2_s",
1805  "icc_ap1r3",
1806  "icc_ap1r3_ns",
1807  "icc_ap1r3_s",
1808  "icc_asgi1r",
1809  "icc_bpr0",
1810  "icc_bpr1",
1811  "icc_bpr1_ns",
1812  "icc_bpr1_s",
1813  "icc_ctlr",
1814  "icc_ctlr_ns",
1815  "icc_ctlr_s",
1816  "icc_dir",
1817  "icc_eoir0",
1818  "icc_eoir1",
1819  "icc_hppir0",
1820  "icc_hppir1",
1821  "icc_hsre",
1822  "icc_iar0",
1823  "icc_iar1",
1824  "icc_igrpen0",
1825  "icc_igrpen1",
1826  "icc_igrpen1_ns",
1827  "icc_igrpen1_s",
1828  "icc_mctlr",
1829  "icc_mgrpen1",
1830  "icc_msre",
1831  "icc_pmr",
1832  "icc_rpr",
1833  "icc_sgi0r",
1834  "icc_sgi1r",
1835  "icc_sre",
1836  "icc_sre_ns",
1837  "icc_sre_s",
1838 
1839  "ich_ap0r0",
1840  "ich_ap0r1",
1841  "ich_ap0r2",
1842  "ich_ap0r3",
1843  "ich_ap1r0",
1844  "ich_ap1r1",
1845  "ich_ap1r2",
1846  "ich_ap1r3",
1847  "ich_hcr",
1848  "ich_vtr",
1849  "ich_misr",
1850  "ich_eisr",
1851  "ich_elrsr",
1852  "ich_vmcr",
1853  "ich_lr0",
1854  "ich_lr1",
1855  "ich_lr2",
1856  "ich_lr3",
1857  "ich_lr4",
1858  "ich_lr5",
1859  "ich_lr6",
1860  "ich_lr7",
1861  "ich_lr8",
1862  "ich_lr9",
1863  "ich_lr10",
1864  "ich_lr11",
1865  "ich_lr12",
1866  "ich_lr13",
1867  "ich_lr14",
1868  "ich_lr15",
1869  "ich_lrc0",
1870  "ich_lrc1",
1871  "ich_lrc2",
1872  "ich_lrc3",
1873  "ich_lrc4",
1874  "ich_lrc5",
1875  "ich_lrc6",
1876  "ich_lrc7",
1877  "ich_lrc8",
1878  "ich_lrc9",
1879  "ich_lrc10",
1880  "ich_lrc11",
1881  "ich_lrc12",
1882  "ich_lrc13",
1883  "ich_lrc14",
1884  "ich_lrc15",
1885 
1886  "id_aa64zfr0_el1",
1887  "zcr_el3",
1888  "zcr_el2",
1889  "zcr_el12",
1890  "zcr_el1",
1891 
1892  "num_phys_regs",
1893 
1894  // Dummy registers
1895  "nop",
1896  "raz",
1897  "cp14_unimpl",
1898  "cp15_unimpl",
1899  "unknown",
1900  "impl_defined",
1901  "erridr_el1",
1902  "errselr_el1",
1903  "erxfr_el1",
1904  "erxctlr_el1",
1905  "erxstatus_el1",
1906  "erxaddr_el1",
1907  "erxmisc0_el1",
1908  "erxmisc1_el1",
1909  "disr_el1",
1910  "vsesr_el2",
1911  "vdisr_el2",
1912 
1913  // PSTATE
1914  "pan",
1915  };
1916 
1917  static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
1918  "The miscRegName array and NUM_MISCREGS are inconsistent.");
1919 
1920  // This mask selects bits of the CPSR that actually go in the CondCodes
1921  // integer register to allow renaming.
1922  static const uint32_t CondCodesMask = 0xF00F0000;
1923  static const uint32_t CpsrMaskQ = 0x08000000;
1924 
1925  // APSR (Application Program Status Register Mask). It is the user level
1926  // alias for the CPSR. The APSR is a subset of the CPSR. Although
1927  // bits[15:0] are UNKNOWN on reads, it is permitted that, on a read of
1928  // APSR:
1929  // Bit[9] returns the value of CPSR.E.
1930  // Bits[8:6] return the value of CPSR.{A,I, F}, the mask bits.
1931  static const uint32_t ApsrMask = CpsrMaskQ | CondCodesMask | 0x000001D0;
1932 
1933  // CPSR (Current Program Status Register Mask).
1934  static const uint32_t CpsrMask = ApsrMask | 0x00F003DF;
1935 
1936  // This mask selects bits of the FPSCR that actually go in the FpCondCodes
1937  // integer register to allow renaming.
1938  static const uint32_t FpCondCodesMask = 0xF0000000;
1939  // This mask selects the cumulative saturation flag of the FPSCR.
1940  static const uint32_t FpscrQcMask = 0x08000000;
1941  // This mask selects the AHP bit of the FPSCR.
1942  static const uint32_t FpscrAhpMask = 0x04000000;
1943  // This mask selects the cumulative FP exception flags of the FPSCR.
1944  static const uint32_t FpscrExcMask = 0x0000009F;
1945 
1960  std::tuple<bool, bool> canReadCoprocReg(MiscRegIndex reg, SCR scr,
1961  CPSR cpsr, ThreadContext *tc);
1962 
1977  std::tuple<bool, bool> canWriteCoprocReg(MiscRegIndex reg, SCR scr,
1978  CPSR cpsr, ThreadContext *tc);
1979 
1980  // Checks for UNDEFINED behaviours when accessing AArch32
1981  // Generic Timer system registers
1983 
1984  // Checks read access permissions to AArch64 system registers
1985  bool canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
1986  ThreadContext *tc);
1987 
1988  // Checks write access permissions to AArch64 system registers
1989  bool canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
1990  ThreadContext *tc);
1991 
1992  // Uses just the scr.ns bit to pre flatten the misc regs. This is useful
1993  // for MCR/MRC instructions
1994  int
1996 
1997  // Flattens a misc reg index using the specified security state. This is
1998  // used for opperations (eg address translations) where the security
1999  // state of the register access may differ from the current state of the
2000  // processor
2001  int
2003 
2004  int
2006 
2007  // Takes a misc reg index and returns the root reg if its one of a set of
2008  // banked registers
2009  void
2011 
2012  int
2013  unflattenMiscReg(int reg);
2014 
2015 }
2016 
2017 #endif // __ARCH_ARM_MISCREGS_HH__
int snsBankedIndex64(MiscRegIndex reg, ThreadContext *tc)
Definition: miscregs.cc:1109
MiscRegIndex
Definition: miscregs.hh:56
bitset< NUM_MISCREG_INFOS > miscRegInfo[NUM_MISCREGS]
Definition: miscregs.cc:2946
Bitfield< 5, 3 > reg
Definition: types.hh:87
std::tuple< bool, bool > canWriteCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
Check for permission to write coprocessor registers.
Definition: miscregs.cc:1033
bool AArch32isUndefinedGenericTimer(MiscRegIndex reg, ThreadContext *tc)
Definition: miscregs.cc:1079
void preUnflattenMiscReg()
Definition: miscregs.cc:1127
Definition: ccregs.hh:41
const char *const miscRegName[]
Definition: miscregs.hh:1033
ThreadContext is the external interface to all thread state for anything outside of the CPU...
MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1)
Definition: miscregs.cc:928
Bitfield< 0 > ns
static const uint32_t CpsrMask
Definition: miscregs.hh:1934
int unflattenMiscReg(int reg)
Definition: miscregs.cc:1143
MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1, unsigned crn, unsigned crm, unsigned op2)
Definition: miscregs.cc:1239
static const uint32_t ApsrMask
Definition: miscregs.hh:1931
static const uint32_t CpsrMaskQ
Definition: miscregs.hh:1923
bool canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr, ThreadContext *tc)
Definition: miscregs.cc:1149
MiscRegInfo
Definition: miscregs.hh:965
static const uint32_t CondCodesMask
Definition: miscregs.hh:1922
int snsBankedIndex(MiscRegIndex reg, ThreadContext *tc)
Definition: miscregs.cc:1091
Bitfield< 7, 5 > opc2
Definition: types.hh:114
std::tuple< bool, bool > canReadCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr, ThreadContext *tc)
Check for permission to read coprocessor registers.
Definition: miscregs.cc:987
bool aarch64SysRegReadOnly(MiscRegIndex miscReg)
static const uint32_t FpscrExcMask
Definition: miscregs.hh:1944
MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1, unsigned crm, unsigned opc2)
Definition: miscregs.cc:128
MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1, unsigned crm, unsigned opc2)
Definition: miscregs.cc:51
static const uint32_t FpCondCodesMask
Definition: miscregs.hh:1938
static const uint32_t FpscrQcMask
Definition: miscregs.hh:1940
bool canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr, ThreadContext *tc)
Definition: miscregs.cc:1191
static const uint32_t FpscrAhpMask
Definition: miscregs.hh:1942

Generated on Mon Jun 8 2020 15:34:40 for gem5 by doxygen 1.8.13