miscregs.hh (10324:f40134eb3f85) miscregs.hh (10338:8bee5f4edb92)
1/*
2 * Copyright (c) 2010-2014 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 * Authors: Gabe Black
41 * Giacomo Gabrielli
42 */
43#ifndef __ARCH_ARM_MISCREGS_HH__
44#define __ARCH_ARM_MISCREGS_HH__
45
46#include <bitset>
47
48#include "base/bitunion.hh"
49#include "base/compiler.hh"
50
51class ThreadContext;
52
53
54namespace ArmISA
55{
1/*
2 * Copyright (c) 2010-2014 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 * Authors: Gabe Black
41 * Giacomo Gabrielli
42 */
43#ifndef __ARCH_ARM_MISCREGS_HH__
44#define __ARCH_ARM_MISCREGS_HH__
45
46#include <bitset>
47
48#include "base/bitunion.hh"
49#include "base/compiler.hh"
50
51class ThreadContext;
52
53
54namespace ArmISA
55{
56 enum ConditionCode {
57 COND_EQ = 0,
58 COND_NE, // 1
59 COND_CS, // 2
60 COND_CC, // 3
61 COND_MI, // 4
62 COND_PL, // 5
63 COND_VS, // 6
64 COND_VC, // 7
65 COND_HI, // 8
66 COND_LS, // 9
67 COND_GE, // 10
68 COND_LT, // 11
69 COND_GT, // 12
70 COND_LE, // 13
71 COND_AL, // 14
72 COND_UC // 15
73 };
74
75 enum MiscRegIndex {
76 MISCREG_CPSR = 0, // 0
77 MISCREG_SPSR, // 1
78 MISCREG_SPSR_FIQ, // 2
79 MISCREG_SPSR_IRQ, // 3
80 MISCREG_SPSR_SVC, // 4
81 MISCREG_SPSR_MON, // 5
82 MISCREG_SPSR_ABT, // 6
83 MISCREG_SPSR_HYP, // 7
84 MISCREG_SPSR_UND, // 8
85 MISCREG_ELR_HYP, // 9
86 MISCREG_FPSID, // 10
87 MISCREG_FPSCR, // 11
88 MISCREG_MVFR1, // 12
89 MISCREG_MVFR0, // 13
90 MISCREG_FPEXC, // 14
91
92 // Helper registers
93 MISCREG_CPSR_MODE, // 15
94 MISCREG_CPSR_Q, // 16
95 MISCREG_FPSCR_EXC, // 17
96 MISCREG_FPSCR_QC, // 18
97 MISCREG_LOCKADDR, // 19
98 MISCREG_LOCKFLAG, // 20
99 MISCREG_PRRR_MAIR0, // 21
100 MISCREG_PRRR_MAIR0_NS, // 22
101 MISCREG_PRRR_MAIR0_S, // 23
102 MISCREG_NMRR_MAIR1, // 24
103 MISCREG_NMRR_MAIR1_NS, // 25
104 MISCREG_NMRR_MAIR1_S, // 26
105 MISCREG_PMXEVTYPER_PMCCFILTR, // 27
106 MISCREG_SCTLR_RST, // 28
107 MISCREG_SEV_MAILBOX, // 29
108
109 // AArch32 CP14 registers (debug/trace/ThumbEE/Jazelle control)
110 MISCREG_DBGDIDR, // 30
111 MISCREG_DBGDSCRint, // 31
112 MISCREG_DBGDCCINT, // 32
113 MISCREG_DBGDTRTXint, // 33
114 MISCREG_DBGDTRRXint, // 34
115 MISCREG_DBGWFAR, // 35
116 MISCREG_DBGVCR, // 36
117 MISCREG_DBGDTRRXext, // 37
118 MISCREG_DBGDSCRext, // 38
119 MISCREG_DBGDTRTXext, // 39
120 MISCREG_DBGOSECCR, // 40
121 MISCREG_DBGBVR0, // 41
122 MISCREG_DBGBVR1, // 42
123 MISCREG_DBGBVR2, // 43
124 MISCREG_DBGBVR3, // 44
125 MISCREG_DBGBVR4, // 45
126 MISCREG_DBGBVR5, // 46
127 MISCREG_DBGBCR0, // 47
128 MISCREG_DBGBCR1, // 48
129 MISCREG_DBGBCR2, // 49
130 MISCREG_DBGBCR3, // 50
131 MISCREG_DBGBCR4, // 51
132 MISCREG_DBGBCR5, // 52
133 MISCREG_DBGWVR0, // 53
134 MISCREG_DBGWVR1, // 54
135 MISCREG_DBGWVR2, // 55
136 MISCREG_DBGWVR3, // 56
137 MISCREG_DBGWCR0, // 57
138 MISCREG_DBGWCR1, // 58
139 MISCREG_DBGWCR2, // 59
140 MISCREG_DBGWCR3, // 60
141 MISCREG_DBGDRAR, // 61
142 MISCREG_DBGBXVR4, // 62
143 MISCREG_DBGBXVR5, // 63
144 MISCREG_DBGOSLAR, // 64
145 MISCREG_DBGOSLSR, // 65
146 MISCREG_DBGOSDLR, // 66
147 MISCREG_DBGPRCR, // 67
148 MISCREG_DBGDSAR, // 68
149 MISCREG_DBGCLAIMSET, // 69
150 MISCREG_DBGCLAIMCLR, // 70
151 MISCREG_DBGAUTHSTATUS, // 71
152 MISCREG_DBGDEVID2, // 72
153 MISCREG_DBGDEVID1, // 73
154 MISCREG_DBGDEVID0, // 74
155 MISCREG_TEECR, // 75
156 MISCREG_JIDR, // 76
157 MISCREG_TEEHBR, // 77
158 MISCREG_JOSCR, // 78
159 MISCREG_JMCR, // 79
160
161 // AArch32 CP15 registers (system control)
162 MISCREG_MIDR, // 80
163 MISCREG_CTR, // 81
164 MISCREG_TCMTR, // 82
165 MISCREG_TLBTR, // 83
166 MISCREG_MPIDR, // 84
167 MISCREG_REVIDR, // 85
168 MISCREG_ID_PFR0, // 86
169 MISCREG_ID_PFR1, // 87
170 MISCREG_ID_DFR0, // 88
171 MISCREG_ID_AFR0, // 89
172 MISCREG_ID_MMFR0, // 90
173 MISCREG_ID_MMFR1, // 91
174 MISCREG_ID_MMFR2, // 92
175 MISCREG_ID_MMFR3, // 93
176 MISCREG_ID_ISAR0, // 94
177 MISCREG_ID_ISAR1, // 95
178 MISCREG_ID_ISAR2, // 96
179 MISCREG_ID_ISAR3, // 97
180 MISCREG_ID_ISAR4, // 98
181 MISCREG_ID_ISAR5, // 99
182 MISCREG_CCSIDR, // 100
183 MISCREG_CLIDR, // 101
184 MISCREG_AIDR, // 102
185 MISCREG_CSSELR, // 103
186 MISCREG_CSSELR_NS, // 104
187 MISCREG_CSSELR_S, // 105
188 MISCREG_VPIDR, // 106
189 MISCREG_VMPIDR, // 107
190 MISCREG_SCTLR, // 108
191 MISCREG_SCTLR_NS, // 109
192 MISCREG_SCTLR_S, // 110
193 MISCREG_ACTLR, // 111
194 MISCREG_ACTLR_NS, // 112
195 MISCREG_ACTLR_S, // 113
196 MISCREG_CPACR, // 114
197 MISCREG_SCR, // 115
198 MISCREG_SDER, // 116
199 MISCREG_NSACR, // 117
200 MISCREG_HSCTLR, // 118
201 MISCREG_HACTLR, // 119
202 MISCREG_HCR, // 120
203 MISCREG_HDCR, // 121
204 MISCREG_HCPTR, // 122
205 MISCREG_HSTR, // 123
206 MISCREG_HACR, // 124
207 MISCREG_TTBR0, // 125
208 MISCREG_TTBR0_NS, // 126
209 MISCREG_TTBR0_S, // 127
210 MISCREG_TTBR1, // 128
211 MISCREG_TTBR1_NS, // 129
212 MISCREG_TTBR1_S, // 130
213 MISCREG_TTBCR, // 131
214 MISCREG_TTBCR_NS, // 132
215 MISCREG_TTBCR_S, // 133
216 MISCREG_HTCR, // 134
217 MISCREG_VTCR, // 135
218 MISCREG_DACR, // 136
219 MISCREG_DACR_NS, // 137
220 MISCREG_DACR_S, // 138
221 MISCREG_DFSR, // 139
222 MISCREG_DFSR_NS, // 140
223 MISCREG_DFSR_S, // 141
224 MISCREG_IFSR, // 142
225 MISCREG_IFSR_NS, // 143
226 MISCREG_IFSR_S, // 144
227 MISCREG_ADFSR, // 145
228 MISCREG_ADFSR_NS, // 146
229 MISCREG_ADFSR_S, // 147
230 MISCREG_AIFSR, // 148
231 MISCREG_AIFSR_NS, // 149
232 MISCREG_AIFSR_S, // 150
233 MISCREG_HADFSR, // 151
234 MISCREG_HAIFSR, // 152
235 MISCREG_HSR, // 153
236 MISCREG_DFAR, // 154
237 MISCREG_DFAR_NS, // 155
238 MISCREG_DFAR_S, // 156
239 MISCREG_IFAR, // 157
240 MISCREG_IFAR_NS, // 158
241 MISCREG_IFAR_S, // 159
242 MISCREG_HDFAR, // 160
243 MISCREG_HIFAR, // 161
244 MISCREG_HPFAR, // 162
245 MISCREG_ICIALLUIS, // 163
246 MISCREG_BPIALLIS, // 164
247 MISCREG_PAR, // 165
248 MISCREG_PAR_NS, // 166
249 MISCREG_PAR_S, // 167
250 MISCREG_ICIALLU, // 168
251 MISCREG_ICIMVAU, // 169
252 MISCREG_CP15ISB, // 170
253 MISCREG_BPIALL, // 171
254 MISCREG_BPIMVA, // 172
255 MISCREG_DCIMVAC, // 173
256 MISCREG_DCISW, // 174
257 MISCREG_ATS1CPR, // 175
258 MISCREG_ATS1CPW, // 176
259 MISCREG_ATS1CUR, // 177
260 MISCREG_ATS1CUW, // 178
261 MISCREG_ATS12NSOPR, // 179
262 MISCREG_ATS12NSOPW, // 180
263 MISCREG_ATS12NSOUR, // 181
264 MISCREG_ATS12NSOUW, // 182
265 MISCREG_DCCMVAC, // 183
266 MISCREG_DCCSW, // 184
267 MISCREG_CP15DSB, // 185
268 MISCREG_CP15DMB, // 186
269 MISCREG_DCCMVAU, // 187
270 MISCREG_DCCIMVAC, // 188
271 MISCREG_DCCISW, // 189
272 MISCREG_ATS1HR, // 190
273 MISCREG_ATS1HW, // 191
274 MISCREG_TLBIALLIS, // 192
275 MISCREG_TLBIMVAIS, // 193
276 MISCREG_TLBIASIDIS, // 194
277 MISCREG_TLBIMVAAIS, // 195
278 MISCREG_TLBIMVALIS, // 196
279 MISCREG_TLBIMVAALIS, // 197
280 MISCREG_ITLBIALL, // 198
281 MISCREG_ITLBIMVA, // 199
282 MISCREG_ITLBIASID, // 200
283 MISCREG_DTLBIALL, // 201
284 MISCREG_DTLBIMVA, // 202
285 MISCREG_DTLBIASID, // 203
286 MISCREG_TLBIALL, // 204
287 MISCREG_TLBIMVA, // 205
288 MISCREG_TLBIASID, // 206
289 MISCREG_TLBIMVAA, // 207
290 MISCREG_TLBIMVAL, // 208
291 MISCREG_TLBIMVAAL, // 209
292 MISCREG_TLBIIPAS2IS, // 210
293 MISCREG_TLBIIPAS2LIS, // 211
294 MISCREG_TLBIALLHIS, // 212
295 MISCREG_TLBIMVAHIS, // 213
296 MISCREG_TLBIALLNSNHIS, // 214
297 MISCREG_TLBIMVALHIS, // 215
298 MISCREG_TLBIIPAS2, // 216
299 MISCREG_TLBIIPAS2L, // 217
300 MISCREG_TLBIALLH, // 218
301 MISCREG_TLBIMVAH, // 219
302 MISCREG_TLBIALLNSNH, // 220
303 MISCREG_TLBIMVALH, // 221
304 MISCREG_PMCR, // 222
305 MISCREG_PMCNTENSET, // 223
306 MISCREG_PMCNTENCLR, // 224
307 MISCREG_PMOVSR, // 225
308 MISCREG_PMSWINC, // 226
309 MISCREG_PMSELR, // 227
310 MISCREG_PMCEID0, // 228
311 MISCREG_PMCEID1, // 229
312 MISCREG_PMCCNTR, // 230
313 MISCREG_PMXEVTYPER, // 231
314 MISCREG_PMCCFILTR, // 232
315 MISCREG_PMXEVCNTR, // 233
316 MISCREG_PMUSERENR, // 234
317 MISCREG_PMINTENSET, // 235
318 MISCREG_PMINTENCLR, // 236
319 MISCREG_PMOVSSET, // 237
320 MISCREG_L2CTLR, // 238
321 MISCREG_L2ECTLR, // 239
322 MISCREG_PRRR, // 240
323 MISCREG_PRRR_NS, // 241
324 MISCREG_PRRR_S, // 242
325 MISCREG_MAIR0, // 243
326 MISCREG_MAIR0_NS, // 244
327 MISCREG_MAIR0_S, // 245
328 MISCREG_NMRR, // 246
329 MISCREG_NMRR_NS, // 247
330 MISCREG_NMRR_S, // 248
331 MISCREG_MAIR1, // 249
332 MISCREG_MAIR1_NS, // 250
333 MISCREG_MAIR1_S, // 251
334 MISCREG_AMAIR0, // 252
335 MISCREG_AMAIR0_NS, // 253
336 MISCREG_AMAIR0_S, // 254
337 MISCREG_AMAIR1, // 255
338 MISCREG_AMAIR1_NS, // 256
339 MISCREG_AMAIR1_S, // 257
340 MISCREG_HMAIR0, // 258
341 MISCREG_HMAIR1, // 259
342 MISCREG_HAMAIR0, // 260
343 MISCREG_HAMAIR1, // 261
344 MISCREG_VBAR, // 262
345 MISCREG_VBAR_NS, // 263
346 MISCREG_VBAR_S, // 264
347 MISCREG_MVBAR, // 265
348 MISCREG_RMR, // 266
349 MISCREG_ISR, // 267
350 MISCREG_HVBAR, // 268
351 MISCREG_FCSEIDR, // 269
352 MISCREG_CONTEXTIDR, // 270
353 MISCREG_CONTEXTIDR_NS, // 271
354 MISCREG_CONTEXTIDR_S, // 272
355 MISCREG_TPIDRURW, // 273
356 MISCREG_TPIDRURW_NS, // 274
357 MISCREG_TPIDRURW_S, // 275
358 MISCREG_TPIDRURO, // 276
359 MISCREG_TPIDRURO_NS, // 277
360 MISCREG_TPIDRURO_S, // 278
361 MISCREG_TPIDRPRW, // 279
362 MISCREG_TPIDRPRW_NS, // 280
363 MISCREG_TPIDRPRW_S, // 281
364 MISCREG_HTPIDR, // 282
365 MISCREG_CNTFRQ, // 283
366 MISCREG_CNTKCTL, // 284
367 MISCREG_CNTP_TVAL, // 285
368 MISCREG_CNTP_TVAL_NS, // 286
369 MISCREG_CNTP_TVAL_S, // 287
370 MISCREG_CNTP_CTL, // 288
371 MISCREG_CNTP_CTL_NS, // 289
372 MISCREG_CNTP_CTL_S, // 290
373 MISCREG_CNTV_TVAL, // 291
374 MISCREG_CNTV_CTL, // 292
375 MISCREG_CNTHCTL, // 293
376 MISCREG_CNTHP_TVAL, // 294
377 MISCREG_CNTHP_CTL, // 295
378 MISCREG_IL1DATA0, // 296
379 MISCREG_IL1DATA1, // 297
380 MISCREG_IL1DATA2, // 298
381 MISCREG_IL1DATA3, // 299
382 MISCREG_DL1DATA0, // 300
383 MISCREG_DL1DATA1, // 301
384 MISCREG_DL1DATA2, // 302
385 MISCREG_DL1DATA3, // 303
386 MISCREG_DL1DATA4, // 304
387 MISCREG_RAMINDEX, // 305
388 MISCREG_L2ACTLR, // 306
389 MISCREG_CBAR, // 307
390 MISCREG_HTTBR, // 308
391 MISCREG_VTTBR, // 309
392 MISCREG_CNTPCT, // 310
393 MISCREG_CNTVCT, // 311
394 MISCREG_CNTP_CVAL, // 312
395 MISCREG_CNTP_CVAL_NS, // 313
396 MISCREG_CNTP_CVAL_S, // 314
397 MISCREG_CNTV_CVAL, // 315
398 MISCREG_CNTVOFF, // 316
399 MISCREG_CNTHP_CVAL, // 317
400 MISCREG_CPUMERRSR, // 318
401 MISCREG_L2MERRSR, // 319
402
403 // AArch64 registers (Op0=2)
404 MISCREG_MDCCINT_EL1, // 320
405 MISCREG_OSDTRRX_EL1, // 321
406 MISCREG_MDSCR_EL1, // 322
407 MISCREG_OSDTRTX_EL1, // 323
408 MISCREG_OSECCR_EL1, // 324
409 MISCREG_DBGBVR0_EL1, // 325
410 MISCREG_DBGBVR1_EL1, // 326
411 MISCREG_DBGBVR2_EL1, // 327
412 MISCREG_DBGBVR3_EL1, // 328
413 MISCREG_DBGBVR4_EL1, // 329
414 MISCREG_DBGBVR5_EL1, // 330
415 MISCREG_DBGBCR0_EL1, // 331
416 MISCREG_DBGBCR1_EL1, // 332
417 MISCREG_DBGBCR2_EL1, // 333
418 MISCREG_DBGBCR3_EL1, // 334
419 MISCREG_DBGBCR4_EL1, // 335
420 MISCREG_DBGBCR5_EL1, // 336
421 MISCREG_DBGWVR0_EL1, // 337
422 MISCREG_DBGWVR1_EL1, // 338
423 MISCREG_DBGWVR2_EL1, // 339
424 MISCREG_DBGWVR3_EL1, // 340
425 MISCREG_DBGWCR0_EL1, // 341
426 MISCREG_DBGWCR1_EL1, // 342
427 MISCREG_DBGWCR2_EL1, // 343
428 MISCREG_DBGWCR3_EL1, // 344
429 MISCREG_MDCCSR_EL0, // 345
430 MISCREG_MDDTR_EL0, // 346
431 MISCREG_MDDTRTX_EL0, // 347
432 MISCREG_MDDTRRX_EL0, // 348
433 MISCREG_DBGVCR32_EL2, // 349
434 MISCREG_MDRAR_EL1, // 350
435 MISCREG_OSLAR_EL1, // 351
436 MISCREG_OSLSR_EL1, // 352
437 MISCREG_OSDLR_EL1, // 353
438 MISCREG_DBGPRCR_EL1, // 354
439 MISCREG_DBGCLAIMSET_EL1, // 355
440 MISCREG_DBGCLAIMCLR_EL1, // 356
441 MISCREG_DBGAUTHSTATUS_EL1, // 357
442 MISCREG_TEECR32_EL1, // 358
443 MISCREG_TEEHBR32_EL1, // 359
444
445 // AArch64 registers (Op0=1,3)
446 MISCREG_MIDR_EL1, // 360
447 MISCREG_MPIDR_EL1, // 361
448 MISCREG_REVIDR_EL1, // 362
449 MISCREG_ID_PFR0_EL1, // 363
450 MISCREG_ID_PFR1_EL1, // 364
451 MISCREG_ID_DFR0_EL1, // 365
452 MISCREG_ID_AFR0_EL1, // 366
453 MISCREG_ID_MMFR0_EL1, // 367
454 MISCREG_ID_MMFR1_EL1, // 368
455 MISCREG_ID_MMFR2_EL1, // 369
456 MISCREG_ID_MMFR3_EL1, // 370
457 MISCREG_ID_ISAR0_EL1, // 371
458 MISCREG_ID_ISAR1_EL1, // 372
459 MISCREG_ID_ISAR2_EL1, // 373
460 MISCREG_ID_ISAR3_EL1, // 374
461 MISCREG_ID_ISAR4_EL1, // 375
462 MISCREG_ID_ISAR5_EL1, // 376
463 MISCREG_MVFR0_EL1, // 377
464 MISCREG_MVFR1_EL1, // 378
465 MISCREG_MVFR2_EL1, // 379
466 MISCREG_ID_AA64PFR0_EL1, // 380
467 MISCREG_ID_AA64PFR1_EL1, // 381
468 MISCREG_ID_AA64DFR0_EL1, // 382
469 MISCREG_ID_AA64DFR1_EL1, // 383
470 MISCREG_ID_AA64AFR0_EL1, // 384
471 MISCREG_ID_AA64AFR1_EL1, // 385
472 MISCREG_ID_AA64ISAR0_EL1, // 386
473 MISCREG_ID_AA64ISAR1_EL1, // 387
474 MISCREG_ID_AA64MMFR0_EL1, // 388
475 MISCREG_ID_AA64MMFR1_EL1, // 389
476 MISCREG_CCSIDR_EL1, // 390
477 MISCREG_CLIDR_EL1, // 391
478 MISCREG_AIDR_EL1, // 392
479 MISCREG_CSSELR_EL1, // 393
480 MISCREG_CTR_EL0, // 394
481 MISCREG_DCZID_EL0, // 395
482 MISCREG_VPIDR_EL2, // 396
483 MISCREG_VMPIDR_EL2, // 397
484 MISCREG_SCTLR_EL1, // 398
485 MISCREG_ACTLR_EL1, // 399
486 MISCREG_CPACR_EL1, // 400
487 MISCREG_SCTLR_EL2, // 401
488 MISCREG_ACTLR_EL2, // 402
489 MISCREG_HCR_EL2, // 403
490 MISCREG_MDCR_EL2, // 404
491 MISCREG_CPTR_EL2, // 405
492 MISCREG_HSTR_EL2, // 406
493 MISCREG_HACR_EL2, // 407
494 MISCREG_SCTLR_EL3, // 408
495 MISCREG_ACTLR_EL3, // 409
496 MISCREG_SCR_EL3, // 410
497 MISCREG_SDER32_EL3, // 411
498 MISCREG_CPTR_EL3, // 412
499 MISCREG_MDCR_EL3, // 413
500 MISCREG_TTBR0_EL1, // 414
501 MISCREG_TTBR1_EL1, // 415
502 MISCREG_TCR_EL1, // 416
503 MISCREG_TTBR0_EL2, // 417
504 MISCREG_TCR_EL2, // 418
505 MISCREG_VTTBR_EL2, // 419
506 MISCREG_VTCR_EL2, // 420
507 MISCREG_TTBR0_EL3, // 421
508 MISCREG_TCR_EL3, // 422
509 MISCREG_DACR32_EL2, // 423
510 MISCREG_SPSR_EL1, // 424
511 MISCREG_ELR_EL1, // 425
512 MISCREG_SP_EL0, // 426
513 MISCREG_SPSEL, // 427
514 MISCREG_CURRENTEL, // 428
515 MISCREG_NZCV, // 429
516 MISCREG_DAIF, // 430
517 MISCREG_FPCR, // 431
518 MISCREG_FPSR, // 432
519 MISCREG_DSPSR_EL0, // 433
520 MISCREG_DLR_EL0, // 434
521 MISCREG_SPSR_EL2, // 435
522 MISCREG_ELR_EL2, // 436
523 MISCREG_SP_EL1, // 437
524 MISCREG_SPSR_IRQ_AA64, // 438
525 MISCREG_SPSR_ABT_AA64, // 439
526 MISCREG_SPSR_UND_AA64, // 440
527 MISCREG_SPSR_FIQ_AA64, // 441
528 MISCREG_SPSR_EL3, // 442
529 MISCREG_ELR_EL3, // 443
530 MISCREG_SP_EL2, // 444
531 MISCREG_AFSR0_EL1, // 445
532 MISCREG_AFSR1_EL1, // 446
533 MISCREG_ESR_EL1, // 447
534 MISCREG_IFSR32_EL2, // 448
535 MISCREG_AFSR0_EL2, // 449
536 MISCREG_AFSR1_EL2, // 450
537 MISCREG_ESR_EL2, // 451
538 MISCREG_FPEXC32_EL2, // 452
539 MISCREG_AFSR0_EL3, // 453
540 MISCREG_AFSR1_EL3, // 454
541 MISCREG_ESR_EL3, // 455
542 MISCREG_FAR_EL1, // 456
543 MISCREG_FAR_EL2, // 457
544 MISCREG_HPFAR_EL2, // 458
545 MISCREG_FAR_EL3, // 459
546 MISCREG_IC_IALLUIS, // 460
547 MISCREG_PAR_EL1, // 461
548 MISCREG_IC_IALLU, // 462
549 MISCREG_DC_IVAC_Xt, // 463
550 MISCREG_DC_ISW_Xt, // 464
551 MISCREG_AT_S1E1R_Xt, // 465
552 MISCREG_AT_S1E1W_Xt, // 466
553 MISCREG_AT_S1E0R_Xt, // 467
554 MISCREG_AT_S1E0W_Xt, // 468
555 MISCREG_DC_CSW_Xt, // 469
556 MISCREG_DC_CISW_Xt, // 470
557 MISCREG_DC_ZVA_Xt, // 471
558 MISCREG_IC_IVAU_Xt, // 472
559 MISCREG_DC_CVAC_Xt, // 473
560 MISCREG_DC_CVAU_Xt, // 474
561 MISCREG_DC_CIVAC_Xt, // 475
562 MISCREG_AT_S1E2R_Xt, // 476
563 MISCREG_AT_S1E2W_Xt, // 477
564 MISCREG_AT_S12E1R_Xt, // 478
565 MISCREG_AT_S12E1W_Xt, // 479
566 MISCREG_AT_S12E0R_Xt, // 480
567 MISCREG_AT_S12E0W_Xt, // 481
568 MISCREG_AT_S1E3R_Xt, // 482
569 MISCREG_AT_S1E3W_Xt, // 483
570 MISCREG_TLBI_VMALLE1IS, // 484
571 MISCREG_TLBI_VAE1IS_Xt, // 485
572 MISCREG_TLBI_ASIDE1IS_Xt, // 486
573 MISCREG_TLBI_VAAE1IS_Xt, // 487
574 MISCREG_TLBI_VALE1IS_Xt, // 488
575 MISCREG_TLBI_VAALE1IS_Xt, // 489
576 MISCREG_TLBI_VMALLE1, // 490
577 MISCREG_TLBI_VAE1_Xt, // 491
578 MISCREG_TLBI_ASIDE1_Xt, // 492
579 MISCREG_TLBI_VAAE1_Xt, // 493
580 MISCREG_TLBI_VALE1_Xt, // 494
581 MISCREG_TLBI_VAALE1_Xt, // 495
582 MISCREG_TLBI_IPAS2E1IS_Xt, // 496
583 MISCREG_TLBI_IPAS2LE1IS_Xt, // 497
584 MISCREG_TLBI_ALLE2IS, // 498
585 MISCREG_TLBI_VAE2IS_Xt, // 499
586 MISCREG_TLBI_ALLE1IS, // 500
587 MISCREG_TLBI_VALE2IS_Xt, // 501
588 MISCREG_TLBI_VMALLS12E1IS, // 502
589 MISCREG_TLBI_IPAS2E1_Xt, // 503
590 MISCREG_TLBI_IPAS2LE1_Xt, // 504
591 MISCREG_TLBI_ALLE2, // 505
592 MISCREG_TLBI_VAE2_Xt, // 506
593 MISCREG_TLBI_ALLE1, // 507
594 MISCREG_TLBI_VALE2_Xt, // 508
595 MISCREG_TLBI_VMALLS12E1, // 509
596 MISCREG_TLBI_ALLE3IS, // 510
597 MISCREG_TLBI_VAE3IS_Xt, // 511
598 MISCREG_TLBI_VALE3IS_Xt, // 512
599 MISCREG_TLBI_ALLE3, // 513
600 MISCREG_TLBI_VAE3_Xt, // 514
601 MISCREG_TLBI_VALE3_Xt, // 515
602 MISCREG_PMINTENSET_EL1, // 516
603 MISCREG_PMINTENCLR_EL1, // 517
604 MISCREG_PMCR_EL0, // 518
605 MISCREG_PMCNTENSET_EL0, // 519
606 MISCREG_PMCNTENCLR_EL0, // 520
607 MISCREG_PMOVSCLR_EL0, // 521
608 MISCREG_PMSWINC_EL0, // 522
609 MISCREG_PMSELR_EL0, // 523
610 MISCREG_PMCEID0_EL0, // 524
611 MISCREG_PMCEID1_EL0, // 525
612 MISCREG_PMCCNTR_EL0, // 526
613 MISCREG_PMXEVTYPER_EL0, // 527
614 MISCREG_PMCCFILTR_EL0, // 528
615 MISCREG_PMXEVCNTR_EL0, // 529
616 MISCREG_PMUSERENR_EL0, // 530
617 MISCREG_PMOVSSET_EL0, // 531
618 MISCREG_MAIR_EL1, // 532
619 MISCREG_AMAIR_EL1, // 533
620 MISCREG_MAIR_EL2, // 534
621 MISCREG_AMAIR_EL2, // 535
622 MISCREG_MAIR_EL3, // 536
623 MISCREG_AMAIR_EL3, // 537
624 MISCREG_L2CTLR_EL1, // 538
625 MISCREG_L2ECTLR_EL1, // 539
626 MISCREG_VBAR_EL1, // 540
627 MISCREG_RVBAR_EL1, // 541
628 MISCREG_ISR_EL1, // 542
629 MISCREG_VBAR_EL2, // 543
630 MISCREG_RVBAR_EL2, // 544
631 MISCREG_VBAR_EL3, // 545
632 MISCREG_RVBAR_EL3, // 546
633 MISCREG_RMR_EL3, // 547
634 MISCREG_CONTEXTIDR_EL1, // 548
635 MISCREG_TPIDR_EL1, // 549
636 MISCREG_TPIDR_EL0, // 550
637 MISCREG_TPIDRRO_EL0, // 551
638 MISCREG_TPIDR_EL2, // 552
639 MISCREG_TPIDR_EL3, // 553
640 MISCREG_CNTKCTL_EL1, // 554
641 MISCREG_CNTFRQ_EL0, // 555
642 MISCREG_CNTPCT_EL0, // 556
643 MISCREG_CNTVCT_EL0, // 557
644 MISCREG_CNTP_TVAL_EL0, // 558
645 MISCREG_CNTP_CTL_EL0, // 559
646 MISCREG_CNTP_CVAL_EL0, // 560
647 MISCREG_CNTV_TVAL_EL0, // 561
648 MISCREG_CNTV_CTL_EL0, // 562
649 MISCREG_CNTV_CVAL_EL0, // 563
650 MISCREG_PMEVCNTR0_EL0, // 564
651 MISCREG_PMEVCNTR1_EL0, // 565
652 MISCREG_PMEVCNTR2_EL0, // 566
653 MISCREG_PMEVCNTR3_EL0, // 567
654 MISCREG_PMEVCNTR4_EL0, // 568
655 MISCREG_PMEVCNTR5_EL0, // 569
656 MISCREG_PMEVTYPER0_EL0, // 570
657 MISCREG_PMEVTYPER1_EL0, // 571
658 MISCREG_PMEVTYPER2_EL0, // 572
659 MISCREG_PMEVTYPER3_EL0, // 573
660 MISCREG_PMEVTYPER4_EL0, // 574
661 MISCREG_PMEVTYPER5_EL0, // 575
662 MISCREG_CNTVOFF_EL2, // 576
663 MISCREG_CNTHCTL_EL2, // 577
664 MISCREG_CNTHP_TVAL_EL2, // 578
665 MISCREG_CNTHP_CTL_EL2, // 579
666 MISCREG_CNTHP_CVAL_EL2, // 580
667 MISCREG_CNTPS_TVAL_EL1, // 581
668 MISCREG_CNTPS_CTL_EL1, // 582
669 MISCREG_CNTPS_CVAL_EL1, // 583
670 MISCREG_IL1DATA0_EL1, // 584
671 MISCREG_IL1DATA1_EL1, // 585
672 MISCREG_IL1DATA2_EL1, // 586
673 MISCREG_IL1DATA3_EL1, // 587
674 MISCREG_DL1DATA0_EL1, // 588
675 MISCREG_DL1DATA1_EL1, // 589
676 MISCREG_DL1DATA2_EL1, // 590
677 MISCREG_DL1DATA3_EL1, // 591
678 MISCREG_DL1DATA4_EL1, // 592
679 MISCREG_L2ACTLR_EL1, // 593
680 MISCREG_CPUACTLR_EL1, // 594
681 MISCREG_CPUECTLR_EL1, // 595
682 MISCREG_CPUMERRSR_EL1, // 596
683 MISCREG_L2MERRSR_EL1, // 597
684 MISCREG_CBAR_EL1, // 598
685
686 // Dummy registers
687 MISCREG_NOP, // 599
688 MISCREG_RAZ, // 600
689 MISCREG_CP14_UNIMPL, // 601
690 MISCREG_CP15_UNIMPL, // 602
691 MISCREG_A64_UNIMPL, // 603
692 MISCREG_UNKNOWN, // 604
693
694 NUM_MISCREGS // 605
695 };
696
697 enum MiscRegInfo {
698 MISCREG_IMPLEMENTED,
699 MISCREG_WARN_NOT_FAIL, // If MISCREG_IMPLEMENTED is deasserted, it
700 // tells whether the instruction should raise a
701 // warning or fail
702 MISCREG_MUTEX, // True if the register corresponds to a pair of
703 // mutually exclusive registers
704 MISCREG_BANKED, // True if the register is banked between the two
705 // security states, and this is the parent node of the
706 // two banked registers
707 MISCREG_BANKED_CHILD, // The entry is one of the child registers that
708 // forms a banked set of regs (along with the
709 // other child regs)
710
711 // Access permissions
712 // User mode
713 MISCREG_USR_NS_RD,
714 MISCREG_USR_NS_WR,
715 MISCREG_USR_S_RD,
716 MISCREG_USR_S_WR,
717 // Privileged modes other than hypervisor or monitor
718 MISCREG_PRI_NS_RD,
719 MISCREG_PRI_NS_WR,
720 MISCREG_PRI_S_RD,
721 MISCREG_PRI_S_WR,
722 // Hypervisor mode
723 MISCREG_HYP_RD,
724 MISCREG_HYP_WR,
725 // Monitor mode, SCR.NS == 0
726 MISCREG_MON_NS0_RD,
727 MISCREG_MON_NS0_WR,
728 // Monitor mode, SCR.NS == 1
729 MISCREG_MON_NS1_RD,
730 MISCREG_MON_NS1_WR,
731
732 NUM_MISCREG_INFOS
733 };
734
735 extern std::bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS];
736
737 // Decodes 32-bit CP14 registers accessible through MCR/MRC instructions
738 MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1,
739 unsigned crm, unsigned opc2);
740 MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1,
741 unsigned crn, unsigned crm,
742 unsigned op2);
743 // Whether a particular AArch64 system register is -always- read only.
744 bool aarch64SysRegReadOnly(MiscRegIndex miscReg);
745
746 // Decodes 32-bit CP15 registers accessible through MCR/MRC instructions
747 MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
748 unsigned crm, unsigned opc2);
749
750 // Decodes 64-bit CP15 registers accessible through MCRR/MRRC instructions
751 MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1);
752
753
754 const char * const miscRegName[] = {
755 "cpsr",
756 "spsr",
757 "spsr_fiq",
758 "spsr_irq",
759 "spsr_svc",
760 "spsr_mon",
761 "spsr_abt",
762 "spsr_hyp",
763 "spsr_und",
764 "elr_hyp",
765 "fpsid",
766 "fpscr",
767 "mvfr1",
768 "mvfr0",
769 "fpexc",
770
771 // Helper registers
772 "cpsr_mode",
773 "cpsr_q",
774 "fpscr_exc",
775 "fpscr_qc",
776 "lockaddr",
777 "lockflag",
778 "prrr_mair0",
779 "prrr_mair0_ns",
780 "prrr_mair0_s",
781 "nmrr_mair1",
782 "nmrr_mair1_ns",
783 "nmrr_mair1_s",
784 "pmxevtyper_pmccfiltr",
785 "sctlr_rst",
786 "sev_mailbox",
787
788 // AArch32 CP14 registers
789 "dbgdidr",
790 "dbgdscrint",
791 "dbgdccint",
792 "dbgdtrtxint",
793 "dbgdtrrxint",
794 "dbgwfar",
795 "dbgvcr",
796 "dbgdtrrxext",
797 "dbgdscrext",
798 "dbgdtrtxext",
799 "dbgoseccr",
800 "dbgbvr0",
801 "dbgbvr1",
802 "dbgbvr2",
803 "dbgbvr3",
804 "dbgbvr4",
805 "dbgbvr5",
806 "dbgbcr0",
807 "dbgbcr1",
808 "dbgbcr2",
809 "dbgbcr3",
810 "dbgbcr4",
811 "dbgbcr5",
812 "dbgwvr0",
813 "dbgwvr1",
814 "dbgwvr2",
815 "dbgwvr3",
816 "dbgwcr0",
817 "dbgwcr1",
818 "dbgwcr2",
819 "dbgwcr3",
820 "dbgdrar",
821 "dbgbxvr4",
822 "dbgbxvr5",
823 "dbgoslar",
824 "dbgoslsr",
825 "dbgosdlr",
826 "dbgprcr",
827 "dbgdsar",
828 "dbgclaimset",
829 "dbgclaimclr",
830 "dbgauthstatus",
831 "dbgdevid2",
832 "dbgdevid1",
833 "dbgdevid0",
834 "teecr",
835 "jidr",
836 "teehbr",
837 "joscr",
838 "jmcr",
839
840 // AArch32 CP15 registers
841 "midr",
842 "ctr",
843 "tcmtr",
844 "tlbtr",
845 "mpidr",
846 "revidr",
847 "id_pfr0",
848 "id_pfr1",
849 "id_dfr0",
850 "id_afr0",
851 "id_mmfr0",
852 "id_mmfr1",
853 "id_mmfr2",
854 "id_mmfr3",
855 "id_isar0",
856 "id_isar1",
857 "id_isar2",
858 "id_isar3",
859 "id_isar4",
860 "id_isar5",
861 "ccsidr",
862 "clidr",
863 "aidr",
864 "csselr",
865 "csselr_ns",
866 "csselr_s",
867 "vpidr",
868 "vmpidr",
869 "sctlr",
870 "sctlr_ns",
871 "sctlr_s",
872 "actlr",
873 "actlr_ns",
874 "actlr_s",
875 "cpacr",
876 "scr",
877 "sder",
878 "nsacr",
879 "hsctlr",
880 "hactlr",
881 "hcr",
882 "hdcr",
883 "hcptr",
884 "hstr",
885 "hacr",
886 "ttbr0",
887 "ttbr0_ns",
888 "ttbr0_s",
889 "ttbr1",
890 "ttbr1_ns",
891 "ttbr1_s",
892 "ttbcr",
893 "ttbcr_ns",
894 "ttbcr_s",
895 "htcr",
896 "vtcr",
897 "dacr",
898 "dacr_ns",
899 "dacr_s",
900 "dfsr",
901 "dfsr_ns",
902 "dfsr_s",
903 "ifsr",
904 "ifsr_ns",
905 "ifsr_s",
906 "adfsr",
907 "adfsr_ns",
908 "adfsr_s",
909 "aifsr",
910 "aifsr_ns",
911 "aifsr_s",
912 "hadfsr",
913 "haifsr",
914 "hsr",
915 "dfar",
916 "dfar_ns",
917 "dfar_s",
918 "ifar",
919 "ifar_ns",
920 "ifar_s",
921 "hdfar",
922 "hifar",
923 "hpfar",
924 "icialluis",
925 "bpiallis",
926 "par",
927 "par_ns",
928 "par_s",
929 "iciallu",
930 "icimvau",
931 "cp15isb",
932 "bpiall",
933 "bpimva",
934 "dcimvac",
935 "dcisw",
936 "ats1cpr",
937 "ats1cpw",
938 "ats1cur",
939 "ats1cuw",
940 "ats12nsopr",
941 "ats12nsopw",
942 "ats12nsour",
943 "ats12nsouw",
944 "dccmvac",
945 "dccsw",
946 "cp15dsb",
947 "cp15dmb",
948 "dccmvau",
949 "dccimvac",
950 "dccisw",
951 "ats1hr",
952 "ats1hw",
953 "tlbiallis",
954 "tlbimvais",
955 "tlbiasidis",
956 "tlbimvaais",
957 "tlbimvalis",
958 "tlbimvaalis",
959 "itlbiall",
960 "itlbimva",
961 "itlbiasid",
962 "dtlbiall",
963 "dtlbimva",
964 "dtlbiasid",
965 "tlbiall",
966 "tlbimva",
967 "tlbiasid",
968 "tlbimvaa",
969 "tlbimval",
970 "tlbimvaal",
971 "tlbiipas2is",
972 "tlbiipas2lis",
973 "tlbiallhis",
974 "tlbimvahis",
975 "tlbiallnsnhis",
976 "tlbimvalhis",
977 "tlbiipas2",
978 "tlbiipas2l",
979 "tlbiallh",
980 "tlbimvah",
981 "tlbiallnsnh",
982 "tlbimvalh",
983 "pmcr",
984 "pmcntenset",
985 "pmcntenclr",
986 "pmovsr",
987 "pmswinc",
988 "pmselr",
989 "pmceid0",
990 "pmceid1",
991 "pmccntr",
992 "pmxevtyper",
993 "pmccfiltr",
994 "pmxevcntr",
995 "pmuserenr",
996 "pmintenset",
997 "pmintenclr",
998 "pmovsset",
999 "l2ctlr",
1000 "l2ectlr",
1001 "prrr",
1002 "prrr_ns",
1003 "prrr_s",
1004 "mair0",
1005 "mair0_ns",
1006 "mair0_s",
1007 "nmrr",
1008 "nmrr_ns",
1009 "nmrr_s",
1010 "mair1",
1011 "mair1_ns",
1012 "mair1_s",
1013 "amair0",
1014 "amair0_ns",
1015 "amair0_s",
1016 "amair1",
1017 "amair1_ns",
1018 "amair1_s",
1019 "hmair0",
1020 "hmair1",
1021 "hamair0",
1022 "hamair1",
1023 "vbar",
1024 "vbar_ns",
1025 "vbar_s",
1026 "mvbar",
1027 "rmr",
1028 "isr",
1029 "hvbar",
1030 "fcseidr",
1031 "contextidr",
1032 "contextidr_ns",
1033 "contextidr_s",
1034 "tpidrurw",
1035 "tpidrurw_ns",
1036 "tpidrurw_s",
1037 "tpidruro",
1038 "tpidruro_ns",
1039 "tpidruro_s",
1040 "tpidrprw",
1041 "tpidrprw_ns",
1042 "tpidrprw_s",
1043 "htpidr",
1044 "cntfrq",
1045 "cntkctl",
1046 "cntp_tval",
1047 "cntp_tval_ns",
1048 "cntp_tval_s",
1049 "cntp_ctl",
1050 "cntp_ctl_ns",
1051 "cntp_ctl_s",
1052 "cntv_tval",
1053 "cntv_ctl",
1054 "cnthctl",
1055 "cnthp_tval",
1056 "cnthp_ctl",
1057 "il1data0",
1058 "il1data1",
1059 "il1data2",
1060 "il1data3",
1061 "dl1data0",
1062 "dl1data1",
1063 "dl1data2",
1064 "dl1data3",
1065 "dl1data4",
1066 "ramindex",
1067 "l2actlr",
1068 "cbar",
1069 "httbr",
1070 "vttbr",
1071 "cntpct",
1072 "cntvct",
1073 "cntp_cval",
1074 "cntp_cval_ns",
1075 "cntp_cval_s",
1076 "cntv_cval",
1077 "cntvoff",
1078 "cnthp_cval",
1079 "cpumerrsr",
1080 "l2merrsr",
1081
1082 // AArch64 registers (Op0=2)
1083 "mdccint_el1",
1084 "osdtrrx_el1",
1085 "mdscr_el1",
1086 "osdtrtx_el1",
1087 "oseccr_el1",
1088 "dbgbvr0_el1",
1089 "dbgbvr1_el1",
1090 "dbgbvr2_el1",
1091 "dbgbvr3_el1",
1092 "dbgbvr4_el1",
1093 "dbgbvr5_el1",
1094 "dbgbcr0_el1",
1095 "dbgbcr1_el1",
1096 "dbgbcr2_el1",
1097 "dbgbcr3_el1",
1098 "dbgbcr4_el1",
1099 "dbgbcr5_el1",
1100 "dbgwvr0_el1",
1101 "dbgwvr1_el1",
1102 "dbgwvr2_el1",
1103 "dbgwvr3_el1",
1104 "dbgwcr0_el1",
1105 "dbgwcr1_el1",
1106 "dbgwcr2_el1",
1107 "dbgwcr3_el1",
1108 "mdccsr_el0",
1109 "mddtr_el0",
1110 "mddtrtx_el0",
1111 "mddtrrx_el0",
1112 "dbgvcr32_el2",
1113 "mdrar_el1",
1114 "oslar_el1",
1115 "oslsr_el1",
1116 "osdlr_el1",
1117 "dbgprcr_el1",
1118 "dbgclaimset_el1",
1119 "dbgclaimclr_el1",
1120 "dbgauthstatus_el1",
1121 "teecr32_el1",
1122 "teehbr32_el1",
1123
1124 // AArch64 registers (Op0=1,3)
1125 "midr_el1",
1126 "mpidr_el1",
1127 "revidr_el1",
1128 "id_pfr0_el1",
1129 "id_pfr1_el1",
1130 "id_dfr0_el1",
1131 "id_afr0_el1",
1132 "id_mmfr0_el1",
1133 "id_mmfr1_el1",
1134 "id_mmfr2_el1",
1135 "id_mmfr3_el1",
1136 "id_isar0_el1",
1137 "id_isar1_el1",
1138 "id_isar2_el1",
1139 "id_isar3_el1",
1140 "id_isar4_el1",
1141 "id_isar5_el1",
1142 "mvfr0_el1",
1143 "mvfr1_el1",
1144 "mvfr2_el1",
1145 "id_aa64pfr0_el1",
1146 "id_aa64pfr1_el1",
1147 "id_aa64dfr0_el1",
1148 "id_aa64dfr1_el1",
1149 "id_aa64afr0_el1",
1150 "id_aa64afr1_el1",
1151 "id_aa64isar0_el1",
1152 "id_aa64isar1_el1",
1153 "id_aa64mmfr0_el1",
1154 "id_aa64mmfr1_el1",
1155 "ccsidr_el1",
1156 "clidr_el1",
1157 "aidr_el1",
1158 "csselr_el1",
1159 "ctr_el0",
1160 "dczid_el0",
1161 "vpidr_el2",
1162 "vmpidr_el2",
1163 "sctlr_el1",
1164 "actlr_el1",
1165 "cpacr_el1",
1166 "sctlr_el2",
1167 "actlr_el2",
1168 "hcr_el2",
1169 "mdcr_el2",
1170 "cptr_el2",
1171 "hstr_el2",
1172 "hacr_el2",
1173 "sctlr_el3",
1174 "actlr_el3",
1175 "scr_el3",
1176 "sder32_el3",
1177 "cptr_el3",
1178 "mdcr_el3",
1179 "ttbr0_el1",
1180 "ttbr1_el1",
1181 "tcr_el1",
1182 "ttbr0_el2",
1183 "tcr_el2",
1184 "vttbr_el2",
1185 "vtcr_el2",
1186 "ttbr0_el3",
1187 "tcr_el3",
1188 "dacr32_el2",
1189 "spsr_el1",
1190 "elr_el1",
1191 "sp_el0",
1192 "spsel",
1193 "currentel",
1194 "nzcv",
1195 "daif",
1196 "fpcr",
1197 "fpsr",
1198 "dspsr_el0",
1199 "dlr_el0",
1200 "spsr_el2",
1201 "elr_el2",
1202 "sp_el1",
1203 "spsr_irq_aa64",
1204 "spsr_abt_aa64",
1205 "spsr_und_aa64",
1206 "spsr_fiq_aa64",
1207 "spsr_el3",
1208 "elr_el3",
1209 "sp_el2",
1210 "afsr0_el1",
1211 "afsr1_el1",
1212 "esr_el1",
1213 "ifsr32_el2",
1214 "afsr0_el2",
1215 "afsr1_el2",
1216 "esr_el2",
1217 "fpexc32_el2",
1218 "afsr0_el3",
1219 "afsr1_el3",
1220 "esr_el3",
1221 "far_el1",
1222 "far_el2",
1223 "hpfar_el2",
1224 "far_el3",
1225 "ic_ialluis",
1226 "par_el1",
1227 "ic_iallu",
1228 "dc_ivac_xt",
1229 "dc_isw_xt",
1230 "at_s1e1r_xt",
1231 "at_s1e1w_xt",
1232 "at_s1e0r_xt",
1233 "at_s1e0w_xt",
1234 "dc_csw_xt",
1235 "dc_cisw_xt",
1236 "dc_zva_xt",
1237 "ic_ivau_xt",
1238 "dc_cvac_xt",
1239 "dc_cvau_xt",
1240 "dc_civac_xt",
1241 "at_s1e2r_xt",
1242 "at_s1e2w_xt",
1243 "at_s12e1r_xt",
1244 "at_s12e1w_xt",
1245 "at_s12e0r_xt",
1246 "at_s12e0w_xt",
1247 "at_s1e3r_xt",
1248 "at_s1e3w_xt",
1249 "tlbi_vmalle1is",
1250 "tlbi_vae1is_xt",
1251 "tlbi_aside1is_xt",
1252 "tlbi_vaae1is_xt",
1253 "tlbi_vale1is_xt",
1254 "tlbi_vaale1is_xt",
1255 "tlbi_vmalle1",
1256 "tlbi_vae1_xt",
1257 "tlbi_aside1_xt",
1258 "tlbi_vaae1_xt",
1259 "tlbi_vale1_xt",
1260 "tlbi_vaale1_xt",
1261 "tlbi_ipas2e1is_xt",
1262 "tlbi_ipas2le1is_xt",
1263 "tlbi_alle2is",
1264 "tlbi_vae2is_xt",
1265 "tlbi_alle1is",
1266 "tlbi_vale2is_xt",
1267 "tlbi_vmalls12e1is",
1268 "tlbi_ipas2e1_xt",
1269 "tlbi_ipas2le1_xt",
1270 "tlbi_alle2",
1271 "tlbi_vae2_xt",
1272 "tlbi_alle1",
1273 "tlbi_vale2_xt",
1274 "tlbi_vmalls12e1",
1275 "tlbi_alle3is",
1276 "tlbi_vae3is_xt",
1277 "tlbi_vale3is_xt",
1278 "tlbi_alle3",
1279 "tlbi_vae3_xt",
1280 "tlbi_vale3_xt",
1281 "pmintenset_el1",
1282 "pmintenclr_el1",
1283 "pmcr_el0",
1284 "pmcntenset_el0",
1285 "pmcntenclr_el0",
1286 "pmovsclr_el0",
1287 "pmswinc_el0",
1288 "pmselr_el0",
1289 "pmceid0_el0",
1290 "pmceid1_el0",
1291 "pmccntr_el0",
1292 "pmxevtyper_el0",
1293 "pmccfiltr_el0",
1294 "pmxevcntr_el0",
1295 "pmuserenr_el0",
1296 "pmovsset_el0",
1297 "mair_el1",
1298 "amair_el1",
1299 "mair_el2",
1300 "amair_el2",
1301 "mair_el3",
1302 "amair_el3",
1303 "l2ctlr_el1",
1304 "l2ectlr_el1",
1305 "vbar_el1",
1306 "rvbar_el1",
1307 "isr_el1",
1308 "vbar_el2",
1309 "rvbar_el2",
1310 "vbar_el3",
1311 "rvbar_el3",
1312 "rmr_el3",
1313 "contextidr_el1",
1314 "tpidr_el1",
1315 "tpidr_el0",
1316 "tpidrro_el0",
1317 "tpidr_el2",
1318 "tpidr_el3",
1319 "cntkctl_el1",
1320 "cntfrq_el0",
1321 "cntpct_el0",
1322 "cntvct_el0",
1323 "cntp_tval_el0",
1324 "cntp_ctl_el0",
1325 "cntp_cval_el0",
1326 "cntv_tval_el0",
1327 "cntv_ctl_el0",
1328 "cntv_cval_el0",
1329 "pmevcntr0_el0",
1330 "pmevcntr1_el0",
1331 "pmevcntr2_el0",
1332 "pmevcntr3_el0",
1333 "pmevcntr4_el0",
1334 "pmevcntr5_el0",
1335 "pmevtyper0_el0",
1336 "pmevtyper1_el0",
1337 "pmevtyper2_el0",
1338 "pmevtyper3_el0",
1339 "pmevtyper4_el0",
1340 "pmevtyper5_el0",
1341 "cntvoff_el2",
1342 "cnthctl_el2",
1343 "cnthp_tval_el2",
1344 "cnthp_ctl_el2",
1345 "cnthp_cval_el2",
1346 "cntps_tval_el1",
1347 "cntps_ctl_el1",
1348 "cntps_cval_el1",
1349 "il1data0_el1",
1350 "il1data1_el1",
1351 "il1data2_el1",
1352 "il1data3_el1",
1353 "dl1data0_el1",
1354 "dl1data1_el1",
1355 "dl1data2_el1",
1356 "dl1data3_el1",
1357 "dl1data4_el1",
1358 "l2actlr_el1",
1359 "cpuactlr_el1",
1360 "cpuectlr_el1",
1361 "cpumerrsr_el1",
1362 "l2merrsr_el1",
1363 "cbar_el1",
1364
1365 // Dummy registers
1366 "nop",
1367 "raz",
1368 "cp14_unimpl",
1369 "cp15_unimpl",
1370 "a64_unimpl",
1371 "unknown"
1372 };
1373
1374 static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
1375 "The miscRegName array and NUM_MISCREGS are inconsistent.");
1376
1377 BitUnion32(CPSR)
1378 Bitfield<31, 30> nz;
1379 Bitfield<29> c;
1380 Bitfield<28> v;
1381 Bitfield<27> q;
1382 Bitfield<26, 25> it1;
1383 Bitfield<24> j;
1384 Bitfield<23, 22> res0_23_22;
1385 Bitfield<21> ss; // AArch64
1386 Bitfield<20> il; // AArch64
1387 Bitfield<19, 16> ge;
1388 Bitfield<15, 10> it2;
1389 Bitfield<9> d; // AArch64
1390 Bitfield<9> e;
1391 Bitfield<8> a;
1392 Bitfield<7> i;
1393 Bitfield<6> f;
1394 Bitfield<9, 6> daif; // AArch64
1395 Bitfield<5> t;
1396 Bitfield<4> width; // AArch64
1397 Bitfield<3, 2> el; // AArch64
1398 Bitfield<4, 0> mode;
1399 Bitfield<0> sp; // AArch64
1400 EndBitUnion(CPSR)
1401
1402 // This mask selects bits of the CPSR that actually go in the CondCodes
1403 // integer register to allow renaming.
1404 static const uint32_t CondCodesMask = 0xF00F0000;
1405 static const uint32_t CpsrMaskQ = 0x08000000;
1406
1407 BitUnion32(HDCR)
1408 Bitfield<11> tdra;
1409 Bitfield<10> tdosa;
1410 Bitfield<9> tda;
1411 Bitfield<8> tde;
1412 Bitfield<7> hpme;
1413 Bitfield<6> tpm;
1414 Bitfield<5> tpmcr;
1415 Bitfield<4, 0> hpmn;
1416 EndBitUnion(HDCR)
1417
1418 BitUnion32(HCPTR)
1419 Bitfield<31> tcpac;
1420 Bitfield<20> tta;
1421 Bitfield<15> tase;
1422 Bitfield<13> tcp13;
1423 Bitfield<12> tcp12;
1424 Bitfield<11> tcp11;
1425 Bitfield<10> tcp10;
1426 Bitfield<10> tfp; // AArch64
1427 Bitfield<9> tcp9;
1428 Bitfield<8> tcp8;
1429 Bitfield<7> tcp7;
1430 Bitfield<6> tcp6;
1431 Bitfield<5> tcp5;
1432 Bitfield<4> tcp4;
1433 Bitfield<3> tcp3;
1434 Bitfield<2> tcp2;
1435 Bitfield<1> tcp1;
1436 Bitfield<0> tcp0;
1437 EndBitUnion(HCPTR)
1438
1439 BitUnion32(HSTR)
1440 Bitfield<17> tjdbx;
1441 Bitfield<16> ttee;
1442 Bitfield<15> t15;
1443 Bitfield<13> t13;
1444 Bitfield<12> t12;
1445 Bitfield<11> t11;
1446 Bitfield<10> t10;
1447 Bitfield<9> t9;
1448 Bitfield<8> t8;
1449 Bitfield<7> t7;
1450 Bitfield<6> t6;
1451 Bitfield<5> t5;
1452 Bitfield<4> t4;
1453 Bitfield<3> t3;
1454 Bitfield<2> t2;
1455 Bitfield<1> t1;
1456 Bitfield<0> t0;
1457 EndBitUnion(HSTR)
1458
1459 BitUnion64(HCR)
1460 Bitfield<33> id; // AArch64
1461 Bitfield<32> cd; // AArch64
1462 Bitfield<31> rw; // AArch64
1463 Bitfield<30> trvm; // AArch64
1464 Bitfield<29> hcd; // AArch64
1465 Bitfield<28> tdz; // AArch64
1466
1467 Bitfield<27> tge;
1468 Bitfield<26> tvm;
1469 Bitfield<25> ttlb;
1470 Bitfield<24> tpu;
1471 Bitfield<23> tpc;
1472 Bitfield<22> tsw;
1473 Bitfield<21> tac;
1474 Bitfield<21> tacr; // AArch64
1475 Bitfield<20> tidcp;
1476 Bitfield<19> tsc;
1477 Bitfield<18> tid3;
1478 Bitfield<17> tid2;
1479 Bitfield<16> tid1;
1480 Bitfield<15> tid0;
1481 Bitfield<14> twe;
1482 Bitfield<13> twi;
1483 Bitfield<12> dc;
1484 Bitfield<11, 10> bsu;
1485 Bitfield<9> fb;
1486 Bitfield<8> va;
1487 Bitfield<8> vse; // AArch64
1488 Bitfield<7> vi;
1489 Bitfield<6> vf;
1490 Bitfield<5> amo;
1491 Bitfield<4> imo;
1492 Bitfield<3> fmo;
1493 Bitfield<2> ptw;
1494 Bitfield<1> swio;
1495 Bitfield<0> vm;
1496 EndBitUnion(HCR)
1497
1498 BitUnion32(NSACR)
1499 Bitfield<20> nstrcdis;
1500 Bitfield<19> rfr;
1501 Bitfield<15> nsasedis;
1502 Bitfield<14> nsd32dis;
1503 Bitfield<13> cp13;
1504 Bitfield<12> cp12;
1505 Bitfield<11> cp11;
1506 Bitfield<10> cp10;
1507 Bitfield<9> cp9;
1508 Bitfield<8> cp8;
1509 Bitfield<7> cp7;
1510 Bitfield<6> cp6;
1511 Bitfield<5> cp5;
1512 Bitfield<4> cp4;
1513 Bitfield<3> cp3;
1514 Bitfield<2> cp2;
1515 Bitfield<1> cp1;
1516 Bitfield<0> cp0;
1517 EndBitUnion(NSACR)
1518
1519 BitUnion32(SCR)
1520 Bitfield<13> twe;
1521 Bitfield<12> twi;
1522 Bitfield<11> st; // AArch64
1523 Bitfield<10> rw; // AArch64
1524 Bitfield<9> sif;
1525 Bitfield<8> hce;
1526 Bitfield<7> scd;
1527 Bitfield<7> smd; // AArch64
1528 Bitfield<6> nEt;
1529 Bitfield<5> aw;
1530 Bitfield<4> fw;
1531 Bitfield<3> ea;
1532 Bitfield<2> fiq;
1533 Bitfield<1> irq;
1534 Bitfield<0> ns;
1535 EndBitUnion(SCR)
1536
1537 BitUnion32(SCTLR)
1538 Bitfield<30> te; // Thumb Exception Enable (AArch32 only)
1539 Bitfield<29> afe; // Access flag enable (AArch32 only)
1540 Bitfield<28> tre; // TEX remap enable (AArch32 only)
1541 Bitfield<27> nmfi; // Non-maskable FIQ support (ARMv7 only)
1542 Bitfield<26> uci; // Enable EL0 access to DC CVAU, DC CIVAC,
1543 // DC CVAC and IC IVAU instructions
1544 // (AArch64 SCTLR_EL1 only)
1545 Bitfield<25> ee; // Exception Endianness
1546 Bitfield<24> ve; // Interrupt Vectors Enable (ARMv7 only)
1547 Bitfield<24> e0e; // Endianness of explicit data accesses at EL0
1548 // (AArch64 SCTLR_EL1 only)
1549 Bitfield<23> xp; // Extended page table enable (dropped in ARMv7)
1550 Bitfield<22> u; // Alignment (dropped in ARMv7)
1551 Bitfield<21> fi; // Fast interrupts configuration enable
1552 // (ARMv7 only)
1553 Bitfield<20> uwxn; // Unprivileged write permission implies EL1 XN
1554 // (AArch32 only)
1555 Bitfield<19> dz; // Divide by Zero fault enable
1556 // (dropped in ARMv7)
1557 Bitfield<19> wxn; // Write permission implies XN
1558 Bitfield<18> ntwe; // Not trap WFE
1559 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1560 Bitfield<18> rao2; // Read as one
1561 Bitfield<16> ntwi; // Not trap WFI
1562 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1563 Bitfield<16> rao3; // Read as one
1564 Bitfield<15> uct; // Enable EL0 access to CTR_EL0
1565 // (AArch64 SCTLR_EL1 only)
1566 Bitfield<14> rr; // Round Robin select (ARMv7 only)
1567 Bitfield<14> dze; // Enable EL0 access to DC ZVA
1568 // (AArch64 SCTLR_EL1 only)
1569 Bitfield<13> v; // Vectors bit (AArch32 only)
1570 Bitfield<12> i; // Instruction cache enable
1571 Bitfield<11> z; // Branch prediction enable (ARMv7 only)
1572 Bitfield<10> sw; // SWP/SWPB enable (ARMv7 only)
1573 Bitfield<9, 8> rs; // Deprecated protection bits (dropped in ARMv7)
1574 Bitfield<9> uma; // User mask access (AArch64 SCTLR_EL1 only)
1575 Bitfield<8> sed; // SETEND disable
1576 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1577 Bitfield<7> b; // Endianness support (dropped in ARMv7)
1578 Bitfield<7> itd; // IT disable
1579 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1580 Bitfield<6, 3> rao4; // Read as one
1581 Bitfield<6> thee; // ThumbEE enable
1582 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1583 Bitfield<5> cp15ben; // CP15 barrier enable
1584 // (AArch32 and AArch64 SCTLR_EL1 only)
1585 Bitfield<4> sa0; // Stack Alignment Check Enable for EL0
1586 // (AArch64 SCTLR_EL1 only)
1587 Bitfield<3> sa; // Stack Alignment Check Enable (AArch64 only)
1588 Bitfield<2> c; // Cache enable
1589 Bitfield<1> a; // Alignment check enable
1590 Bitfield<0> m; // MMU enable
1591 EndBitUnion(SCTLR)
1592
1593 BitUnion32(CPACR)
1594 Bitfield<1, 0> cp0;
1595 Bitfield<3, 2> cp1;
1596 Bitfield<5, 4> cp2;
1597 Bitfield<7, 6> cp3;
1598 Bitfield<9, 8> cp4;
1599 Bitfield<11, 10> cp5;
1600 Bitfield<13, 12> cp6;
1601 Bitfield<15, 14> cp7;
1602 Bitfield<17, 16> cp8;
1603 Bitfield<19, 18> cp9;
1604 Bitfield<21, 20> cp10;
1605 Bitfield<21, 20> fpen; // AArch64
1606 Bitfield<23, 22> cp11;
1607 Bitfield<25, 24> cp12;
1608 Bitfield<27, 26> cp13;
1609 Bitfield<29, 28> rsvd;
1610 Bitfield<28> tta; // AArch64
1611 Bitfield<30> d32dis;
1612 Bitfield<31> asedis;
1613 EndBitUnion(CPACR)
1614
1615 BitUnion32(FSR)
1616 Bitfield<3, 0> fsLow;
1617 Bitfield<5, 0> status; // LPAE
1618 Bitfield<7, 4> domain;
1619 Bitfield<9> lpae;
1620 Bitfield<10> fsHigh;
1621 Bitfield<11> wnr;
1622 Bitfield<12> ext;
1623 Bitfield<13> cm; // LPAE
1624 EndBitUnion(FSR)
1625
1626 BitUnion32(FPSCR)
1627 Bitfield<0> ioc;
1628 Bitfield<1> dzc;
1629 Bitfield<2> ofc;
1630 Bitfield<3> ufc;
1631 Bitfield<4> ixc;
1632 Bitfield<7> idc;
1633 Bitfield<8> ioe;
1634 Bitfield<9> dze;
1635 Bitfield<10> ofe;
1636 Bitfield<11> ufe;
1637 Bitfield<12> ixe;
1638 Bitfield<15> ide;
1639 Bitfield<18, 16> len;
1640 Bitfield<21, 20> stride;
1641 Bitfield<23, 22> rMode;
1642 Bitfield<24> fz;
1643 Bitfield<25> dn;
1644 Bitfield<26> ahp;
1645 Bitfield<27> qc;
1646 Bitfield<28> v;
1647 Bitfield<29> c;
1648 Bitfield<30> z;
1649 Bitfield<31> n;
1650 EndBitUnion(FPSCR)
1651
1652 // This mask selects bits of the FPSCR that actually go in the FpCondCodes
1653 // integer register to allow renaming.
1654 static const uint32_t FpCondCodesMask = 0xF0000000;
1655 // This mask selects the cumulative FP exception flags of the FPSCR.
1656 static const uint32_t FpscrExcMask = 0x0000009F;
1657 // This mask selects the cumulative saturation flag of the FPSCR.
1658 static const uint32_t FpscrQcMask = 0x08000000;
1659
1660 BitUnion32(FPEXC)
1661 Bitfield<31> ex;
1662 Bitfield<30> en;
1663 Bitfield<29, 0> subArchDefined;
1664 EndBitUnion(FPEXC)
1665
1666 BitUnion32(MVFR0)
1667 Bitfield<3, 0> advSimdRegisters;
1668 Bitfield<7, 4> singlePrecision;
1669 Bitfield<11, 8> doublePrecision;
1670 Bitfield<15, 12> vfpExceptionTrapping;
1671 Bitfield<19, 16> divide;
1672 Bitfield<23, 20> squareRoot;
1673 Bitfield<27, 24> shortVectors;
1674 Bitfield<31, 28> roundingModes;
1675 EndBitUnion(MVFR0)
1676
1677 BitUnion32(MVFR1)
1678 Bitfield<3, 0> flushToZero;
1679 Bitfield<7, 4> defaultNaN;
1680 Bitfield<11, 8> advSimdLoadStore;
1681 Bitfield<15, 12> advSimdInteger;
1682 Bitfield<19, 16> advSimdSinglePrecision;
1683 Bitfield<23, 20> advSimdHalfPrecision;
1684 Bitfield<27, 24> vfpHalfPrecision;
1685 Bitfield<31, 28> raz;
1686 EndBitUnion(MVFR1)
1687
1688 BitUnion64(TTBCR)
1689 // Short-descriptor translation table format
1690 Bitfield<2, 0> n;
1691 Bitfield<4> pd0;
1692 Bitfield<5> pd1;
1693 // Long-descriptor translation table format
1694 Bitfield<5, 0> t0sz;
1695 Bitfield<7> epd0;
1696 Bitfield<9, 8> irgn0;
1697 Bitfield<11, 10> orgn0;
1698 Bitfield<13, 12> sh0;
1699 Bitfield<14> tg0;
1700 Bitfield<21, 16> t1sz;
1701 Bitfield<22> a1;
1702 Bitfield<23> epd1;
1703 Bitfield<25, 24> irgn1;
1704 Bitfield<27, 26> orgn1;
1705 Bitfield<29, 28> sh1;
1706 Bitfield<30> tg1;
1707 Bitfield<34, 32> ips;
1708 Bitfield<36> as;
1709 Bitfield<37> tbi0;
1710 Bitfield<38> tbi1;
1711 // Common
1712 Bitfield<31> eae;
1713 // TCR_EL2/3 (AArch64)
1714 Bitfield<18, 16> ps;
1715 Bitfield<20> tbi;
1716 EndBitUnion(TTBCR)
1717
1718 // Fields of TCR_EL{1,2,3} (mostly overlapping)
1719 // TCR_EL1 is natively 64 bits, the others are 32 bits
1720 BitUnion64(TCR)
1721 Bitfield<5, 0> t0sz;
1722 Bitfield<7> epd0; // EL1
1723 Bitfield<9, 8> irgn0;
1724 Bitfield<11, 10> orgn0;
1725 Bitfield<13, 12> sh0;
1726 Bitfield<15, 14> tg0;
1727 Bitfield<18, 16> ps;
1728 Bitfield<20> tbi; // EL2/EL3
1729 Bitfield<21, 16> t1sz; // EL1
1730 Bitfield<22> a1; // EL1
1731 Bitfield<23> epd1; // EL1
1732 Bitfield<25, 24> irgn1; // EL1
1733 Bitfield<27, 26> orgn1; // EL1
1734 Bitfield<29, 28> sh1; // EL1
1735 Bitfield<31, 30> tg1; // EL1
1736 Bitfield<34, 32> ips; // EL1
1737 Bitfield<36> as; // EL1
1738 Bitfield<37> tbi0; // EL1
1739 Bitfield<38> tbi1; // EL1
1740 EndBitUnion(TCR)
1741
1742 BitUnion32(HTCR)
1743 Bitfield<2, 0> t0sz;
1744 Bitfield<9, 8> irgn0;
1745 Bitfield<11, 10> orgn0;
1746 Bitfield<13, 12> sh0;
1747 EndBitUnion(HTCR)
1748
1749 BitUnion32(VTCR_t)
1750 Bitfield<3, 0> t0sz;
1751 Bitfield<4> s;
1752 Bitfield<7, 6> sl0;
1753 Bitfield<9, 8> irgn0;
1754 Bitfield<11, 10> orgn0;
1755 Bitfield<13, 12> sh0;
1756 EndBitUnion(VTCR_t)
1757
1758 BitUnion32(PRRR)
1759 Bitfield<1,0> tr0;
1760 Bitfield<3,2> tr1;
1761 Bitfield<5,4> tr2;
1762 Bitfield<7,6> tr3;
1763 Bitfield<9,8> tr4;
1764 Bitfield<11,10> tr5;
1765 Bitfield<13,12> tr6;
1766 Bitfield<15,14> tr7;
1767 Bitfield<16> ds0;
1768 Bitfield<17> ds1;
1769 Bitfield<18> ns0;
1770 Bitfield<19> ns1;
1771 Bitfield<24> nos0;
1772 Bitfield<25> nos1;
1773 Bitfield<26> nos2;
1774 Bitfield<27> nos3;
1775 Bitfield<28> nos4;
1776 Bitfield<29> nos5;
1777 Bitfield<30> nos6;
1778 Bitfield<31> nos7;
1779 EndBitUnion(PRRR)
1780
1781 BitUnion32(NMRR)
1782 Bitfield<1,0> ir0;
1783 Bitfield<3,2> ir1;
1784 Bitfield<5,4> ir2;
1785 Bitfield<7,6> ir3;
1786 Bitfield<9,8> ir4;
1787 Bitfield<11,10> ir5;
1788 Bitfield<13,12> ir6;
1789 Bitfield<15,14> ir7;
1790 Bitfield<17,16> or0;
1791 Bitfield<19,18> or1;
1792 Bitfield<21,20> or2;
1793 Bitfield<23,22> or3;
1794 Bitfield<25,24> or4;
1795 Bitfield<27,26> or5;
1796 Bitfield<29,28> or6;
1797 Bitfield<31,30> or7;
1798 EndBitUnion(NMRR)
1799
1800 BitUnion32(CONTEXTIDR)
1801 Bitfield<7,0> asid;
1802 Bitfield<31,8> procid;
1803 EndBitUnion(CONTEXTIDR)
1804
1805 BitUnion32(L2CTLR)
1806 Bitfield<2,0> sataRAMLatency;
1807 Bitfield<4,3> reserved_4_3;
1808 Bitfield<5> dataRAMSetup;
1809 Bitfield<8,6> tagRAMLatency;
1810 Bitfield<9> tagRAMSetup;
1811 Bitfield<11,10> dataRAMSlice;
1812 Bitfield<12> tagRAMSlice;
1813 Bitfield<20,13> reserved_20_13;
1814 Bitfield<21> eccandParityEnable;
1815 Bitfield<22> reserved_22;
1816 Bitfield<23> interptCtrlPresent;
1817 Bitfield<25,24> numCPUs;
1818 Bitfield<30,26> reserved_30_26;
1819 Bitfield<31> l2rstDISABLE_monitor;
1820 EndBitUnion(L2CTLR)
1821
1822 BitUnion32(CTR)
1823 Bitfield<3,0> iCacheLineSize;
1824 Bitfield<13,4> raz_13_4;
1825 Bitfield<15,14> l1IndexPolicy;
1826 Bitfield<19,16> dCacheLineSize;
1827 Bitfield<23,20> erg;
1828 Bitfield<27,24> cwg;
1829 Bitfield<28> raz_28;
1830 Bitfield<31,29> format;
1831 EndBitUnion(CTR)
1832
1833 BitUnion32(PMSELR)
1834 Bitfield<4, 0> sel;
1835 EndBitUnion(PMSELR)
1836
1837 BitUnion64(PAR)
1838 // 64-bit format
1839 Bitfield<63, 56> attr;
1840 Bitfield<39, 12> pa;
1841 Bitfield<11> lpae;
1842 Bitfield<9> ns;
1843 Bitfield<8, 7> sh;
1844 Bitfield<0> f;
1845 EndBitUnion(PAR)
1846
1847 BitUnion32(ESR)
1848 Bitfield<31, 26> ec;
1849 Bitfield<25> il;
1850 Bitfield<15, 0> imm16;
1851 EndBitUnion(ESR)
1852
1853 BitUnion32(CPTR)
1854 Bitfield<31> tcpac;
1855 Bitfield<20> tta;
1856 Bitfield<13, 12> res1_13_12_el2;
1857 Bitfield<10> tfp;
1858 Bitfield<9, 0> res1_9_0_el2;
1859 EndBitUnion(CPTR)
1860
1861
1862 // Checks read access permissions to coproc. registers
1863 bool canReadCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1864 ThreadContext *tc);
1865
1866 // Checks write access permissions to coproc. registers
1867 bool canWriteCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1868 ThreadContext *tc);
1869
1870 // Checks read access permissions to AArch64 system registers
1871 bool canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1872 ThreadContext *tc);
1873
1874 // Checks write access permissions to AArch64 system registers
1875 bool canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1876 ThreadContext *tc);
1877
1878 // Uses just the scr.ns bit to pre flatten the misc regs. This is useful
1879 // for MCR/MRC instructions
1880 int
1881 flattenMiscRegNsBanked(int reg, ThreadContext *tc);
1882
1883 // Flattens a misc reg index using the specified security state. This is
1884 // used for opperations (eg address translations) where the security
1885 // state of the register access may differ from the current state of the
1886 // processor
1887 int
1888 flattenMiscRegNsBanked(int reg, ThreadContext *tc, bool ns);
1889
1890 // Takes a misc reg index and returns the root reg if its one of a set of
1891 // banked registers
1892 void
1893 preUnflattenMiscReg();
1894
1895 int
1896 unflattenMiscReg(int reg);
1897
1898}
1899
1900#endif // __ARCH_ARM_MISCREGS_HH__
56 enum MiscRegIndex {
57 MISCREG_CPSR = 0, // 0
58 MISCREG_SPSR, // 1
59 MISCREG_SPSR_FIQ, // 2
60 MISCREG_SPSR_IRQ, // 3
61 MISCREG_SPSR_SVC, // 4
62 MISCREG_SPSR_MON, // 5
63 MISCREG_SPSR_ABT, // 6
64 MISCREG_SPSR_HYP, // 7
65 MISCREG_SPSR_UND, // 8
66 MISCREG_ELR_HYP, // 9
67 MISCREG_FPSID, // 10
68 MISCREG_FPSCR, // 11
69 MISCREG_MVFR1, // 12
70 MISCREG_MVFR0, // 13
71 MISCREG_FPEXC, // 14
72
73 // Helper registers
74 MISCREG_CPSR_MODE, // 15
75 MISCREG_CPSR_Q, // 16
76 MISCREG_FPSCR_EXC, // 17
77 MISCREG_FPSCR_QC, // 18
78 MISCREG_LOCKADDR, // 19
79 MISCREG_LOCKFLAG, // 20
80 MISCREG_PRRR_MAIR0, // 21
81 MISCREG_PRRR_MAIR0_NS, // 22
82 MISCREG_PRRR_MAIR0_S, // 23
83 MISCREG_NMRR_MAIR1, // 24
84 MISCREG_NMRR_MAIR1_NS, // 25
85 MISCREG_NMRR_MAIR1_S, // 26
86 MISCREG_PMXEVTYPER_PMCCFILTR, // 27
87 MISCREG_SCTLR_RST, // 28
88 MISCREG_SEV_MAILBOX, // 29
89
90 // AArch32 CP14 registers (debug/trace/ThumbEE/Jazelle control)
91 MISCREG_DBGDIDR, // 30
92 MISCREG_DBGDSCRint, // 31
93 MISCREG_DBGDCCINT, // 32
94 MISCREG_DBGDTRTXint, // 33
95 MISCREG_DBGDTRRXint, // 34
96 MISCREG_DBGWFAR, // 35
97 MISCREG_DBGVCR, // 36
98 MISCREG_DBGDTRRXext, // 37
99 MISCREG_DBGDSCRext, // 38
100 MISCREG_DBGDTRTXext, // 39
101 MISCREG_DBGOSECCR, // 40
102 MISCREG_DBGBVR0, // 41
103 MISCREG_DBGBVR1, // 42
104 MISCREG_DBGBVR2, // 43
105 MISCREG_DBGBVR3, // 44
106 MISCREG_DBGBVR4, // 45
107 MISCREG_DBGBVR5, // 46
108 MISCREG_DBGBCR0, // 47
109 MISCREG_DBGBCR1, // 48
110 MISCREG_DBGBCR2, // 49
111 MISCREG_DBGBCR3, // 50
112 MISCREG_DBGBCR4, // 51
113 MISCREG_DBGBCR5, // 52
114 MISCREG_DBGWVR0, // 53
115 MISCREG_DBGWVR1, // 54
116 MISCREG_DBGWVR2, // 55
117 MISCREG_DBGWVR3, // 56
118 MISCREG_DBGWCR0, // 57
119 MISCREG_DBGWCR1, // 58
120 MISCREG_DBGWCR2, // 59
121 MISCREG_DBGWCR3, // 60
122 MISCREG_DBGDRAR, // 61
123 MISCREG_DBGBXVR4, // 62
124 MISCREG_DBGBXVR5, // 63
125 MISCREG_DBGOSLAR, // 64
126 MISCREG_DBGOSLSR, // 65
127 MISCREG_DBGOSDLR, // 66
128 MISCREG_DBGPRCR, // 67
129 MISCREG_DBGDSAR, // 68
130 MISCREG_DBGCLAIMSET, // 69
131 MISCREG_DBGCLAIMCLR, // 70
132 MISCREG_DBGAUTHSTATUS, // 71
133 MISCREG_DBGDEVID2, // 72
134 MISCREG_DBGDEVID1, // 73
135 MISCREG_DBGDEVID0, // 74
136 MISCREG_TEECR, // 75
137 MISCREG_JIDR, // 76
138 MISCREG_TEEHBR, // 77
139 MISCREG_JOSCR, // 78
140 MISCREG_JMCR, // 79
141
142 // AArch32 CP15 registers (system control)
143 MISCREG_MIDR, // 80
144 MISCREG_CTR, // 81
145 MISCREG_TCMTR, // 82
146 MISCREG_TLBTR, // 83
147 MISCREG_MPIDR, // 84
148 MISCREG_REVIDR, // 85
149 MISCREG_ID_PFR0, // 86
150 MISCREG_ID_PFR1, // 87
151 MISCREG_ID_DFR0, // 88
152 MISCREG_ID_AFR0, // 89
153 MISCREG_ID_MMFR0, // 90
154 MISCREG_ID_MMFR1, // 91
155 MISCREG_ID_MMFR2, // 92
156 MISCREG_ID_MMFR3, // 93
157 MISCREG_ID_ISAR0, // 94
158 MISCREG_ID_ISAR1, // 95
159 MISCREG_ID_ISAR2, // 96
160 MISCREG_ID_ISAR3, // 97
161 MISCREG_ID_ISAR4, // 98
162 MISCREG_ID_ISAR5, // 99
163 MISCREG_CCSIDR, // 100
164 MISCREG_CLIDR, // 101
165 MISCREG_AIDR, // 102
166 MISCREG_CSSELR, // 103
167 MISCREG_CSSELR_NS, // 104
168 MISCREG_CSSELR_S, // 105
169 MISCREG_VPIDR, // 106
170 MISCREG_VMPIDR, // 107
171 MISCREG_SCTLR, // 108
172 MISCREG_SCTLR_NS, // 109
173 MISCREG_SCTLR_S, // 110
174 MISCREG_ACTLR, // 111
175 MISCREG_ACTLR_NS, // 112
176 MISCREG_ACTLR_S, // 113
177 MISCREG_CPACR, // 114
178 MISCREG_SCR, // 115
179 MISCREG_SDER, // 116
180 MISCREG_NSACR, // 117
181 MISCREG_HSCTLR, // 118
182 MISCREG_HACTLR, // 119
183 MISCREG_HCR, // 120
184 MISCREG_HDCR, // 121
185 MISCREG_HCPTR, // 122
186 MISCREG_HSTR, // 123
187 MISCREG_HACR, // 124
188 MISCREG_TTBR0, // 125
189 MISCREG_TTBR0_NS, // 126
190 MISCREG_TTBR0_S, // 127
191 MISCREG_TTBR1, // 128
192 MISCREG_TTBR1_NS, // 129
193 MISCREG_TTBR1_S, // 130
194 MISCREG_TTBCR, // 131
195 MISCREG_TTBCR_NS, // 132
196 MISCREG_TTBCR_S, // 133
197 MISCREG_HTCR, // 134
198 MISCREG_VTCR, // 135
199 MISCREG_DACR, // 136
200 MISCREG_DACR_NS, // 137
201 MISCREG_DACR_S, // 138
202 MISCREG_DFSR, // 139
203 MISCREG_DFSR_NS, // 140
204 MISCREG_DFSR_S, // 141
205 MISCREG_IFSR, // 142
206 MISCREG_IFSR_NS, // 143
207 MISCREG_IFSR_S, // 144
208 MISCREG_ADFSR, // 145
209 MISCREG_ADFSR_NS, // 146
210 MISCREG_ADFSR_S, // 147
211 MISCREG_AIFSR, // 148
212 MISCREG_AIFSR_NS, // 149
213 MISCREG_AIFSR_S, // 150
214 MISCREG_HADFSR, // 151
215 MISCREG_HAIFSR, // 152
216 MISCREG_HSR, // 153
217 MISCREG_DFAR, // 154
218 MISCREG_DFAR_NS, // 155
219 MISCREG_DFAR_S, // 156
220 MISCREG_IFAR, // 157
221 MISCREG_IFAR_NS, // 158
222 MISCREG_IFAR_S, // 159
223 MISCREG_HDFAR, // 160
224 MISCREG_HIFAR, // 161
225 MISCREG_HPFAR, // 162
226 MISCREG_ICIALLUIS, // 163
227 MISCREG_BPIALLIS, // 164
228 MISCREG_PAR, // 165
229 MISCREG_PAR_NS, // 166
230 MISCREG_PAR_S, // 167
231 MISCREG_ICIALLU, // 168
232 MISCREG_ICIMVAU, // 169
233 MISCREG_CP15ISB, // 170
234 MISCREG_BPIALL, // 171
235 MISCREG_BPIMVA, // 172
236 MISCREG_DCIMVAC, // 173
237 MISCREG_DCISW, // 174
238 MISCREG_ATS1CPR, // 175
239 MISCREG_ATS1CPW, // 176
240 MISCREG_ATS1CUR, // 177
241 MISCREG_ATS1CUW, // 178
242 MISCREG_ATS12NSOPR, // 179
243 MISCREG_ATS12NSOPW, // 180
244 MISCREG_ATS12NSOUR, // 181
245 MISCREG_ATS12NSOUW, // 182
246 MISCREG_DCCMVAC, // 183
247 MISCREG_DCCSW, // 184
248 MISCREG_CP15DSB, // 185
249 MISCREG_CP15DMB, // 186
250 MISCREG_DCCMVAU, // 187
251 MISCREG_DCCIMVAC, // 188
252 MISCREG_DCCISW, // 189
253 MISCREG_ATS1HR, // 190
254 MISCREG_ATS1HW, // 191
255 MISCREG_TLBIALLIS, // 192
256 MISCREG_TLBIMVAIS, // 193
257 MISCREG_TLBIASIDIS, // 194
258 MISCREG_TLBIMVAAIS, // 195
259 MISCREG_TLBIMVALIS, // 196
260 MISCREG_TLBIMVAALIS, // 197
261 MISCREG_ITLBIALL, // 198
262 MISCREG_ITLBIMVA, // 199
263 MISCREG_ITLBIASID, // 200
264 MISCREG_DTLBIALL, // 201
265 MISCREG_DTLBIMVA, // 202
266 MISCREG_DTLBIASID, // 203
267 MISCREG_TLBIALL, // 204
268 MISCREG_TLBIMVA, // 205
269 MISCREG_TLBIASID, // 206
270 MISCREG_TLBIMVAA, // 207
271 MISCREG_TLBIMVAL, // 208
272 MISCREG_TLBIMVAAL, // 209
273 MISCREG_TLBIIPAS2IS, // 210
274 MISCREG_TLBIIPAS2LIS, // 211
275 MISCREG_TLBIALLHIS, // 212
276 MISCREG_TLBIMVAHIS, // 213
277 MISCREG_TLBIALLNSNHIS, // 214
278 MISCREG_TLBIMVALHIS, // 215
279 MISCREG_TLBIIPAS2, // 216
280 MISCREG_TLBIIPAS2L, // 217
281 MISCREG_TLBIALLH, // 218
282 MISCREG_TLBIMVAH, // 219
283 MISCREG_TLBIALLNSNH, // 220
284 MISCREG_TLBIMVALH, // 221
285 MISCREG_PMCR, // 222
286 MISCREG_PMCNTENSET, // 223
287 MISCREG_PMCNTENCLR, // 224
288 MISCREG_PMOVSR, // 225
289 MISCREG_PMSWINC, // 226
290 MISCREG_PMSELR, // 227
291 MISCREG_PMCEID0, // 228
292 MISCREG_PMCEID1, // 229
293 MISCREG_PMCCNTR, // 230
294 MISCREG_PMXEVTYPER, // 231
295 MISCREG_PMCCFILTR, // 232
296 MISCREG_PMXEVCNTR, // 233
297 MISCREG_PMUSERENR, // 234
298 MISCREG_PMINTENSET, // 235
299 MISCREG_PMINTENCLR, // 236
300 MISCREG_PMOVSSET, // 237
301 MISCREG_L2CTLR, // 238
302 MISCREG_L2ECTLR, // 239
303 MISCREG_PRRR, // 240
304 MISCREG_PRRR_NS, // 241
305 MISCREG_PRRR_S, // 242
306 MISCREG_MAIR0, // 243
307 MISCREG_MAIR0_NS, // 244
308 MISCREG_MAIR0_S, // 245
309 MISCREG_NMRR, // 246
310 MISCREG_NMRR_NS, // 247
311 MISCREG_NMRR_S, // 248
312 MISCREG_MAIR1, // 249
313 MISCREG_MAIR1_NS, // 250
314 MISCREG_MAIR1_S, // 251
315 MISCREG_AMAIR0, // 252
316 MISCREG_AMAIR0_NS, // 253
317 MISCREG_AMAIR0_S, // 254
318 MISCREG_AMAIR1, // 255
319 MISCREG_AMAIR1_NS, // 256
320 MISCREG_AMAIR1_S, // 257
321 MISCREG_HMAIR0, // 258
322 MISCREG_HMAIR1, // 259
323 MISCREG_HAMAIR0, // 260
324 MISCREG_HAMAIR1, // 261
325 MISCREG_VBAR, // 262
326 MISCREG_VBAR_NS, // 263
327 MISCREG_VBAR_S, // 264
328 MISCREG_MVBAR, // 265
329 MISCREG_RMR, // 266
330 MISCREG_ISR, // 267
331 MISCREG_HVBAR, // 268
332 MISCREG_FCSEIDR, // 269
333 MISCREG_CONTEXTIDR, // 270
334 MISCREG_CONTEXTIDR_NS, // 271
335 MISCREG_CONTEXTIDR_S, // 272
336 MISCREG_TPIDRURW, // 273
337 MISCREG_TPIDRURW_NS, // 274
338 MISCREG_TPIDRURW_S, // 275
339 MISCREG_TPIDRURO, // 276
340 MISCREG_TPIDRURO_NS, // 277
341 MISCREG_TPIDRURO_S, // 278
342 MISCREG_TPIDRPRW, // 279
343 MISCREG_TPIDRPRW_NS, // 280
344 MISCREG_TPIDRPRW_S, // 281
345 MISCREG_HTPIDR, // 282
346 MISCREG_CNTFRQ, // 283
347 MISCREG_CNTKCTL, // 284
348 MISCREG_CNTP_TVAL, // 285
349 MISCREG_CNTP_TVAL_NS, // 286
350 MISCREG_CNTP_TVAL_S, // 287
351 MISCREG_CNTP_CTL, // 288
352 MISCREG_CNTP_CTL_NS, // 289
353 MISCREG_CNTP_CTL_S, // 290
354 MISCREG_CNTV_TVAL, // 291
355 MISCREG_CNTV_CTL, // 292
356 MISCREG_CNTHCTL, // 293
357 MISCREG_CNTHP_TVAL, // 294
358 MISCREG_CNTHP_CTL, // 295
359 MISCREG_IL1DATA0, // 296
360 MISCREG_IL1DATA1, // 297
361 MISCREG_IL1DATA2, // 298
362 MISCREG_IL1DATA3, // 299
363 MISCREG_DL1DATA0, // 300
364 MISCREG_DL1DATA1, // 301
365 MISCREG_DL1DATA2, // 302
366 MISCREG_DL1DATA3, // 303
367 MISCREG_DL1DATA4, // 304
368 MISCREG_RAMINDEX, // 305
369 MISCREG_L2ACTLR, // 306
370 MISCREG_CBAR, // 307
371 MISCREG_HTTBR, // 308
372 MISCREG_VTTBR, // 309
373 MISCREG_CNTPCT, // 310
374 MISCREG_CNTVCT, // 311
375 MISCREG_CNTP_CVAL, // 312
376 MISCREG_CNTP_CVAL_NS, // 313
377 MISCREG_CNTP_CVAL_S, // 314
378 MISCREG_CNTV_CVAL, // 315
379 MISCREG_CNTVOFF, // 316
380 MISCREG_CNTHP_CVAL, // 317
381 MISCREG_CPUMERRSR, // 318
382 MISCREG_L2MERRSR, // 319
383
384 // AArch64 registers (Op0=2)
385 MISCREG_MDCCINT_EL1, // 320
386 MISCREG_OSDTRRX_EL1, // 321
387 MISCREG_MDSCR_EL1, // 322
388 MISCREG_OSDTRTX_EL1, // 323
389 MISCREG_OSECCR_EL1, // 324
390 MISCREG_DBGBVR0_EL1, // 325
391 MISCREG_DBGBVR1_EL1, // 326
392 MISCREG_DBGBVR2_EL1, // 327
393 MISCREG_DBGBVR3_EL1, // 328
394 MISCREG_DBGBVR4_EL1, // 329
395 MISCREG_DBGBVR5_EL1, // 330
396 MISCREG_DBGBCR0_EL1, // 331
397 MISCREG_DBGBCR1_EL1, // 332
398 MISCREG_DBGBCR2_EL1, // 333
399 MISCREG_DBGBCR3_EL1, // 334
400 MISCREG_DBGBCR4_EL1, // 335
401 MISCREG_DBGBCR5_EL1, // 336
402 MISCREG_DBGWVR0_EL1, // 337
403 MISCREG_DBGWVR1_EL1, // 338
404 MISCREG_DBGWVR2_EL1, // 339
405 MISCREG_DBGWVR3_EL1, // 340
406 MISCREG_DBGWCR0_EL1, // 341
407 MISCREG_DBGWCR1_EL1, // 342
408 MISCREG_DBGWCR2_EL1, // 343
409 MISCREG_DBGWCR3_EL1, // 344
410 MISCREG_MDCCSR_EL0, // 345
411 MISCREG_MDDTR_EL0, // 346
412 MISCREG_MDDTRTX_EL0, // 347
413 MISCREG_MDDTRRX_EL0, // 348
414 MISCREG_DBGVCR32_EL2, // 349
415 MISCREG_MDRAR_EL1, // 350
416 MISCREG_OSLAR_EL1, // 351
417 MISCREG_OSLSR_EL1, // 352
418 MISCREG_OSDLR_EL1, // 353
419 MISCREG_DBGPRCR_EL1, // 354
420 MISCREG_DBGCLAIMSET_EL1, // 355
421 MISCREG_DBGCLAIMCLR_EL1, // 356
422 MISCREG_DBGAUTHSTATUS_EL1, // 357
423 MISCREG_TEECR32_EL1, // 358
424 MISCREG_TEEHBR32_EL1, // 359
425
426 // AArch64 registers (Op0=1,3)
427 MISCREG_MIDR_EL1, // 360
428 MISCREG_MPIDR_EL1, // 361
429 MISCREG_REVIDR_EL1, // 362
430 MISCREG_ID_PFR0_EL1, // 363
431 MISCREG_ID_PFR1_EL1, // 364
432 MISCREG_ID_DFR0_EL1, // 365
433 MISCREG_ID_AFR0_EL1, // 366
434 MISCREG_ID_MMFR0_EL1, // 367
435 MISCREG_ID_MMFR1_EL1, // 368
436 MISCREG_ID_MMFR2_EL1, // 369
437 MISCREG_ID_MMFR3_EL1, // 370
438 MISCREG_ID_ISAR0_EL1, // 371
439 MISCREG_ID_ISAR1_EL1, // 372
440 MISCREG_ID_ISAR2_EL1, // 373
441 MISCREG_ID_ISAR3_EL1, // 374
442 MISCREG_ID_ISAR4_EL1, // 375
443 MISCREG_ID_ISAR5_EL1, // 376
444 MISCREG_MVFR0_EL1, // 377
445 MISCREG_MVFR1_EL1, // 378
446 MISCREG_MVFR2_EL1, // 379
447 MISCREG_ID_AA64PFR0_EL1, // 380
448 MISCREG_ID_AA64PFR1_EL1, // 381
449 MISCREG_ID_AA64DFR0_EL1, // 382
450 MISCREG_ID_AA64DFR1_EL1, // 383
451 MISCREG_ID_AA64AFR0_EL1, // 384
452 MISCREG_ID_AA64AFR1_EL1, // 385
453 MISCREG_ID_AA64ISAR0_EL1, // 386
454 MISCREG_ID_AA64ISAR1_EL1, // 387
455 MISCREG_ID_AA64MMFR0_EL1, // 388
456 MISCREG_ID_AA64MMFR1_EL1, // 389
457 MISCREG_CCSIDR_EL1, // 390
458 MISCREG_CLIDR_EL1, // 391
459 MISCREG_AIDR_EL1, // 392
460 MISCREG_CSSELR_EL1, // 393
461 MISCREG_CTR_EL0, // 394
462 MISCREG_DCZID_EL0, // 395
463 MISCREG_VPIDR_EL2, // 396
464 MISCREG_VMPIDR_EL2, // 397
465 MISCREG_SCTLR_EL1, // 398
466 MISCREG_ACTLR_EL1, // 399
467 MISCREG_CPACR_EL1, // 400
468 MISCREG_SCTLR_EL2, // 401
469 MISCREG_ACTLR_EL2, // 402
470 MISCREG_HCR_EL2, // 403
471 MISCREG_MDCR_EL2, // 404
472 MISCREG_CPTR_EL2, // 405
473 MISCREG_HSTR_EL2, // 406
474 MISCREG_HACR_EL2, // 407
475 MISCREG_SCTLR_EL3, // 408
476 MISCREG_ACTLR_EL3, // 409
477 MISCREG_SCR_EL3, // 410
478 MISCREG_SDER32_EL3, // 411
479 MISCREG_CPTR_EL3, // 412
480 MISCREG_MDCR_EL3, // 413
481 MISCREG_TTBR0_EL1, // 414
482 MISCREG_TTBR1_EL1, // 415
483 MISCREG_TCR_EL1, // 416
484 MISCREG_TTBR0_EL2, // 417
485 MISCREG_TCR_EL2, // 418
486 MISCREG_VTTBR_EL2, // 419
487 MISCREG_VTCR_EL2, // 420
488 MISCREG_TTBR0_EL3, // 421
489 MISCREG_TCR_EL3, // 422
490 MISCREG_DACR32_EL2, // 423
491 MISCREG_SPSR_EL1, // 424
492 MISCREG_ELR_EL1, // 425
493 MISCREG_SP_EL0, // 426
494 MISCREG_SPSEL, // 427
495 MISCREG_CURRENTEL, // 428
496 MISCREG_NZCV, // 429
497 MISCREG_DAIF, // 430
498 MISCREG_FPCR, // 431
499 MISCREG_FPSR, // 432
500 MISCREG_DSPSR_EL0, // 433
501 MISCREG_DLR_EL0, // 434
502 MISCREG_SPSR_EL2, // 435
503 MISCREG_ELR_EL2, // 436
504 MISCREG_SP_EL1, // 437
505 MISCREG_SPSR_IRQ_AA64, // 438
506 MISCREG_SPSR_ABT_AA64, // 439
507 MISCREG_SPSR_UND_AA64, // 440
508 MISCREG_SPSR_FIQ_AA64, // 441
509 MISCREG_SPSR_EL3, // 442
510 MISCREG_ELR_EL3, // 443
511 MISCREG_SP_EL2, // 444
512 MISCREG_AFSR0_EL1, // 445
513 MISCREG_AFSR1_EL1, // 446
514 MISCREG_ESR_EL1, // 447
515 MISCREG_IFSR32_EL2, // 448
516 MISCREG_AFSR0_EL2, // 449
517 MISCREG_AFSR1_EL2, // 450
518 MISCREG_ESR_EL2, // 451
519 MISCREG_FPEXC32_EL2, // 452
520 MISCREG_AFSR0_EL3, // 453
521 MISCREG_AFSR1_EL3, // 454
522 MISCREG_ESR_EL3, // 455
523 MISCREG_FAR_EL1, // 456
524 MISCREG_FAR_EL2, // 457
525 MISCREG_HPFAR_EL2, // 458
526 MISCREG_FAR_EL3, // 459
527 MISCREG_IC_IALLUIS, // 460
528 MISCREG_PAR_EL1, // 461
529 MISCREG_IC_IALLU, // 462
530 MISCREG_DC_IVAC_Xt, // 463
531 MISCREG_DC_ISW_Xt, // 464
532 MISCREG_AT_S1E1R_Xt, // 465
533 MISCREG_AT_S1E1W_Xt, // 466
534 MISCREG_AT_S1E0R_Xt, // 467
535 MISCREG_AT_S1E0W_Xt, // 468
536 MISCREG_DC_CSW_Xt, // 469
537 MISCREG_DC_CISW_Xt, // 470
538 MISCREG_DC_ZVA_Xt, // 471
539 MISCREG_IC_IVAU_Xt, // 472
540 MISCREG_DC_CVAC_Xt, // 473
541 MISCREG_DC_CVAU_Xt, // 474
542 MISCREG_DC_CIVAC_Xt, // 475
543 MISCREG_AT_S1E2R_Xt, // 476
544 MISCREG_AT_S1E2W_Xt, // 477
545 MISCREG_AT_S12E1R_Xt, // 478
546 MISCREG_AT_S12E1W_Xt, // 479
547 MISCREG_AT_S12E0R_Xt, // 480
548 MISCREG_AT_S12E0W_Xt, // 481
549 MISCREG_AT_S1E3R_Xt, // 482
550 MISCREG_AT_S1E3W_Xt, // 483
551 MISCREG_TLBI_VMALLE1IS, // 484
552 MISCREG_TLBI_VAE1IS_Xt, // 485
553 MISCREG_TLBI_ASIDE1IS_Xt, // 486
554 MISCREG_TLBI_VAAE1IS_Xt, // 487
555 MISCREG_TLBI_VALE1IS_Xt, // 488
556 MISCREG_TLBI_VAALE1IS_Xt, // 489
557 MISCREG_TLBI_VMALLE1, // 490
558 MISCREG_TLBI_VAE1_Xt, // 491
559 MISCREG_TLBI_ASIDE1_Xt, // 492
560 MISCREG_TLBI_VAAE1_Xt, // 493
561 MISCREG_TLBI_VALE1_Xt, // 494
562 MISCREG_TLBI_VAALE1_Xt, // 495
563 MISCREG_TLBI_IPAS2E1IS_Xt, // 496
564 MISCREG_TLBI_IPAS2LE1IS_Xt, // 497
565 MISCREG_TLBI_ALLE2IS, // 498
566 MISCREG_TLBI_VAE2IS_Xt, // 499
567 MISCREG_TLBI_ALLE1IS, // 500
568 MISCREG_TLBI_VALE2IS_Xt, // 501
569 MISCREG_TLBI_VMALLS12E1IS, // 502
570 MISCREG_TLBI_IPAS2E1_Xt, // 503
571 MISCREG_TLBI_IPAS2LE1_Xt, // 504
572 MISCREG_TLBI_ALLE2, // 505
573 MISCREG_TLBI_VAE2_Xt, // 506
574 MISCREG_TLBI_ALLE1, // 507
575 MISCREG_TLBI_VALE2_Xt, // 508
576 MISCREG_TLBI_VMALLS12E1, // 509
577 MISCREG_TLBI_ALLE3IS, // 510
578 MISCREG_TLBI_VAE3IS_Xt, // 511
579 MISCREG_TLBI_VALE3IS_Xt, // 512
580 MISCREG_TLBI_ALLE3, // 513
581 MISCREG_TLBI_VAE3_Xt, // 514
582 MISCREG_TLBI_VALE3_Xt, // 515
583 MISCREG_PMINTENSET_EL1, // 516
584 MISCREG_PMINTENCLR_EL1, // 517
585 MISCREG_PMCR_EL0, // 518
586 MISCREG_PMCNTENSET_EL0, // 519
587 MISCREG_PMCNTENCLR_EL0, // 520
588 MISCREG_PMOVSCLR_EL0, // 521
589 MISCREG_PMSWINC_EL0, // 522
590 MISCREG_PMSELR_EL0, // 523
591 MISCREG_PMCEID0_EL0, // 524
592 MISCREG_PMCEID1_EL0, // 525
593 MISCREG_PMCCNTR_EL0, // 526
594 MISCREG_PMXEVTYPER_EL0, // 527
595 MISCREG_PMCCFILTR_EL0, // 528
596 MISCREG_PMXEVCNTR_EL0, // 529
597 MISCREG_PMUSERENR_EL0, // 530
598 MISCREG_PMOVSSET_EL0, // 531
599 MISCREG_MAIR_EL1, // 532
600 MISCREG_AMAIR_EL1, // 533
601 MISCREG_MAIR_EL2, // 534
602 MISCREG_AMAIR_EL2, // 535
603 MISCREG_MAIR_EL3, // 536
604 MISCREG_AMAIR_EL3, // 537
605 MISCREG_L2CTLR_EL1, // 538
606 MISCREG_L2ECTLR_EL1, // 539
607 MISCREG_VBAR_EL1, // 540
608 MISCREG_RVBAR_EL1, // 541
609 MISCREG_ISR_EL1, // 542
610 MISCREG_VBAR_EL2, // 543
611 MISCREG_RVBAR_EL2, // 544
612 MISCREG_VBAR_EL3, // 545
613 MISCREG_RVBAR_EL3, // 546
614 MISCREG_RMR_EL3, // 547
615 MISCREG_CONTEXTIDR_EL1, // 548
616 MISCREG_TPIDR_EL1, // 549
617 MISCREG_TPIDR_EL0, // 550
618 MISCREG_TPIDRRO_EL0, // 551
619 MISCREG_TPIDR_EL2, // 552
620 MISCREG_TPIDR_EL3, // 553
621 MISCREG_CNTKCTL_EL1, // 554
622 MISCREG_CNTFRQ_EL0, // 555
623 MISCREG_CNTPCT_EL0, // 556
624 MISCREG_CNTVCT_EL0, // 557
625 MISCREG_CNTP_TVAL_EL0, // 558
626 MISCREG_CNTP_CTL_EL0, // 559
627 MISCREG_CNTP_CVAL_EL0, // 560
628 MISCREG_CNTV_TVAL_EL0, // 561
629 MISCREG_CNTV_CTL_EL0, // 562
630 MISCREG_CNTV_CVAL_EL0, // 563
631 MISCREG_PMEVCNTR0_EL0, // 564
632 MISCREG_PMEVCNTR1_EL0, // 565
633 MISCREG_PMEVCNTR2_EL0, // 566
634 MISCREG_PMEVCNTR3_EL0, // 567
635 MISCREG_PMEVCNTR4_EL0, // 568
636 MISCREG_PMEVCNTR5_EL0, // 569
637 MISCREG_PMEVTYPER0_EL0, // 570
638 MISCREG_PMEVTYPER1_EL0, // 571
639 MISCREG_PMEVTYPER2_EL0, // 572
640 MISCREG_PMEVTYPER3_EL0, // 573
641 MISCREG_PMEVTYPER4_EL0, // 574
642 MISCREG_PMEVTYPER5_EL0, // 575
643 MISCREG_CNTVOFF_EL2, // 576
644 MISCREG_CNTHCTL_EL2, // 577
645 MISCREG_CNTHP_TVAL_EL2, // 578
646 MISCREG_CNTHP_CTL_EL2, // 579
647 MISCREG_CNTHP_CVAL_EL2, // 580
648 MISCREG_CNTPS_TVAL_EL1, // 581
649 MISCREG_CNTPS_CTL_EL1, // 582
650 MISCREG_CNTPS_CVAL_EL1, // 583
651 MISCREG_IL1DATA0_EL1, // 584
652 MISCREG_IL1DATA1_EL1, // 585
653 MISCREG_IL1DATA2_EL1, // 586
654 MISCREG_IL1DATA3_EL1, // 587
655 MISCREG_DL1DATA0_EL1, // 588
656 MISCREG_DL1DATA1_EL1, // 589
657 MISCREG_DL1DATA2_EL1, // 590
658 MISCREG_DL1DATA3_EL1, // 591
659 MISCREG_DL1DATA4_EL1, // 592
660 MISCREG_L2ACTLR_EL1, // 593
661 MISCREG_CPUACTLR_EL1, // 594
662 MISCREG_CPUECTLR_EL1, // 595
663 MISCREG_CPUMERRSR_EL1, // 596
664 MISCREG_L2MERRSR_EL1, // 597
665 MISCREG_CBAR_EL1, // 598
666
667 // Dummy registers
668 MISCREG_NOP, // 599
669 MISCREG_RAZ, // 600
670 MISCREG_CP14_UNIMPL, // 601
671 MISCREG_CP15_UNIMPL, // 602
672 MISCREG_A64_UNIMPL, // 603
673 MISCREG_UNKNOWN, // 604
674
675 NUM_MISCREGS // 605
676 };
677
678 enum MiscRegInfo {
679 MISCREG_IMPLEMENTED,
680 MISCREG_WARN_NOT_FAIL, // If MISCREG_IMPLEMENTED is deasserted, it
681 // tells whether the instruction should raise a
682 // warning or fail
683 MISCREG_MUTEX, // True if the register corresponds to a pair of
684 // mutually exclusive registers
685 MISCREG_BANKED, // True if the register is banked between the two
686 // security states, and this is the parent node of the
687 // two banked registers
688 MISCREG_BANKED_CHILD, // The entry is one of the child registers that
689 // forms a banked set of regs (along with the
690 // other child regs)
691
692 // Access permissions
693 // User mode
694 MISCREG_USR_NS_RD,
695 MISCREG_USR_NS_WR,
696 MISCREG_USR_S_RD,
697 MISCREG_USR_S_WR,
698 // Privileged modes other than hypervisor or monitor
699 MISCREG_PRI_NS_RD,
700 MISCREG_PRI_NS_WR,
701 MISCREG_PRI_S_RD,
702 MISCREG_PRI_S_WR,
703 // Hypervisor mode
704 MISCREG_HYP_RD,
705 MISCREG_HYP_WR,
706 // Monitor mode, SCR.NS == 0
707 MISCREG_MON_NS0_RD,
708 MISCREG_MON_NS0_WR,
709 // Monitor mode, SCR.NS == 1
710 MISCREG_MON_NS1_RD,
711 MISCREG_MON_NS1_WR,
712
713 NUM_MISCREG_INFOS
714 };
715
716 extern std::bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS];
717
718 // Decodes 32-bit CP14 registers accessible through MCR/MRC instructions
719 MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1,
720 unsigned crm, unsigned opc2);
721 MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1,
722 unsigned crn, unsigned crm,
723 unsigned op2);
724 // Whether a particular AArch64 system register is -always- read only.
725 bool aarch64SysRegReadOnly(MiscRegIndex miscReg);
726
727 // Decodes 32-bit CP15 registers accessible through MCR/MRC instructions
728 MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
729 unsigned crm, unsigned opc2);
730
731 // Decodes 64-bit CP15 registers accessible through MCRR/MRRC instructions
732 MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1);
733
734
735 const char * const miscRegName[] = {
736 "cpsr",
737 "spsr",
738 "spsr_fiq",
739 "spsr_irq",
740 "spsr_svc",
741 "spsr_mon",
742 "spsr_abt",
743 "spsr_hyp",
744 "spsr_und",
745 "elr_hyp",
746 "fpsid",
747 "fpscr",
748 "mvfr1",
749 "mvfr0",
750 "fpexc",
751
752 // Helper registers
753 "cpsr_mode",
754 "cpsr_q",
755 "fpscr_exc",
756 "fpscr_qc",
757 "lockaddr",
758 "lockflag",
759 "prrr_mair0",
760 "prrr_mair0_ns",
761 "prrr_mair0_s",
762 "nmrr_mair1",
763 "nmrr_mair1_ns",
764 "nmrr_mair1_s",
765 "pmxevtyper_pmccfiltr",
766 "sctlr_rst",
767 "sev_mailbox",
768
769 // AArch32 CP14 registers
770 "dbgdidr",
771 "dbgdscrint",
772 "dbgdccint",
773 "dbgdtrtxint",
774 "dbgdtrrxint",
775 "dbgwfar",
776 "dbgvcr",
777 "dbgdtrrxext",
778 "dbgdscrext",
779 "dbgdtrtxext",
780 "dbgoseccr",
781 "dbgbvr0",
782 "dbgbvr1",
783 "dbgbvr2",
784 "dbgbvr3",
785 "dbgbvr4",
786 "dbgbvr5",
787 "dbgbcr0",
788 "dbgbcr1",
789 "dbgbcr2",
790 "dbgbcr3",
791 "dbgbcr4",
792 "dbgbcr5",
793 "dbgwvr0",
794 "dbgwvr1",
795 "dbgwvr2",
796 "dbgwvr3",
797 "dbgwcr0",
798 "dbgwcr1",
799 "dbgwcr2",
800 "dbgwcr3",
801 "dbgdrar",
802 "dbgbxvr4",
803 "dbgbxvr5",
804 "dbgoslar",
805 "dbgoslsr",
806 "dbgosdlr",
807 "dbgprcr",
808 "dbgdsar",
809 "dbgclaimset",
810 "dbgclaimclr",
811 "dbgauthstatus",
812 "dbgdevid2",
813 "dbgdevid1",
814 "dbgdevid0",
815 "teecr",
816 "jidr",
817 "teehbr",
818 "joscr",
819 "jmcr",
820
821 // AArch32 CP15 registers
822 "midr",
823 "ctr",
824 "tcmtr",
825 "tlbtr",
826 "mpidr",
827 "revidr",
828 "id_pfr0",
829 "id_pfr1",
830 "id_dfr0",
831 "id_afr0",
832 "id_mmfr0",
833 "id_mmfr1",
834 "id_mmfr2",
835 "id_mmfr3",
836 "id_isar0",
837 "id_isar1",
838 "id_isar2",
839 "id_isar3",
840 "id_isar4",
841 "id_isar5",
842 "ccsidr",
843 "clidr",
844 "aidr",
845 "csselr",
846 "csselr_ns",
847 "csselr_s",
848 "vpidr",
849 "vmpidr",
850 "sctlr",
851 "sctlr_ns",
852 "sctlr_s",
853 "actlr",
854 "actlr_ns",
855 "actlr_s",
856 "cpacr",
857 "scr",
858 "sder",
859 "nsacr",
860 "hsctlr",
861 "hactlr",
862 "hcr",
863 "hdcr",
864 "hcptr",
865 "hstr",
866 "hacr",
867 "ttbr0",
868 "ttbr0_ns",
869 "ttbr0_s",
870 "ttbr1",
871 "ttbr1_ns",
872 "ttbr1_s",
873 "ttbcr",
874 "ttbcr_ns",
875 "ttbcr_s",
876 "htcr",
877 "vtcr",
878 "dacr",
879 "dacr_ns",
880 "dacr_s",
881 "dfsr",
882 "dfsr_ns",
883 "dfsr_s",
884 "ifsr",
885 "ifsr_ns",
886 "ifsr_s",
887 "adfsr",
888 "adfsr_ns",
889 "adfsr_s",
890 "aifsr",
891 "aifsr_ns",
892 "aifsr_s",
893 "hadfsr",
894 "haifsr",
895 "hsr",
896 "dfar",
897 "dfar_ns",
898 "dfar_s",
899 "ifar",
900 "ifar_ns",
901 "ifar_s",
902 "hdfar",
903 "hifar",
904 "hpfar",
905 "icialluis",
906 "bpiallis",
907 "par",
908 "par_ns",
909 "par_s",
910 "iciallu",
911 "icimvau",
912 "cp15isb",
913 "bpiall",
914 "bpimva",
915 "dcimvac",
916 "dcisw",
917 "ats1cpr",
918 "ats1cpw",
919 "ats1cur",
920 "ats1cuw",
921 "ats12nsopr",
922 "ats12nsopw",
923 "ats12nsour",
924 "ats12nsouw",
925 "dccmvac",
926 "dccsw",
927 "cp15dsb",
928 "cp15dmb",
929 "dccmvau",
930 "dccimvac",
931 "dccisw",
932 "ats1hr",
933 "ats1hw",
934 "tlbiallis",
935 "tlbimvais",
936 "tlbiasidis",
937 "tlbimvaais",
938 "tlbimvalis",
939 "tlbimvaalis",
940 "itlbiall",
941 "itlbimva",
942 "itlbiasid",
943 "dtlbiall",
944 "dtlbimva",
945 "dtlbiasid",
946 "tlbiall",
947 "tlbimva",
948 "tlbiasid",
949 "tlbimvaa",
950 "tlbimval",
951 "tlbimvaal",
952 "tlbiipas2is",
953 "tlbiipas2lis",
954 "tlbiallhis",
955 "tlbimvahis",
956 "tlbiallnsnhis",
957 "tlbimvalhis",
958 "tlbiipas2",
959 "tlbiipas2l",
960 "tlbiallh",
961 "tlbimvah",
962 "tlbiallnsnh",
963 "tlbimvalh",
964 "pmcr",
965 "pmcntenset",
966 "pmcntenclr",
967 "pmovsr",
968 "pmswinc",
969 "pmselr",
970 "pmceid0",
971 "pmceid1",
972 "pmccntr",
973 "pmxevtyper",
974 "pmccfiltr",
975 "pmxevcntr",
976 "pmuserenr",
977 "pmintenset",
978 "pmintenclr",
979 "pmovsset",
980 "l2ctlr",
981 "l2ectlr",
982 "prrr",
983 "prrr_ns",
984 "prrr_s",
985 "mair0",
986 "mair0_ns",
987 "mair0_s",
988 "nmrr",
989 "nmrr_ns",
990 "nmrr_s",
991 "mair1",
992 "mair1_ns",
993 "mair1_s",
994 "amair0",
995 "amair0_ns",
996 "amair0_s",
997 "amair1",
998 "amair1_ns",
999 "amair1_s",
1000 "hmair0",
1001 "hmair1",
1002 "hamair0",
1003 "hamair1",
1004 "vbar",
1005 "vbar_ns",
1006 "vbar_s",
1007 "mvbar",
1008 "rmr",
1009 "isr",
1010 "hvbar",
1011 "fcseidr",
1012 "contextidr",
1013 "contextidr_ns",
1014 "contextidr_s",
1015 "tpidrurw",
1016 "tpidrurw_ns",
1017 "tpidrurw_s",
1018 "tpidruro",
1019 "tpidruro_ns",
1020 "tpidruro_s",
1021 "tpidrprw",
1022 "tpidrprw_ns",
1023 "tpidrprw_s",
1024 "htpidr",
1025 "cntfrq",
1026 "cntkctl",
1027 "cntp_tval",
1028 "cntp_tval_ns",
1029 "cntp_tval_s",
1030 "cntp_ctl",
1031 "cntp_ctl_ns",
1032 "cntp_ctl_s",
1033 "cntv_tval",
1034 "cntv_ctl",
1035 "cnthctl",
1036 "cnthp_tval",
1037 "cnthp_ctl",
1038 "il1data0",
1039 "il1data1",
1040 "il1data2",
1041 "il1data3",
1042 "dl1data0",
1043 "dl1data1",
1044 "dl1data2",
1045 "dl1data3",
1046 "dl1data4",
1047 "ramindex",
1048 "l2actlr",
1049 "cbar",
1050 "httbr",
1051 "vttbr",
1052 "cntpct",
1053 "cntvct",
1054 "cntp_cval",
1055 "cntp_cval_ns",
1056 "cntp_cval_s",
1057 "cntv_cval",
1058 "cntvoff",
1059 "cnthp_cval",
1060 "cpumerrsr",
1061 "l2merrsr",
1062
1063 // AArch64 registers (Op0=2)
1064 "mdccint_el1",
1065 "osdtrrx_el1",
1066 "mdscr_el1",
1067 "osdtrtx_el1",
1068 "oseccr_el1",
1069 "dbgbvr0_el1",
1070 "dbgbvr1_el1",
1071 "dbgbvr2_el1",
1072 "dbgbvr3_el1",
1073 "dbgbvr4_el1",
1074 "dbgbvr5_el1",
1075 "dbgbcr0_el1",
1076 "dbgbcr1_el1",
1077 "dbgbcr2_el1",
1078 "dbgbcr3_el1",
1079 "dbgbcr4_el1",
1080 "dbgbcr5_el1",
1081 "dbgwvr0_el1",
1082 "dbgwvr1_el1",
1083 "dbgwvr2_el1",
1084 "dbgwvr3_el1",
1085 "dbgwcr0_el1",
1086 "dbgwcr1_el1",
1087 "dbgwcr2_el1",
1088 "dbgwcr3_el1",
1089 "mdccsr_el0",
1090 "mddtr_el0",
1091 "mddtrtx_el0",
1092 "mddtrrx_el0",
1093 "dbgvcr32_el2",
1094 "mdrar_el1",
1095 "oslar_el1",
1096 "oslsr_el1",
1097 "osdlr_el1",
1098 "dbgprcr_el1",
1099 "dbgclaimset_el1",
1100 "dbgclaimclr_el1",
1101 "dbgauthstatus_el1",
1102 "teecr32_el1",
1103 "teehbr32_el1",
1104
1105 // AArch64 registers (Op0=1,3)
1106 "midr_el1",
1107 "mpidr_el1",
1108 "revidr_el1",
1109 "id_pfr0_el1",
1110 "id_pfr1_el1",
1111 "id_dfr0_el1",
1112 "id_afr0_el1",
1113 "id_mmfr0_el1",
1114 "id_mmfr1_el1",
1115 "id_mmfr2_el1",
1116 "id_mmfr3_el1",
1117 "id_isar0_el1",
1118 "id_isar1_el1",
1119 "id_isar2_el1",
1120 "id_isar3_el1",
1121 "id_isar4_el1",
1122 "id_isar5_el1",
1123 "mvfr0_el1",
1124 "mvfr1_el1",
1125 "mvfr2_el1",
1126 "id_aa64pfr0_el1",
1127 "id_aa64pfr1_el1",
1128 "id_aa64dfr0_el1",
1129 "id_aa64dfr1_el1",
1130 "id_aa64afr0_el1",
1131 "id_aa64afr1_el1",
1132 "id_aa64isar0_el1",
1133 "id_aa64isar1_el1",
1134 "id_aa64mmfr0_el1",
1135 "id_aa64mmfr1_el1",
1136 "ccsidr_el1",
1137 "clidr_el1",
1138 "aidr_el1",
1139 "csselr_el1",
1140 "ctr_el0",
1141 "dczid_el0",
1142 "vpidr_el2",
1143 "vmpidr_el2",
1144 "sctlr_el1",
1145 "actlr_el1",
1146 "cpacr_el1",
1147 "sctlr_el2",
1148 "actlr_el2",
1149 "hcr_el2",
1150 "mdcr_el2",
1151 "cptr_el2",
1152 "hstr_el2",
1153 "hacr_el2",
1154 "sctlr_el3",
1155 "actlr_el3",
1156 "scr_el3",
1157 "sder32_el3",
1158 "cptr_el3",
1159 "mdcr_el3",
1160 "ttbr0_el1",
1161 "ttbr1_el1",
1162 "tcr_el1",
1163 "ttbr0_el2",
1164 "tcr_el2",
1165 "vttbr_el2",
1166 "vtcr_el2",
1167 "ttbr0_el3",
1168 "tcr_el3",
1169 "dacr32_el2",
1170 "spsr_el1",
1171 "elr_el1",
1172 "sp_el0",
1173 "spsel",
1174 "currentel",
1175 "nzcv",
1176 "daif",
1177 "fpcr",
1178 "fpsr",
1179 "dspsr_el0",
1180 "dlr_el0",
1181 "spsr_el2",
1182 "elr_el2",
1183 "sp_el1",
1184 "spsr_irq_aa64",
1185 "spsr_abt_aa64",
1186 "spsr_und_aa64",
1187 "spsr_fiq_aa64",
1188 "spsr_el3",
1189 "elr_el3",
1190 "sp_el2",
1191 "afsr0_el1",
1192 "afsr1_el1",
1193 "esr_el1",
1194 "ifsr32_el2",
1195 "afsr0_el2",
1196 "afsr1_el2",
1197 "esr_el2",
1198 "fpexc32_el2",
1199 "afsr0_el3",
1200 "afsr1_el3",
1201 "esr_el3",
1202 "far_el1",
1203 "far_el2",
1204 "hpfar_el2",
1205 "far_el3",
1206 "ic_ialluis",
1207 "par_el1",
1208 "ic_iallu",
1209 "dc_ivac_xt",
1210 "dc_isw_xt",
1211 "at_s1e1r_xt",
1212 "at_s1e1w_xt",
1213 "at_s1e0r_xt",
1214 "at_s1e0w_xt",
1215 "dc_csw_xt",
1216 "dc_cisw_xt",
1217 "dc_zva_xt",
1218 "ic_ivau_xt",
1219 "dc_cvac_xt",
1220 "dc_cvau_xt",
1221 "dc_civac_xt",
1222 "at_s1e2r_xt",
1223 "at_s1e2w_xt",
1224 "at_s12e1r_xt",
1225 "at_s12e1w_xt",
1226 "at_s12e0r_xt",
1227 "at_s12e0w_xt",
1228 "at_s1e3r_xt",
1229 "at_s1e3w_xt",
1230 "tlbi_vmalle1is",
1231 "tlbi_vae1is_xt",
1232 "tlbi_aside1is_xt",
1233 "tlbi_vaae1is_xt",
1234 "tlbi_vale1is_xt",
1235 "tlbi_vaale1is_xt",
1236 "tlbi_vmalle1",
1237 "tlbi_vae1_xt",
1238 "tlbi_aside1_xt",
1239 "tlbi_vaae1_xt",
1240 "tlbi_vale1_xt",
1241 "tlbi_vaale1_xt",
1242 "tlbi_ipas2e1is_xt",
1243 "tlbi_ipas2le1is_xt",
1244 "tlbi_alle2is",
1245 "tlbi_vae2is_xt",
1246 "tlbi_alle1is",
1247 "tlbi_vale2is_xt",
1248 "tlbi_vmalls12e1is",
1249 "tlbi_ipas2e1_xt",
1250 "tlbi_ipas2le1_xt",
1251 "tlbi_alle2",
1252 "tlbi_vae2_xt",
1253 "tlbi_alle1",
1254 "tlbi_vale2_xt",
1255 "tlbi_vmalls12e1",
1256 "tlbi_alle3is",
1257 "tlbi_vae3is_xt",
1258 "tlbi_vale3is_xt",
1259 "tlbi_alle3",
1260 "tlbi_vae3_xt",
1261 "tlbi_vale3_xt",
1262 "pmintenset_el1",
1263 "pmintenclr_el1",
1264 "pmcr_el0",
1265 "pmcntenset_el0",
1266 "pmcntenclr_el0",
1267 "pmovsclr_el0",
1268 "pmswinc_el0",
1269 "pmselr_el0",
1270 "pmceid0_el0",
1271 "pmceid1_el0",
1272 "pmccntr_el0",
1273 "pmxevtyper_el0",
1274 "pmccfiltr_el0",
1275 "pmxevcntr_el0",
1276 "pmuserenr_el0",
1277 "pmovsset_el0",
1278 "mair_el1",
1279 "amair_el1",
1280 "mair_el2",
1281 "amair_el2",
1282 "mair_el3",
1283 "amair_el3",
1284 "l2ctlr_el1",
1285 "l2ectlr_el1",
1286 "vbar_el1",
1287 "rvbar_el1",
1288 "isr_el1",
1289 "vbar_el2",
1290 "rvbar_el2",
1291 "vbar_el3",
1292 "rvbar_el3",
1293 "rmr_el3",
1294 "contextidr_el1",
1295 "tpidr_el1",
1296 "tpidr_el0",
1297 "tpidrro_el0",
1298 "tpidr_el2",
1299 "tpidr_el3",
1300 "cntkctl_el1",
1301 "cntfrq_el0",
1302 "cntpct_el0",
1303 "cntvct_el0",
1304 "cntp_tval_el0",
1305 "cntp_ctl_el0",
1306 "cntp_cval_el0",
1307 "cntv_tval_el0",
1308 "cntv_ctl_el0",
1309 "cntv_cval_el0",
1310 "pmevcntr0_el0",
1311 "pmevcntr1_el0",
1312 "pmevcntr2_el0",
1313 "pmevcntr3_el0",
1314 "pmevcntr4_el0",
1315 "pmevcntr5_el0",
1316 "pmevtyper0_el0",
1317 "pmevtyper1_el0",
1318 "pmevtyper2_el0",
1319 "pmevtyper3_el0",
1320 "pmevtyper4_el0",
1321 "pmevtyper5_el0",
1322 "cntvoff_el2",
1323 "cnthctl_el2",
1324 "cnthp_tval_el2",
1325 "cnthp_ctl_el2",
1326 "cnthp_cval_el2",
1327 "cntps_tval_el1",
1328 "cntps_ctl_el1",
1329 "cntps_cval_el1",
1330 "il1data0_el1",
1331 "il1data1_el1",
1332 "il1data2_el1",
1333 "il1data3_el1",
1334 "dl1data0_el1",
1335 "dl1data1_el1",
1336 "dl1data2_el1",
1337 "dl1data3_el1",
1338 "dl1data4_el1",
1339 "l2actlr_el1",
1340 "cpuactlr_el1",
1341 "cpuectlr_el1",
1342 "cpumerrsr_el1",
1343 "l2merrsr_el1",
1344 "cbar_el1",
1345
1346 // Dummy registers
1347 "nop",
1348 "raz",
1349 "cp14_unimpl",
1350 "cp15_unimpl",
1351 "a64_unimpl",
1352 "unknown"
1353 };
1354
1355 static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
1356 "The miscRegName array and NUM_MISCREGS are inconsistent.");
1357
1358 BitUnion32(CPSR)
1359 Bitfield<31, 30> nz;
1360 Bitfield<29> c;
1361 Bitfield<28> v;
1362 Bitfield<27> q;
1363 Bitfield<26, 25> it1;
1364 Bitfield<24> j;
1365 Bitfield<23, 22> res0_23_22;
1366 Bitfield<21> ss; // AArch64
1367 Bitfield<20> il; // AArch64
1368 Bitfield<19, 16> ge;
1369 Bitfield<15, 10> it2;
1370 Bitfield<9> d; // AArch64
1371 Bitfield<9> e;
1372 Bitfield<8> a;
1373 Bitfield<7> i;
1374 Bitfield<6> f;
1375 Bitfield<9, 6> daif; // AArch64
1376 Bitfield<5> t;
1377 Bitfield<4> width; // AArch64
1378 Bitfield<3, 2> el; // AArch64
1379 Bitfield<4, 0> mode;
1380 Bitfield<0> sp; // AArch64
1381 EndBitUnion(CPSR)
1382
1383 // This mask selects bits of the CPSR that actually go in the CondCodes
1384 // integer register to allow renaming.
1385 static const uint32_t CondCodesMask = 0xF00F0000;
1386 static const uint32_t CpsrMaskQ = 0x08000000;
1387
1388 BitUnion32(HDCR)
1389 Bitfield<11> tdra;
1390 Bitfield<10> tdosa;
1391 Bitfield<9> tda;
1392 Bitfield<8> tde;
1393 Bitfield<7> hpme;
1394 Bitfield<6> tpm;
1395 Bitfield<5> tpmcr;
1396 Bitfield<4, 0> hpmn;
1397 EndBitUnion(HDCR)
1398
1399 BitUnion32(HCPTR)
1400 Bitfield<31> tcpac;
1401 Bitfield<20> tta;
1402 Bitfield<15> tase;
1403 Bitfield<13> tcp13;
1404 Bitfield<12> tcp12;
1405 Bitfield<11> tcp11;
1406 Bitfield<10> tcp10;
1407 Bitfield<10> tfp; // AArch64
1408 Bitfield<9> tcp9;
1409 Bitfield<8> tcp8;
1410 Bitfield<7> tcp7;
1411 Bitfield<6> tcp6;
1412 Bitfield<5> tcp5;
1413 Bitfield<4> tcp4;
1414 Bitfield<3> tcp3;
1415 Bitfield<2> tcp2;
1416 Bitfield<1> tcp1;
1417 Bitfield<0> tcp0;
1418 EndBitUnion(HCPTR)
1419
1420 BitUnion32(HSTR)
1421 Bitfield<17> tjdbx;
1422 Bitfield<16> ttee;
1423 Bitfield<15> t15;
1424 Bitfield<13> t13;
1425 Bitfield<12> t12;
1426 Bitfield<11> t11;
1427 Bitfield<10> t10;
1428 Bitfield<9> t9;
1429 Bitfield<8> t8;
1430 Bitfield<7> t7;
1431 Bitfield<6> t6;
1432 Bitfield<5> t5;
1433 Bitfield<4> t4;
1434 Bitfield<3> t3;
1435 Bitfield<2> t2;
1436 Bitfield<1> t1;
1437 Bitfield<0> t0;
1438 EndBitUnion(HSTR)
1439
1440 BitUnion64(HCR)
1441 Bitfield<33> id; // AArch64
1442 Bitfield<32> cd; // AArch64
1443 Bitfield<31> rw; // AArch64
1444 Bitfield<30> trvm; // AArch64
1445 Bitfield<29> hcd; // AArch64
1446 Bitfield<28> tdz; // AArch64
1447
1448 Bitfield<27> tge;
1449 Bitfield<26> tvm;
1450 Bitfield<25> ttlb;
1451 Bitfield<24> tpu;
1452 Bitfield<23> tpc;
1453 Bitfield<22> tsw;
1454 Bitfield<21> tac;
1455 Bitfield<21> tacr; // AArch64
1456 Bitfield<20> tidcp;
1457 Bitfield<19> tsc;
1458 Bitfield<18> tid3;
1459 Bitfield<17> tid2;
1460 Bitfield<16> tid1;
1461 Bitfield<15> tid0;
1462 Bitfield<14> twe;
1463 Bitfield<13> twi;
1464 Bitfield<12> dc;
1465 Bitfield<11, 10> bsu;
1466 Bitfield<9> fb;
1467 Bitfield<8> va;
1468 Bitfield<8> vse; // AArch64
1469 Bitfield<7> vi;
1470 Bitfield<6> vf;
1471 Bitfield<5> amo;
1472 Bitfield<4> imo;
1473 Bitfield<3> fmo;
1474 Bitfield<2> ptw;
1475 Bitfield<1> swio;
1476 Bitfield<0> vm;
1477 EndBitUnion(HCR)
1478
1479 BitUnion32(NSACR)
1480 Bitfield<20> nstrcdis;
1481 Bitfield<19> rfr;
1482 Bitfield<15> nsasedis;
1483 Bitfield<14> nsd32dis;
1484 Bitfield<13> cp13;
1485 Bitfield<12> cp12;
1486 Bitfield<11> cp11;
1487 Bitfield<10> cp10;
1488 Bitfield<9> cp9;
1489 Bitfield<8> cp8;
1490 Bitfield<7> cp7;
1491 Bitfield<6> cp6;
1492 Bitfield<5> cp5;
1493 Bitfield<4> cp4;
1494 Bitfield<3> cp3;
1495 Bitfield<2> cp2;
1496 Bitfield<1> cp1;
1497 Bitfield<0> cp0;
1498 EndBitUnion(NSACR)
1499
1500 BitUnion32(SCR)
1501 Bitfield<13> twe;
1502 Bitfield<12> twi;
1503 Bitfield<11> st; // AArch64
1504 Bitfield<10> rw; // AArch64
1505 Bitfield<9> sif;
1506 Bitfield<8> hce;
1507 Bitfield<7> scd;
1508 Bitfield<7> smd; // AArch64
1509 Bitfield<6> nEt;
1510 Bitfield<5> aw;
1511 Bitfield<4> fw;
1512 Bitfield<3> ea;
1513 Bitfield<2> fiq;
1514 Bitfield<1> irq;
1515 Bitfield<0> ns;
1516 EndBitUnion(SCR)
1517
1518 BitUnion32(SCTLR)
1519 Bitfield<30> te; // Thumb Exception Enable (AArch32 only)
1520 Bitfield<29> afe; // Access flag enable (AArch32 only)
1521 Bitfield<28> tre; // TEX remap enable (AArch32 only)
1522 Bitfield<27> nmfi; // Non-maskable FIQ support (ARMv7 only)
1523 Bitfield<26> uci; // Enable EL0 access to DC CVAU, DC CIVAC,
1524 // DC CVAC and IC IVAU instructions
1525 // (AArch64 SCTLR_EL1 only)
1526 Bitfield<25> ee; // Exception Endianness
1527 Bitfield<24> ve; // Interrupt Vectors Enable (ARMv7 only)
1528 Bitfield<24> e0e; // Endianness of explicit data accesses at EL0
1529 // (AArch64 SCTLR_EL1 only)
1530 Bitfield<23> xp; // Extended page table enable (dropped in ARMv7)
1531 Bitfield<22> u; // Alignment (dropped in ARMv7)
1532 Bitfield<21> fi; // Fast interrupts configuration enable
1533 // (ARMv7 only)
1534 Bitfield<20> uwxn; // Unprivileged write permission implies EL1 XN
1535 // (AArch32 only)
1536 Bitfield<19> dz; // Divide by Zero fault enable
1537 // (dropped in ARMv7)
1538 Bitfield<19> wxn; // Write permission implies XN
1539 Bitfield<18> ntwe; // Not trap WFE
1540 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1541 Bitfield<18> rao2; // Read as one
1542 Bitfield<16> ntwi; // Not trap WFI
1543 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1544 Bitfield<16> rao3; // Read as one
1545 Bitfield<15> uct; // Enable EL0 access to CTR_EL0
1546 // (AArch64 SCTLR_EL1 only)
1547 Bitfield<14> rr; // Round Robin select (ARMv7 only)
1548 Bitfield<14> dze; // Enable EL0 access to DC ZVA
1549 // (AArch64 SCTLR_EL1 only)
1550 Bitfield<13> v; // Vectors bit (AArch32 only)
1551 Bitfield<12> i; // Instruction cache enable
1552 Bitfield<11> z; // Branch prediction enable (ARMv7 only)
1553 Bitfield<10> sw; // SWP/SWPB enable (ARMv7 only)
1554 Bitfield<9, 8> rs; // Deprecated protection bits (dropped in ARMv7)
1555 Bitfield<9> uma; // User mask access (AArch64 SCTLR_EL1 only)
1556 Bitfield<8> sed; // SETEND disable
1557 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1558 Bitfield<7> b; // Endianness support (dropped in ARMv7)
1559 Bitfield<7> itd; // IT disable
1560 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1561 Bitfield<6, 3> rao4; // Read as one
1562 Bitfield<6> thee; // ThumbEE enable
1563 // (ARMv8 AArch32 and AArch64 SCTLR_EL1 only)
1564 Bitfield<5> cp15ben; // CP15 barrier enable
1565 // (AArch32 and AArch64 SCTLR_EL1 only)
1566 Bitfield<4> sa0; // Stack Alignment Check Enable for EL0
1567 // (AArch64 SCTLR_EL1 only)
1568 Bitfield<3> sa; // Stack Alignment Check Enable (AArch64 only)
1569 Bitfield<2> c; // Cache enable
1570 Bitfield<1> a; // Alignment check enable
1571 Bitfield<0> m; // MMU enable
1572 EndBitUnion(SCTLR)
1573
1574 BitUnion32(CPACR)
1575 Bitfield<1, 0> cp0;
1576 Bitfield<3, 2> cp1;
1577 Bitfield<5, 4> cp2;
1578 Bitfield<7, 6> cp3;
1579 Bitfield<9, 8> cp4;
1580 Bitfield<11, 10> cp5;
1581 Bitfield<13, 12> cp6;
1582 Bitfield<15, 14> cp7;
1583 Bitfield<17, 16> cp8;
1584 Bitfield<19, 18> cp9;
1585 Bitfield<21, 20> cp10;
1586 Bitfield<21, 20> fpen; // AArch64
1587 Bitfield<23, 22> cp11;
1588 Bitfield<25, 24> cp12;
1589 Bitfield<27, 26> cp13;
1590 Bitfield<29, 28> rsvd;
1591 Bitfield<28> tta; // AArch64
1592 Bitfield<30> d32dis;
1593 Bitfield<31> asedis;
1594 EndBitUnion(CPACR)
1595
1596 BitUnion32(FSR)
1597 Bitfield<3, 0> fsLow;
1598 Bitfield<5, 0> status; // LPAE
1599 Bitfield<7, 4> domain;
1600 Bitfield<9> lpae;
1601 Bitfield<10> fsHigh;
1602 Bitfield<11> wnr;
1603 Bitfield<12> ext;
1604 Bitfield<13> cm; // LPAE
1605 EndBitUnion(FSR)
1606
1607 BitUnion32(FPSCR)
1608 Bitfield<0> ioc;
1609 Bitfield<1> dzc;
1610 Bitfield<2> ofc;
1611 Bitfield<3> ufc;
1612 Bitfield<4> ixc;
1613 Bitfield<7> idc;
1614 Bitfield<8> ioe;
1615 Bitfield<9> dze;
1616 Bitfield<10> ofe;
1617 Bitfield<11> ufe;
1618 Bitfield<12> ixe;
1619 Bitfield<15> ide;
1620 Bitfield<18, 16> len;
1621 Bitfield<21, 20> stride;
1622 Bitfield<23, 22> rMode;
1623 Bitfield<24> fz;
1624 Bitfield<25> dn;
1625 Bitfield<26> ahp;
1626 Bitfield<27> qc;
1627 Bitfield<28> v;
1628 Bitfield<29> c;
1629 Bitfield<30> z;
1630 Bitfield<31> n;
1631 EndBitUnion(FPSCR)
1632
1633 // This mask selects bits of the FPSCR that actually go in the FpCondCodes
1634 // integer register to allow renaming.
1635 static const uint32_t FpCondCodesMask = 0xF0000000;
1636 // This mask selects the cumulative FP exception flags of the FPSCR.
1637 static const uint32_t FpscrExcMask = 0x0000009F;
1638 // This mask selects the cumulative saturation flag of the FPSCR.
1639 static const uint32_t FpscrQcMask = 0x08000000;
1640
1641 BitUnion32(FPEXC)
1642 Bitfield<31> ex;
1643 Bitfield<30> en;
1644 Bitfield<29, 0> subArchDefined;
1645 EndBitUnion(FPEXC)
1646
1647 BitUnion32(MVFR0)
1648 Bitfield<3, 0> advSimdRegisters;
1649 Bitfield<7, 4> singlePrecision;
1650 Bitfield<11, 8> doublePrecision;
1651 Bitfield<15, 12> vfpExceptionTrapping;
1652 Bitfield<19, 16> divide;
1653 Bitfield<23, 20> squareRoot;
1654 Bitfield<27, 24> shortVectors;
1655 Bitfield<31, 28> roundingModes;
1656 EndBitUnion(MVFR0)
1657
1658 BitUnion32(MVFR1)
1659 Bitfield<3, 0> flushToZero;
1660 Bitfield<7, 4> defaultNaN;
1661 Bitfield<11, 8> advSimdLoadStore;
1662 Bitfield<15, 12> advSimdInteger;
1663 Bitfield<19, 16> advSimdSinglePrecision;
1664 Bitfield<23, 20> advSimdHalfPrecision;
1665 Bitfield<27, 24> vfpHalfPrecision;
1666 Bitfield<31, 28> raz;
1667 EndBitUnion(MVFR1)
1668
1669 BitUnion64(TTBCR)
1670 // Short-descriptor translation table format
1671 Bitfield<2, 0> n;
1672 Bitfield<4> pd0;
1673 Bitfield<5> pd1;
1674 // Long-descriptor translation table format
1675 Bitfield<5, 0> t0sz;
1676 Bitfield<7> epd0;
1677 Bitfield<9, 8> irgn0;
1678 Bitfield<11, 10> orgn0;
1679 Bitfield<13, 12> sh0;
1680 Bitfield<14> tg0;
1681 Bitfield<21, 16> t1sz;
1682 Bitfield<22> a1;
1683 Bitfield<23> epd1;
1684 Bitfield<25, 24> irgn1;
1685 Bitfield<27, 26> orgn1;
1686 Bitfield<29, 28> sh1;
1687 Bitfield<30> tg1;
1688 Bitfield<34, 32> ips;
1689 Bitfield<36> as;
1690 Bitfield<37> tbi0;
1691 Bitfield<38> tbi1;
1692 // Common
1693 Bitfield<31> eae;
1694 // TCR_EL2/3 (AArch64)
1695 Bitfield<18, 16> ps;
1696 Bitfield<20> tbi;
1697 EndBitUnion(TTBCR)
1698
1699 // Fields of TCR_EL{1,2,3} (mostly overlapping)
1700 // TCR_EL1 is natively 64 bits, the others are 32 bits
1701 BitUnion64(TCR)
1702 Bitfield<5, 0> t0sz;
1703 Bitfield<7> epd0; // EL1
1704 Bitfield<9, 8> irgn0;
1705 Bitfield<11, 10> orgn0;
1706 Bitfield<13, 12> sh0;
1707 Bitfield<15, 14> tg0;
1708 Bitfield<18, 16> ps;
1709 Bitfield<20> tbi; // EL2/EL3
1710 Bitfield<21, 16> t1sz; // EL1
1711 Bitfield<22> a1; // EL1
1712 Bitfield<23> epd1; // EL1
1713 Bitfield<25, 24> irgn1; // EL1
1714 Bitfield<27, 26> orgn1; // EL1
1715 Bitfield<29, 28> sh1; // EL1
1716 Bitfield<31, 30> tg1; // EL1
1717 Bitfield<34, 32> ips; // EL1
1718 Bitfield<36> as; // EL1
1719 Bitfield<37> tbi0; // EL1
1720 Bitfield<38> tbi1; // EL1
1721 EndBitUnion(TCR)
1722
1723 BitUnion32(HTCR)
1724 Bitfield<2, 0> t0sz;
1725 Bitfield<9, 8> irgn0;
1726 Bitfield<11, 10> orgn0;
1727 Bitfield<13, 12> sh0;
1728 EndBitUnion(HTCR)
1729
1730 BitUnion32(VTCR_t)
1731 Bitfield<3, 0> t0sz;
1732 Bitfield<4> s;
1733 Bitfield<7, 6> sl0;
1734 Bitfield<9, 8> irgn0;
1735 Bitfield<11, 10> orgn0;
1736 Bitfield<13, 12> sh0;
1737 EndBitUnion(VTCR_t)
1738
1739 BitUnion32(PRRR)
1740 Bitfield<1,0> tr0;
1741 Bitfield<3,2> tr1;
1742 Bitfield<5,4> tr2;
1743 Bitfield<7,6> tr3;
1744 Bitfield<9,8> tr4;
1745 Bitfield<11,10> tr5;
1746 Bitfield<13,12> tr6;
1747 Bitfield<15,14> tr7;
1748 Bitfield<16> ds0;
1749 Bitfield<17> ds1;
1750 Bitfield<18> ns0;
1751 Bitfield<19> ns1;
1752 Bitfield<24> nos0;
1753 Bitfield<25> nos1;
1754 Bitfield<26> nos2;
1755 Bitfield<27> nos3;
1756 Bitfield<28> nos4;
1757 Bitfield<29> nos5;
1758 Bitfield<30> nos6;
1759 Bitfield<31> nos7;
1760 EndBitUnion(PRRR)
1761
1762 BitUnion32(NMRR)
1763 Bitfield<1,0> ir0;
1764 Bitfield<3,2> ir1;
1765 Bitfield<5,4> ir2;
1766 Bitfield<7,6> ir3;
1767 Bitfield<9,8> ir4;
1768 Bitfield<11,10> ir5;
1769 Bitfield<13,12> ir6;
1770 Bitfield<15,14> ir7;
1771 Bitfield<17,16> or0;
1772 Bitfield<19,18> or1;
1773 Bitfield<21,20> or2;
1774 Bitfield<23,22> or3;
1775 Bitfield<25,24> or4;
1776 Bitfield<27,26> or5;
1777 Bitfield<29,28> or6;
1778 Bitfield<31,30> or7;
1779 EndBitUnion(NMRR)
1780
1781 BitUnion32(CONTEXTIDR)
1782 Bitfield<7,0> asid;
1783 Bitfield<31,8> procid;
1784 EndBitUnion(CONTEXTIDR)
1785
1786 BitUnion32(L2CTLR)
1787 Bitfield<2,0> sataRAMLatency;
1788 Bitfield<4,3> reserved_4_3;
1789 Bitfield<5> dataRAMSetup;
1790 Bitfield<8,6> tagRAMLatency;
1791 Bitfield<9> tagRAMSetup;
1792 Bitfield<11,10> dataRAMSlice;
1793 Bitfield<12> tagRAMSlice;
1794 Bitfield<20,13> reserved_20_13;
1795 Bitfield<21> eccandParityEnable;
1796 Bitfield<22> reserved_22;
1797 Bitfield<23> interptCtrlPresent;
1798 Bitfield<25,24> numCPUs;
1799 Bitfield<30,26> reserved_30_26;
1800 Bitfield<31> l2rstDISABLE_monitor;
1801 EndBitUnion(L2CTLR)
1802
1803 BitUnion32(CTR)
1804 Bitfield<3,0> iCacheLineSize;
1805 Bitfield<13,4> raz_13_4;
1806 Bitfield<15,14> l1IndexPolicy;
1807 Bitfield<19,16> dCacheLineSize;
1808 Bitfield<23,20> erg;
1809 Bitfield<27,24> cwg;
1810 Bitfield<28> raz_28;
1811 Bitfield<31,29> format;
1812 EndBitUnion(CTR)
1813
1814 BitUnion32(PMSELR)
1815 Bitfield<4, 0> sel;
1816 EndBitUnion(PMSELR)
1817
1818 BitUnion64(PAR)
1819 // 64-bit format
1820 Bitfield<63, 56> attr;
1821 Bitfield<39, 12> pa;
1822 Bitfield<11> lpae;
1823 Bitfield<9> ns;
1824 Bitfield<8, 7> sh;
1825 Bitfield<0> f;
1826 EndBitUnion(PAR)
1827
1828 BitUnion32(ESR)
1829 Bitfield<31, 26> ec;
1830 Bitfield<25> il;
1831 Bitfield<15, 0> imm16;
1832 EndBitUnion(ESR)
1833
1834 BitUnion32(CPTR)
1835 Bitfield<31> tcpac;
1836 Bitfield<20> tta;
1837 Bitfield<13, 12> res1_13_12_el2;
1838 Bitfield<10> tfp;
1839 Bitfield<9, 0> res1_9_0_el2;
1840 EndBitUnion(CPTR)
1841
1842
1843 // Checks read access permissions to coproc. registers
1844 bool canReadCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1845 ThreadContext *tc);
1846
1847 // Checks write access permissions to coproc. registers
1848 bool canWriteCoprocReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1849 ThreadContext *tc);
1850
1851 // Checks read access permissions to AArch64 system registers
1852 bool canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1853 ThreadContext *tc);
1854
1855 // Checks write access permissions to AArch64 system registers
1856 bool canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1857 ThreadContext *tc);
1858
1859 // Uses just the scr.ns bit to pre flatten the misc regs. This is useful
1860 // for MCR/MRC instructions
1861 int
1862 flattenMiscRegNsBanked(int reg, ThreadContext *tc);
1863
1864 // Flattens a misc reg index using the specified security state. This is
1865 // used for opperations (eg address translations) where the security
1866 // state of the register access may differ from the current state of the
1867 // processor
1868 int
1869 flattenMiscRegNsBanked(int reg, ThreadContext *tc, bool ns);
1870
1871 // Takes a misc reg index and returns the root reg if its one of a set of
1872 // banked registers
1873 void
1874 preUnflattenMiscReg();
1875
1876 int
1877 unflattenMiscReg(int reg);
1878
1879}
1880
1881#endif // __ARCH_ARM_MISCREGS_HH__