miscregs.hh revision 13759
112855Sgabeblack@google.com/*
212855Sgabeblack@google.com * Copyright (c) 2010-2018 ARM Limited
312855Sgabeblack@google.com * All rights reserved
412855Sgabeblack@google.com *
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#include <tuple>
48
49#include "arch/arm/miscregs_types.hh"
50#include "base/compiler.hh"
51
52class ThreadContext;
53
54
55namespace ArmISA
56{
57    enum MiscRegIndex {
58        MISCREG_CPSR = 0,
59        MISCREG_SPSR,
60        MISCREG_SPSR_FIQ,
61        MISCREG_SPSR_IRQ,
62        MISCREG_SPSR_SVC,
63        MISCREG_SPSR_MON,
64        MISCREG_SPSR_ABT,
65        MISCREG_SPSR_HYP,
66        MISCREG_SPSR_UND,
67        MISCREG_ELR_HYP,
68        MISCREG_FPSID,
69        MISCREG_FPSCR,
70        MISCREG_MVFR1,
71        MISCREG_MVFR0,
72        MISCREG_FPEXC,
73
74        // Helper registers
75        MISCREG_CPSR_MODE,
76        MISCREG_CPSR_Q,
77        MISCREG_FPSCR_EXC,
78        MISCREG_FPSCR_QC,
79        MISCREG_LOCKADDR,
80        MISCREG_LOCKFLAG,
81        MISCREG_PRRR_MAIR0,
82        MISCREG_PRRR_MAIR0_NS,
83        MISCREG_PRRR_MAIR0_S,
84        MISCREG_NMRR_MAIR1,
85        MISCREG_NMRR_MAIR1_NS,
86        MISCREG_NMRR_MAIR1_S,
87        MISCREG_PMXEVTYPER_PMCCFILTR,
88        MISCREG_SCTLR_RST,
89        MISCREG_SEV_MAILBOX,
90
91        // AArch32 CP14 registers (debug/trace/ThumbEE/Jazelle control)
92        MISCREG_DBGDIDR,
93        MISCREG_DBGDSCRint,
94        MISCREG_DBGDCCINT,
95        MISCREG_DBGDTRTXint,
96        MISCREG_DBGDTRRXint,
97        MISCREG_DBGWFAR,
98        MISCREG_DBGVCR,
99        MISCREG_DBGDTRRXext,
100        MISCREG_DBGDSCRext,
101        MISCREG_DBGDTRTXext,
102        MISCREG_DBGOSECCR,
103        MISCREG_DBGBVR0,
104        MISCREG_DBGBVR1,
105        MISCREG_DBGBVR2,
106        MISCREG_DBGBVR3,
107        MISCREG_DBGBVR4,
108        MISCREG_DBGBVR5,
109        MISCREG_DBGBCR0,
110        MISCREG_DBGBCR1,
111        MISCREG_DBGBCR2,
112        MISCREG_DBGBCR3,
113        MISCREG_DBGBCR4,
114        MISCREG_DBGBCR5,
115        MISCREG_DBGWVR0,
116        MISCREG_DBGWVR1,
117        MISCREG_DBGWVR2,
118        MISCREG_DBGWVR3,
119        MISCREG_DBGWCR0,
120        MISCREG_DBGWCR1,
121        MISCREG_DBGWCR2,
122        MISCREG_DBGWCR3,
123        MISCREG_DBGDRAR,
124        MISCREG_DBGBXVR4,
125        MISCREG_DBGBXVR5,
126        MISCREG_DBGOSLAR,
127        MISCREG_DBGOSLSR,
128        MISCREG_DBGOSDLR,
129        MISCREG_DBGPRCR,
130        MISCREG_DBGDSAR,
131        MISCREG_DBGCLAIMSET,
132        MISCREG_DBGCLAIMCLR,
133        MISCREG_DBGAUTHSTATUS,
134        MISCREG_DBGDEVID2,
135        MISCREG_DBGDEVID1,
136        MISCREG_DBGDEVID0,
137        MISCREG_TEECR,  // not in ARM DDI 0487A.b+
138        MISCREG_JIDR,
139        MISCREG_TEEHBR, // not in ARM DDI 0487A.b+
140        MISCREG_JOSCR,
141        MISCREG_JMCR,
142
143        // AArch32 CP15 registers (system control)
144        MISCREG_MIDR,
145        MISCREG_CTR,
146        MISCREG_TCMTR,
147        MISCREG_TLBTR,
148        MISCREG_MPIDR,
149        MISCREG_REVIDR,
150        MISCREG_ID_PFR0,
151        MISCREG_ID_PFR1,
152        MISCREG_ID_DFR0,
153        MISCREG_ID_AFR0,
154        MISCREG_ID_MMFR0,
155        MISCREG_ID_MMFR1,
156        MISCREG_ID_MMFR2,
157        MISCREG_ID_MMFR3,
158        MISCREG_ID_ISAR0,
159        MISCREG_ID_ISAR1,
160        MISCREG_ID_ISAR2,
161        MISCREG_ID_ISAR3,
162        MISCREG_ID_ISAR4,
163        MISCREG_ID_ISAR5,
164        MISCREG_CCSIDR,
165        MISCREG_CLIDR,
166        MISCREG_AIDR,
167        MISCREG_CSSELR,
168        MISCREG_CSSELR_NS,
169        MISCREG_CSSELR_S,
170        MISCREG_VPIDR,
171        MISCREG_VMPIDR,
172        MISCREG_SCTLR,
173        MISCREG_SCTLR_NS,
174        MISCREG_SCTLR_S,
175        MISCREG_ACTLR,
176        MISCREG_ACTLR_NS,
177        MISCREG_ACTLR_S,
178        MISCREG_CPACR,
179        MISCREG_SCR,
180        MISCREG_SDER,
181        MISCREG_NSACR,
182        MISCREG_HSCTLR,
183        MISCREG_HACTLR,
184        MISCREG_HCR,
185        MISCREG_HDCR,
186        MISCREG_HCPTR,
187        MISCREG_HSTR,
188        MISCREG_HACR,
189        MISCREG_TTBR0,
190        MISCREG_TTBR0_NS,
191        MISCREG_TTBR0_S,
192        MISCREG_TTBR1,
193        MISCREG_TTBR1_NS,
194        MISCREG_TTBR1_S,
195        MISCREG_TTBCR,
196        MISCREG_TTBCR_NS,
197        MISCREG_TTBCR_S,
198        MISCREG_HTCR,
199        MISCREG_VTCR,
200        MISCREG_DACR,
201        MISCREG_DACR_NS,
202        MISCREG_DACR_S,
203        MISCREG_DFSR,
204        MISCREG_DFSR_NS,
205        MISCREG_DFSR_S,
206        MISCREG_IFSR,
207        MISCREG_IFSR_NS,
208        MISCREG_IFSR_S,
209        MISCREG_ADFSR,
210        MISCREG_ADFSR_NS,
211        MISCREG_ADFSR_S,
212        MISCREG_AIFSR,
213        MISCREG_AIFSR_NS,
214        MISCREG_AIFSR_S,
215        MISCREG_HADFSR,
216        MISCREG_HAIFSR,
217        MISCREG_HSR,
218        MISCREG_DFAR,
219        MISCREG_DFAR_NS,
220        MISCREG_DFAR_S,
221        MISCREG_IFAR,
222        MISCREG_IFAR_NS,
223        MISCREG_IFAR_S,
224        MISCREG_HDFAR,
225        MISCREG_HIFAR,
226        MISCREG_HPFAR,
227        MISCREG_ICIALLUIS,
228        MISCREG_BPIALLIS,
229        MISCREG_PAR,
230        MISCREG_PAR_NS,
231        MISCREG_PAR_S,
232        MISCREG_ICIALLU,
233        MISCREG_ICIMVAU,
234        MISCREG_CP15ISB,
235        MISCREG_BPIALL,
236        MISCREG_BPIMVA,
237        MISCREG_DCIMVAC,
238        MISCREG_DCISW,
239        MISCREG_ATS1CPR,
240        MISCREG_ATS1CPW,
241        MISCREG_ATS1CUR,
242        MISCREG_ATS1CUW,
243        MISCREG_ATS12NSOPR,
244        MISCREG_ATS12NSOPW,
245        MISCREG_ATS12NSOUR,
246        MISCREG_ATS12NSOUW,
247        MISCREG_DCCMVAC,
248        MISCREG_DCCSW,
249        MISCREG_CP15DSB,
250        MISCREG_CP15DMB,
251        MISCREG_DCCMVAU,
252        MISCREG_DCCIMVAC,
253        MISCREG_DCCISW,
254        MISCREG_ATS1HR,
255        MISCREG_ATS1HW,
256        MISCREG_TLBIALLIS,
257        MISCREG_TLBIMVAIS,
258        MISCREG_TLBIASIDIS,
259        MISCREG_TLBIMVAAIS,
260        MISCREG_TLBIMVALIS,
261        MISCREG_TLBIMVAALIS,
262        MISCREG_ITLBIALL,
263        MISCREG_ITLBIMVA,
264        MISCREG_ITLBIASID,
265        MISCREG_DTLBIALL,
266        MISCREG_DTLBIMVA,
267        MISCREG_DTLBIASID,
268        MISCREG_TLBIALL,
269        MISCREG_TLBIMVA,
270        MISCREG_TLBIASID,
271        MISCREG_TLBIMVAA,
272        MISCREG_TLBIMVAL,
273        MISCREG_TLBIMVAAL,
274        MISCREG_TLBIIPAS2IS,
275        MISCREG_TLBIIPAS2LIS,
276        MISCREG_TLBIALLHIS,
277        MISCREG_TLBIMVAHIS,
278        MISCREG_TLBIALLNSNHIS,
279        MISCREG_TLBIMVALHIS,
280        MISCREG_TLBIIPAS2,
281        MISCREG_TLBIIPAS2L,
282        MISCREG_TLBIALLH,
283        MISCREG_TLBIMVAH,
284        MISCREG_TLBIALLNSNH,
285        MISCREG_TLBIMVALH,
286        MISCREG_PMCR,
287        MISCREG_PMCNTENSET,
288        MISCREG_PMCNTENCLR,
289        MISCREG_PMOVSR,
290        MISCREG_PMSWINC,
291        MISCREG_PMSELR,
292        MISCREG_PMCEID0,
293        MISCREG_PMCEID1,
294        MISCREG_PMCCNTR,
295        MISCREG_PMXEVTYPER,
296        MISCREG_PMCCFILTR,
297        MISCREG_PMXEVCNTR,
298        MISCREG_PMUSERENR,
299        MISCREG_PMINTENSET,
300        MISCREG_PMINTENCLR,
301        MISCREG_PMOVSSET,
302        MISCREG_L2CTLR,
303        MISCREG_L2ECTLR,
304        MISCREG_PRRR,
305        MISCREG_PRRR_NS,
306        MISCREG_PRRR_S,
307        MISCREG_MAIR0,
308        MISCREG_MAIR0_NS,
309        MISCREG_MAIR0_S,
310        MISCREG_NMRR,
311        MISCREG_NMRR_NS,
312        MISCREG_NMRR_S,
313        MISCREG_MAIR1,
314        MISCREG_MAIR1_NS,
315        MISCREG_MAIR1_S,
316        MISCREG_AMAIR0,
317        MISCREG_AMAIR0_NS,
318        MISCREG_AMAIR0_S,
319        MISCREG_AMAIR1,
320        MISCREG_AMAIR1_NS,
321        MISCREG_AMAIR1_S,
322        MISCREG_HMAIR0,
323        MISCREG_HMAIR1,
324        MISCREG_HAMAIR0,
325        MISCREG_HAMAIR1,
326        MISCREG_VBAR,
327        MISCREG_VBAR_NS,
328        MISCREG_VBAR_S,
329        MISCREG_MVBAR,
330        MISCREG_RMR,
331        MISCREG_ISR,
332        MISCREG_HVBAR,
333        MISCREG_FCSEIDR,
334        MISCREG_CONTEXTIDR,
335        MISCREG_CONTEXTIDR_NS,
336        MISCREG_CONTEXTIDR_S,
337        MISCREG_TPIDRURW,
338        MISCREG_TPIDRURW_NS,
339        MISCREG_TPIDRURW_S,
340        MISCREG_TPIDRURO,
341        MISCREG_TPIDRURO_NS,
342        MISCREG_TPIDRURO_S,
343        MISCREG_TPIDRPRW,
344        MISCREG_TPIDRPRW_NS,
345        MISCREG_TPIDRPRW_S,
346        MISCREG_HTPIDR,
347        MISCREG_CNTFRQ,
348        MISCREG_CNTKCTL,
349        MISCREG_CNTP_TVAL,
350        MISCREG_CNTP_TVAL_NS,
351        MISCREG_CNTP_TVAL_S,
352        MISCREG_CNTP_CTL,
353        MISCREG_CNTP_CTL_NS,
354        MISCREG_CNTP_CTL_S,
355        MISCREG_CNTV_TVAL,
356        MISCREG_CNTV_CTL,
357        MISCREG_CNTHCTL,
358        MISCREG_CNTHP_TVAL,
359        MISCREG_CNTHP_CTL,
360        MISCREG_IL1DATA0,
361        MISCREG_IL1DATA1,
362        MISCREG_IL1DATA2,
363        MISCREG_IL1DATA3,
364        MISCREG_DL1DATA0,
365        MISCREG_DL1DATA1,
366        MISCREG_DL1DATA2,
367        MISCREG_DL1DATA3,
368        MISCREG_DL1DATA4,
369        MISCREG_RAMINDEX,
370        MISCREG_L2ACTLR,
371        MISCREG_CBAR,
372        MISCREG_HTTBR,
373        MISCREG_VTTBR,
374        MISCREG_CNTPCT,
375        MISCREG_CNTVCT,
376        MISCREG_CNTP_CVAL,
377        MISCREG_CNTP_CVAL_NS,
378        MISCREG_CNTP_CVAL_S,
379        MISCREG_CNTV_CVAL,
380        MISCREG_CNTVOFF,
381        MISCREG_CNTHP_CVAL,
382        MISCREG_CPUMERRSR,
383        MISCREG_L2MERRSR,
384
385        // AArch64 registers (Op0=2)
386        MISCREG_MDCCINT_EL1,
387        MISCREG_OSDTRRX_EL1,
388        MISCREG_MDSCR_EL1,
389        MISCREG_OSDTRTX_EL1,
390        MISCREG_OSECCR_EL1,
391        MISCREG_DBGBVR0_EL1,
392        MISCREG_DBGBVR1_EL1,
393        MISCREG_DBGBVR2_EL1,
394        MISCREG_DBGBVR3_EL1,
395        MISCREG_DBGBVR4_EL1,
396        MISCREG_DBGBVR5_EL1,
397        MISCREG_DBGBCR0_EL1,
398        MISCREG_DBGBCR1_EL1,
399        MISCREG_DBGBCR2_EL1,
400        MISCREG_DBGBCR3_EL1,
401        MISCREG_DBGBCR4_EL1,
402        MISCREG_DBGBCR5_EL1,
403        MISCREG_DBGWVR0_EL1,
404        MISCREG_DBGWVR1_EL1,
405        MISCREG_DBGWVR2_EL1,
406        MISCREG_DBGWVR3_EL1,
407        MISCREG_DBGWCR0_EL1,
408        MISCREG_DBGWCR1_EL1,
409        MISCREG_DBGWCR2_EL1,
410        MISCREG_DBGWCR3_EL1,
411        MISCREG_MDCCSR_EL0,
412        MISCREG_MDDTR_EL0,
413        MISCREG_MDDTRTX_EL0,
414        MISCREG_MDDTRRX_EL0,
415        MISCREG_DBGVCR32_EL2,
416        MISCREG_MDRAR_EL1,
417        MISCREG_OSLAR_EL1,
418        MISCREG_OSLSR_EL1,
419        MISCREG_OSDLR_EL1,
420        MISCREG_DBGPRCR_EL1,
421        MISCREG_DBGCLAIMSET_EL1,
422        MISCREG_DBGCLAIMCLR_EL1,
423        MISCREG_DBGAUTHSTATUS_EL1,
424        MISCREG_TEECR32_EL1, // not in ARM DDI 0487A.b+
425        MISCREG_TEEHBR32_EL1, // not in ARM DDI 0487A.b+
426
427        // AArch64 registers (Op0=1,3)
428        MISCREG_MIDR_EL1,
429        MISCREG_MPIDR_EL1,
430        MISCREG_REVIDR_EL1,
431        MISCREG_ID_PFR0_EL1,
432        MISCREG_ID_PFR1_EL1,
433        MISCREG_ID_DFR0_EL1,
434        MISCREG_ID_AFR0_EL1,
435        MISCREG_ID_MMFR0_EL1,
436        MISCREG_ID_MMFR1_EL1,
437        MISCREG_ID_MMFR2_EL1,
438        MISCREG_ID_MMFR3_EL1,
439        MISCREG_ID_ISAR0_EL1,
440        MISCREG_ID_ISAR1_EL1,
441        MISCREG_ID_ISAR2_EL1,
442        MISCREG_ID_ISAR3_EL1,
443        MISCREG_ID_ISAR4_EL1,
444        MISCREG_ID_ISAR5_EL1,
445        MISCREG_MVFR0_EL1,
446        MISCREG_MVFR1_EL1,
447        MISCREG_MVFR2_EL1,
448        MISCREG_ID_AA64PFR0_EL1,
449        MISCREG_ID_AA64PFR1_EL1,
450        MISCREG_ID_AA64DFR0_EL1,
451        MISCREG_ID_AA64DFR1_EL1,
452        MISCREG_ID_AA64AFR0_EL1,
453        MISCREG_ID_AA64AFR1_EL1,
454        MISCREG_ID_AA64ISAR0_EL1,
455        MISCREG_ID_AA64ISAR1_EL1,
456        MISCREG_ID_AA64MMFR0_EL1,
457        MISCREG_ID_AA64MMFR1_EL1,
458        MISCREG_CCSIDR_EL1,
459        MISCREG_CLIDR_EL1,
460        MISCREG_AIDR_EL1,
461        MISCREG_CSSELR_EL1,
462        MISCREG_CTR_EL0,
463        MISCREG_DCZID_EL0,
464        MISCREG_VPIDR_EL2,
465        MISCREG_VMPIDR_EL2,
466        MISCREG_SCTLR_EL1,
467        MISCREG_ACTLR_EL1,
468        MISCREG_CPACR_EL1,
469        MISCREG_SCTLR_EL2,
470        MISCREG_ACTLR_EL2,
471        MISCREG_HCR_EL2,
472        MISCREG_MDCR_EL2,
473        MISCREG_CPTR_EL2,
474        MISCREG_HSTR_EL2,
475        MISCREG_HACR_EL2,
476        MISCREG_SCTLR_EL3,
477        MISCREG_ACTLR_EL3,
478        MISCREG_SCR_EL3,
479        MISCREG_SDER32_EL3,
480        MISCREG_CPTR_EL3,
481        MISCREG_MDCR_EL3,
482        MISCREG_TTBR0_EL1,
483        MISCREG_TTBR1_EL1,
484        MISCREG_TCR_EL1,
485        MISCREG_TTBR0_EL2,
486        MISCREG_TCR_EL2,
487        MISCREG_VTTBR_EL2,
488        MISCREG_VTCR_EL2,
489        MISCREG_TTBR0_EL3,
490        MISCREG_TCR_EL3,
491        MISCREG_DACR32_EL2,
492        MISCREG_SPSR_EL1,
493        MISCREG_ELR_EL1,
494        MISCREG_SP_EL0,
495        MISCREG_SPSEL,
496        MISCREG_CURRENTEL,
497        MISCREG_NZCV,
498        MISCREG_DAIF,
499        MISCREG_FPCR,
500        MISCREG_FPSR,
501        MISCREG_DSPSR_EL0,
502        MISCREG_DLR_EL0,
503        MISCREG_SPSR_EL2,
504        MISCREG_ELR_EL2,
505        MISCREG_SP_EL1,
506        MISCREG_SPSR_IRQ_AA64,
507        MISCREG_SPSR_ABT_AA64,
508        MISCREG_SPSR_UND_AA64,
509        MISCREG_SPSR_FIQ_AA64,
510        MISCREG_SPSR_EL3,
511        MISCREG_ELR_EL3,
512        MISCREG_SP_EL2,
513        MISCREG_AFSR0_EL1,
514        MISCREG_AFSR1_EL1,
515        MISCREG_ESR_EL1,
516        MISCREG_IFSR32_EL2,
517        MISCREG_AFSR0_EL2,
518        MISCREG_AFSR1_EL2,
519        MISCREG_ESR_EL2,
520        MISCREG_FPEXC32_EL2,
521        MISCREG_AFSR0_EL3,
522        MISCREG_AFSR1_EL3,
523        MISCREG_ESR_EL3,
524        MISCREG_FAR_EL1,
525        MISCREG_FAR_EL2,
526        MISCREG_HPFAR_EL2,
527        MISCREG_FAR_EL3,
528        MISCREG_IC_IALLUIS,
529        MISCREG_PAR_EL1,
530        MISCREG_IC_IALLU,
531        MISCREG_DC_IVAC_Xt,
532        MISCREG_DC_ISW_Xt,
533        MISCREG_AT_S1E1R_Xt,
534        MISCREG_AT_S1E1W_Xt,
535        MISCREG_AT_S1E0R_Xt,
536        MISCREG_AT_S1E0W_Xt,
537        MISCREG_DC_CSW_Xt,
538        MISCREG_DC_CISW_Xt,
539        MISCREG_DC_ZVA_Xt,
540        MISCREG_IC_IVAU_Xt,
541        MISCREG_DC_CVAC_Xt,
542        MISCREG_DC_CVAU_Xt,
543        MISCREG_DC_CIVAC_Xt,
544        MISCREG_AT_S1E2R_Xt,
545        MISCREG_AT_S1E2W_Xt,
546        MISCREG_AT_S12E1R_Xt,
547        MISCREG_AT_S12E1W_Xt,
548        MISCREG_AT_S12E0R_Xt,
549        MISCREG_AT_S12E0W_Xt,
550        MISCREG_AT_S1E3R_Xt,
551        MISCREG_AT_S1E3W_Xt,
552        MISCREG_TLBI_VMALLE1IS,
553        MISCREG_TLBI_VAE1IS_Xt,
554        MISCREG_TLBI_ASIDE1IS_Xt,
555        MISCREG_TLBI_VAAE1IS_Xt,
556        MISCREG_TLBI_VALE1IS_Xt,
557        MISCREG_TLBI_VAALE1IS_Xt,
558        MISCREG_TLBI_VMALLE1,
559        MISCREG_TLBI_VAE1_Xt,
560        MISCREG_TLBI_ASIDE1_Xt,
561        MISCREG_TLBI_VAAE1_Xt,
562        MISCREG_TLBI_VALE1_Xt,
563        MISCREG_TLBI_VAALE1_Xt,
564        MISCREG_TLBI_IPAS2E1IS_Xt,
565        MISCREG_TLBI_IPAS2LE1IS_Xt,
566        MISCREG_TLBI_ALLE2IS,
567        MISCREG_TLBI_VAE2IS_Xt,
568        MISCREG_TLBI_ALLE1IS,
569        MISCREG_TLBI_VALE2IS_Xt,
570        MISCREG_TLBI_VMALLS12E1IS,
571        MISCREG_TLBI_IPAS2E1_Xt,
572        MISCREG_TLBI_IPAS2LE1_Xt,
573        MISCREG_TLBI_ALLE2,
574        MISCREG_TLBI_VAE2_Xt,
575        MISCREG_TLBI_ALLE1,
576        MISCREG_TLBI_VALE2_Xt,
577        MISCREG_TLBI_VMALLS12E1,
578        MISCREG_TLBI_ALLE3IS,
579        MISCREG_TLBI_VAE3IS_Xt,
580        MISCREG_TLBI_VALE3IS_Xt,
581        MISCREG_TLBI_ALLE3,
582        MISCREG_TLBI_VAE3_Xt,
583        MISCREG_TLBI_VALE3_Xt,
584        MISCREG_PMINTENSET_EL1,
585        MISCREG_PMINTENCLR_EL1,
586        MISCREG_PMCR_EL0,
587        MISCREG_PMCNTENSET_EL0,
588        MISCREG_PMCNTENCLR_EL0,
589        MISCREG_PMOVSCLR_EL0,
590        MISCREG_PMSWINC_EL0,
591        MISCREG_PMSELR_EL0,
592        MISCREG_PMCEID0_EL0,
593        MISCREG_PMCEID1_EL0,
594        MISCREG_PMCCNTR_EL0,
595        MISCREG_PMXEVTYPER_EL0,
596        MISCREG_PMCCFILTR_EL0,
597        MISCREG_PMXEVCNTR_EL0,
598        MISCREG_PMUSERENR_EL0,
599        MISCREG_PMOVSSET_EL0,
600        MISCREG_MAIR_EL1,
601        MISCREG_AMAIR_EL1,
602        MISCREG_MAIR_EL2,
603        MISCREG_AMAIR_EL2,
604        MISCREG_MAIR_EL3,
605        MISCREG_AMAIR_EL3,
606        MISCREG_L2CTLR_EL1,
607        MISCREG_L2ECTLR_EL1,
608        MISCREG_VBAR_EL1,
609        MISCREG_RVBAR_EL1,
610        MISCREG_ISR_EL1,
611        MISCREG_VBAR_EL2,
612        MISCREG_RVBAR_EL2,
613        MISCREG_VBAR_EL3,
614        MISCREG_RVBAR_EL3,
615        MISCREG_RMR_EL3,
616        MISCREG_CONTEXTIDR_EL1,
617        MISCREG_TPIDR_EL1,
618        MISCREG_TPIDR_EL0,
619        MISCREG_TPIDRRO_EL0,
620        MISCREG_TPIDR_EL2,
621        MISCREG_TPIDR_EL3,
622        MISCREG_CNTKCTL_EL1,
623        MISCREG_CNTFRQ_EL0,
624        MISCREG_CNTPCT_EL0,
625        MISCREG_CNTVCT_EL0,
626        MISCREG_CNTP_TVAL_EL0,
627        MISCREG_CNTP_CTL_EL0,
628        MISCREG_CNTP_CVAL_EL0,
629        MISCREG_CNTV_TVAL_EL0,
630        MISCREG_CNTV_CTL_EL0,
631        MISCREG_CNTV_CVAL_EL0,
632        MISCREG_PMEVCNTR0_EL0,
633        MISCREG_PMEVCNTR1_EL0,
634        MISCREG_PMEVCNTR2_EL0,
635        MISCREG_PMEVCNTR3_EL0,
636        MISCREG_PMEVCNTR4_EL0,
637        MISCREG_PMEVCNTR5_EL0,
638        MISCREG_PMEVTYPER0_EL0,
639        MISCREG_PMEVTYPER1_EL0,
640        MISCREG_PMEVTYPER2_EL0,
641        MISCREG_PMEVTYPER3_EL0,
642        MISCREG_PMEVTYPER4_EL0,
643        MISCREG_PMEVTYPER5_EL0,
644        MISCREG_CNTVOFF_EL2,
645        MISCREG_CNTHCTL_EL2,
646        MISCREG_CNTHP_TVAL_EL2,
647        MISCREG_CNTHP_CTL_EL2,
648        MISCREG_CNTHP_CVAL_EL2,
649        MISCREG_CNTPS_TVAL_EL1,
650        MISCREG_CNTPS_CTL_EL1,
651        MISCREG_CNTPS_CVAL_EL1,
652        MISCREG_IL1DATA0_EL1,
653        MISCREG_IL1DATA1_EL1,
654        MISCREG_IL1DATA2_EL1,
655        MISCREG_IL1DATA3_EL1,
656        MISCREG_DL1DATA0_EL1,
657        MISCREG_DL1DATA1_EL1,
658        MISCREG_DL1DATA2_EL1,
659        MISCREG_DL1DATA3_EL1,
660        MISCREG_DL1DATA4_EL1,
661        MISCREG_L2ACTLR_EL1,
662        MISCREG_CPUACTLR_EL1,
663        MISCREG_CPUECTLR_EL1,
664        MISCREG_CPUMERRSR_EL1,
665        MISCREG_L2MERRSR_EL1,
666        MISCREG_CBAR_EL1,
667        MISCREG_CONTEXTIDR_EL2,
668
669        // Introduced in ARMv8.1
670        MISCREG_TTBR1_EL2,
671        MISCREG_CNTHV_CTL_EL2,
672        MISCREG_CNTHV_CVAL_EL2,
673        MISCREG_CNTHV_TVAL_EL2,
674
675        MISCREG_ID_AA64MMFR2_EL1,
676
677        // GICv3, CPU interface
678        MISCREG_ICC_PMR_EL1,
679        MISCREG_ICC_IAR0_EL1,
680        MISCREG_ICC_EOIR0_EL1,
681        MISCREG_ICC_HPPIR0_EL1,
682        MISCREG_ICC_BPR0_EL1,
683        MISCREG_ICC_AP0R0_EL1,
684        MISCREG_ICC_AP0R1_EL1,
685        MISCREG_ICC_AP0R2_EL1,
686        MISCREG_ICC_AP0R3_EL1,
687        MISCREG_ICC_AP1R0_EL1,
688        MISCREG_ICC_AP1R0_EL1_NS,
689        MISCREG_ICC_AP1R0_EL1_S,
690        MISCREG_ICC_AP1R1_EL1,
691        MISCREG_ICC_AP1R1_EL1_NS,
692        MISCREG_ICC_AP1R1_EL1_S,
693        MISCREG_ICC_AP1R2_EL1,
694        MISCREG_ICC_AP1R2_EL1_NS,
695        MISCREG_ICC_AP1R2_EL1_S,
696        MISCREG_ICC_AP1R3_EL1,
697        MISCREG_ICC_AP1R3_EL1_NS,
698        MISCREG_ICC_AP1R3_EL1_S,
699        MISCREG_ICC_DIR_EL1,
700        MISCREG_ICC_RPR_EL1,
701        MISCREG_ICC_SGI1R_EL1,
702        MISCREG_ICC_ASGI1R_EL1,
703        MISCREG_ICC_SGI0R_EL1,
704        MISCREG_ICC_IAR1_EL1,
705        MISCREG_ICC_EOIR1_EL1,
706        MISCREG_ICC_HPPIR1_EL1,
707        MISCREG_ICC_BPR1_EL1,
708        MISCREG_ICC_BPR1_EL1_NS,
709        MISCREG_ICC_BPR1_EL1_S,
710        MISCREG_ICC_CTLR_EL1,
711        MISCREG_ICC_CTLR_EL1_NS,
712        MISCREG_ICC_CTLR_EL1_S,
713        MISCREG_ICC_SRE_EL1,
714        MISCREG_ICC_SRE_EL1_NS,
715        MISCREG_ICC_SRE_EL1_S,
716        MISCREG_ICC_IGRPEN0_EL1,
717        MISCREG_ICC_IGRPEN1_EL1,
718        MISCREG_ICC_IGRPEN1_EL1_NS,
719        MISCREG_ICC_IGRPEN1_EL1_S,
720        MISCREG_ICC_SRE_EL2,
721        MISCREG_ICC_CTLR_EL3,
722        MISCREG_ICC_SRE_EL3,
723        MISCREG_ICC_IGRPEN1_EL3,
724
725        // GICv3, CPU interface, virtualization
726        MISCREG_ICH_AP0R0_EL2,
727        MISCREG_ICH_AP0R1_EL2,
728        MISCREG_ICH_AP0R2_EL2,
729        MISCREG_ICH_AP0R3_EL2,
730        MISCREG_ICH_AP1R0_EL2,
731        MISCREG_ICH_AP1R1_EL2,
732        MISCREG_ICH_AP1R2_EL2,
733        MISCREG_ICH_AP1R3_EL2,
734        MISCREG_ICH_HCR_EL2,
735        MISCREG_ICH_VTR_EL2,
736        MISCREG_ICH_MISR_EL2,
737        MISCREG_ICH_EISR_EL2,
738        MISCREG_ICH_ELRSR_EL2,
739        MISCREG_ICH_VMCR_EL2,
740        MISCREG_ICH_LR0_EL2,
741        MISCREG_ICH_LR1_EL2,
742        MISCREG_ICH_LR2_EL2,
743        MISCREG_ICH_LR3_EL2,
744        MISCREG_ICH_LR4_EL2,
745        MISCREG_ICH_LR5_EL2,
746        MISCREG_ICH_LR6_EL2,
747        MISCREG_ICH_LR7_EL2,
748        MISCREG_ICH_LR8_EL2,
749        MISCREG_ICH_LR9_EL2,
750        MISCREG_ICH_LR10_EL2,
751        MISCREG_ICH_LR11_EL2,
752        MISCREG_ICH_LR12_EL2,
753        MISCREG_ICH_LR13_EL2,
754        MISCREG_ICH_LR14_EL2,
755        MISCREG_ICH_LR15_EL2,
756
757        MISCREG_ICV_PMR_EL1,
758        MISCREG_ICV_IAR0_EL1,
759        MISCREG_ICV_EOIR0_EL1,
760        MISCREG_ICV_HPPIR0_EL1,
761        MISCREG_ICV_BPR0_EL1,
762        MISCREG_ICV_AP0R0_EL1,
763        MISCREG_ICV_AP0R1_EL1,
764        MISCREG_ICV_AP0R2_EL1,
765        MISCREG_ICV_AP0R3_EL1,
766        MISCREG_ICV_AP1R0_EL1,
767        MISCREG_ICV_AP1R0_EL1_NS,
768        MISCREG_ICV_AP1R0_EL1_S,
769        MISCREG_ICV_AP1R1_EL1,
770        MISCREG_ICV_AP1R1_EL1_NS,
771        MISCREG_ICV_AP1R1_EL1_S,
772        MISCREG_ICV_AP1R2_EL1,
773        MISCREG_ICV_AP1R2_EL1_NS,
774        MISCREG_ICV_AP1R2_EL1_S,
775        MISCREG_ICV_AP1R3_EL1,
776        MISCREG_ICV_AP1R3_EL1_NS,
777        MISCREG_ICV_AP1R3_EL1_S,
778        MISCREG_ICV_DIR_EL1,
779        MISCREG_ICV_RPR_EL1,
780        MISCREG_ICV_SGI1R_EL1,
781        MISCREG_ICV_ASGI1R_EL1,
782        MISCREG_ICV_SGI0R_EL1,
783        MISCREG_ICV_IAR1_EL1,
784        MISCREG_ICV_EOIR1_EL1,
785        MISCREG_ICV_HPPIR1_EL1,
786        MISCREG_ICV_BPR1_EL1,
787        MISCREG_ICV_BPR1_EL1_NS,
788        MISCREG_ICV_BPR1_EL1_S,
789        MISCREG_ICV_CTLR_EL1,
790        MISCREG_ICV_CTLR_EL1_NS,
791        MISCREG_ICV_CTLR_EL1_S,
792        MISCREG_ICV_SRE_EL1,
793        MISCREG_ICV_SRE_EL1_NS,
794        MISCREG_ICV_SRE_EL1_S,
795        MISCREG_ICV_IGRPEN0_EL1,
796        MISCREG_ICV_IGRPEN1_EL1,
797        MISCREG_ICV_IGRPEN1_EL1_NS,
798        MISCREG_ICV_IGRPEN1_EL1_S,
799
800        MISCREG_ICC_AP0R0,
801        MISCREG_ICC_AP0R1,
802        MISCREG_ICC_AP0R2,
803        MISCREG_ICC_AP0R3,
804        MISCREG_ICC_AP1R0,
805        MISCREG_ICC_AP1R0_NS,
806        MISCREG_ICC_AP1R0_S,
807        MISCREG_ICC_AP1R1,
808        MISCREG_ICC_AP1R1_NS,
809        MISCREG_ICC_AP1R1_S,
810        MISCREG_ICC_AP1R2,
811        MISCREG_ICC_AP1R2_NS,
812        MISCREG_ICC_AP1R2_S,
813        MISCREG_ICC_AP1R3,
814        MISCREG_ICC_AP1R3_NS,
815        MISCREG_ICC_AP1R3_S,
816        MISCREG_ICC_ASGI1R,
817        MISCREG_ICC_BPR0,
818        MISCREG_ICC_BPR1,
819        MISCREG_ICC_BPR1_NS,
820        MISCREG_ICC_BPR1_S,
821        MISCREG_ICC_CTLR,
822        MISCREG_ICC_CTLR_NS,
823        MISCREG_ICC_CTLR_S,
824        MISCREG_ICC_DIR,
825        MISCREG_ICC_EOIR0,
826        MISCREG_ICC_EOIR1,
827        MISCREG_ICC_HPPIR0,
828        MISCREG_ICC_HPPIR1,
829        MISCREG_ICC_HSRE,
830        MISCREG_ICC_IAR0,
831        MISCREG_ICC_IAR1,
832        MISCREG_ICC_IGRPEN0,
833        MISCREG_ICC_IGRPEN1,
834        MISCREG_ICC_IGRPEN1_NS,
835        MISCREG_ICC_IGRPEN1_S,
836        MISCREG_ICC_MCTLR,
837        MISCREG_ICC_MGRPEN1,
838        MISCREG_ICC_MSRE,
839        MISCREG_ICC_PMR,
840        MISCREG_ICC_RPR,
841        MISCREG_ICC_SGI0R,
842        MISCREG_ICC_SGI1R,
843        MISCREG_ICC_SRE,
844        MISCREG_ICC_SRE_NS,
845        MISCREG_ICC_SRE_S,
846
847        MISCREG_ICH_AP0R0,
848        MISCREG_ICH_AP0R1,
849        MISCREG_ICH_AP0R2,
850        MISCREG_ICH_AP0R3,
851        MISCREG_ICH_AP1R0,
852        MISCREG_ICH_AP1R1,
853        MISCREG_ICH_AP1R2,
854        MISCREG_ICH_AP1R3,
855        MISCREG_ICH_HCR,
856        MISCREG_ICH_VTR,
857        MISCREG_ICH_MISR,
858        MISCREG_ICH_EISR,
859        MISCREG_ICH_ELRSR,
860        MISCREG_ICH_VMCR,
861        MISCREG_ICH_LR0,
862        MISCREG_ICH_LR1,
863        MISCREG_ICH_LR2,
864        MISCREG_ICH_LR3,
865        MISCREG_ICH_LR4,
866        MISCREG_ICH_LR5,
867        MISCREG_ICH_LR6,
868        MISCREG_ICH_LR7,
869        MISCREG_ICH_LR8,
870        MISCREG_ICH_LR9,
871        MISCREG_ICH_LR10,
872        MISCREG_ICH_LR11,
873        MISCREG_ICH_LR12,
874        MISCREG_ICH_LR13,
875        MISCREG_ICH_LR14,
876        MISCREG_ICH_LR15,
877        MISCREG_ICH_LRC0,
878        MISCREG_ICH_LRC1,
879        MISCREG_ICH_LRC2,
880        MISCREG_ICH_LRC3,
881        MISCREG_ICH_LRC4,
882        MISCREG_ICH_LRC5,
883        MISCREG_ICH_LRC6,
884        MISCREG_ICH_LRC7,
885        MISCREG_ICH_LRC8,
886        MISCREG_ICH_LRC9,
887        MISCREG_ICH_LRC10,
888        MISCREG_ICH_LRC11,
889        MISCREG_ICH_LRC12,
890        MISCREG_ICH_LRC13,
891        MISCREG_ICH_LRC14,
892        MISCREG_ICH_LRC15,
893
894        // SVE
895        MISCREG_ID_AA64ZFR0_EL1,
896        MISCREG_ZCR_EL3,
897        MISCREG_ZCR_EL2,
898        MISCREG_ZCR_EL12,
899        MISCREG_ZCR_EL1,
900
901        // NUM_PHYS_MISCREGS specifies the number of actual physical
902        // registers, not considering the following pseudo-registers
903        // (dummy registers), like UNKNOWN, CP15_UNIMPL, MISCREG_IMPDEF_UNIMPL.
904        // Checkpointing should use this physical index when
905        // saving/restoring register values.
906        NUM_PHYS_MISCREGS,
907
908        // Dummy registers
909        MISCREG_NOP,
910        MISCREG_RAZ,
911        MISCREG_CP14_UNIMPL,
912        MISCREG_CP15_UNIMPL,
913        MISCREG_UNKNOWN,
914
915        // Implementation defined register: this represent
916        // a pool of unimplemented registers whose access can throw
917        // either UNDEFINED or hypervisor trap exception.
918        MISCREG_IMPDEF_UNIMPL,
919
920        // RAS extension (unimplemented)
921        MISCREG_ERRIDR_EL1,
922        MISCREG_ERRSELR_EL1,
923        MISCREG_ERXFR_EL1,
924        MISCREG_ERXCTLR_EL1,
925        MISCREG_ERXSTATUS_EL1,
926        MISCREG_ERXADDR_EL1,
927        MISCREG_ERXMISC0_EL1,
928        MISCREG_ERXMISC1_EL1,
929        MISCREG_DISR_EL1,
930        MISCREG_VSESR_EL2,
931        MISCREG_VDISR_EL2,
932
933        // Total number of Misc Registers: Physical + Dummy
934        NUM_MISCREGS
935    };
936
937    enum MiscRegInfo {
938        MISCREG_IMPLEMENTED,
939        MISCREG_UNVERIFIABLE,   // Does the value change on every read (e.g. a
940                                // arch generic counter)
941        MISCREG_WARN_NOT_FAIL,  // If MISCREG_IMPLEMENTED is deasserted, it
942                                // tells whether the instruction should raise a
943                                // warning or fail
944        MISCREG_MUTEX,  // True if the register corresponds to a pair of
945                        // mutually exclusive registers
946        MISCREG_BANKED,  // True if the register is banked between the two
947                         // security states, and this is the parent node of the
948                         // two banked registers
949        MISCREG_BANKED_CHILD, // The entry is one of the child registers that
950                              // forms a banked set of regs (along with the
951                              // other child regs)
952
953        // Access permissions
954        // User mode
955        MISCREG_USR_NS_RD,
956        MISCREG_USR_NS_WR,
957        MISCREG_USR_S_RD,
958        MISCREG_USR_S_WR,
959        // Privileged modes other than hypervisor or monitor
960        MISCREG_PRI_NS_RD,
961        MISCREG_PRI_NS_WR,
962        MISCREG_PRI_S_RD,
963        MISCREG_PRI_S_WR,
964        // Hypervisor mode
965        MISCREG_HYP_RD,
966        MISCREG_HYP_WR,
967        // Monitor mode, SCR.NS == 0
968        MISCREG_MON_NS0_RD,
969        MISCREG_MON_NS0_WR,
970        // Monitor mode, SCR.NS == 1
971        MISCREG_MON_NS1_RD,
972        MISCREG_MON_NS1_WR,
973
974        NUM_MISCREG_INFOS
975    };
976
977    extern std::bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS];
978
979    // Decodes 32-bit CP14 registers accessible through MCR/MRC instructions
980    MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1,
981                               unsigned crm, unsigned opc2);
982    MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1,
983                                     unsigned crn, unsigned crm,
984                                     unsigned op2);
985    // Whether a particular AArch64 system register is -always- read only.
986    bool aarch64SysRegReadOnly(MiscRegIndex miscReg);
987
988    // Decodes 32-bit CP15 registers accessible through MCR/MRC instructions
989    MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
990                               unsigned crm, unsigned opc2);
991
992    // Decodes 64-bit CP15 registers accessible through MCRR/MRRC instructions
993    MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1);
994
995
996    const char * const miscRegName[] = {
997        "cpsr",
998        "spsr",
999        "spsr_fiq",
1000        "spsr_irq",
1001        "spsr_svc",
1002        "spsr_mon",
1003        "spsr_abt",
1004        "spsr_hyp",
1005        "spsr_und",
1006        "elr_hyp",
1007        "fpsid",
1008        "fpscr",
1009        "mvfr1",
1010        "mvfr0",
1011        "fpexc",
1012
1013        // Helper registers
1014        "cpsr_mode",
1015        "cpsr_q",
1016        "fpscr_exc",
1017        "fpscr_qc",
1018        "lockaddr",
1019        "lockflag",
1020        "prrr_mair0",
1021        "prrr_mair0_ns",
1022        "prrr_mair0_s",
1023        "nmrr_mair1",
1024        "nmrr_mair1_ns",
1025        "nmrr_mair1_s",
1026        "pmxevtyper_pmccfiltr",
1027        "sctlr_rst",
1028        "sev_mailbox",
1029
1030        // AArch32 CP14 registers
1031        "dbgdidr",
1032        "dbgdscrint",
1033        "dbgdccint",
1034        "dbgdtrtxint",
1035        "dbgdtrrxint",
1036        "dbgwfar",
1037        "dbgvcr",
1038        "dbgdtrrxext",
1039        "dbgdscrext",
1040        "dbgdtrtxext",
1041        "dbgoseccr",
1042        "dbgbvr0",
1043        "dbgbvr1",
1044        "dbgbvr2",
1045        "dbgbvr3",
1046        "dbgbvr4",
1047        "dbgbvr5",
1048        "dbgbcr0",
1049        "dbgbcr1",
1050        "dbgbcr2",
1051        "dbgbcr3",
1052        "dbgbcr4",
1053        "dbgbcr5",
1054        "dbgwvr0",
1055        "dbgwvr1",
1056        "dbgwvr2",
1057        "dbgwvr3",
1058        "dbgwcr0",
1059        "dbgwcr1",
1060        "dbgwcr2",
1061        "dbgwcr3",
1062        "dbgdrar",
1063        "dbgbxvr4",
1064        "dbgbxvr5",
1065        "dbgoslar",
1066        "dbgoslsr",
1067        "dbgosdlr",
1068        "dbgprcr",
1069        "dbgdsar",
1070        "dbgclaimset",
1071        "dbgclaimclr",
1072        "dbgauthstatus",
1073        "dbgdevid2",
1074        "dbgdevid1",
1075        "dbgdevid0",
1076        "teecr",
1077        "jidr",
1078        "teehbr",
1079        "joscr",
1080        "jmcr",
1081
1082        // AArch32 CP15 registers
1083        "midr",
1084        "ctr",
1085        "tcmtr",
1086        "tlbtr",
1087        "mpidr",
1088        "revidr",
1089        "id_pfr0",
1090        "id_pfr1",
1091        "id_dfr0",
1092        "id_afr0",
1093        "id_mmfr0",
1094        "id_mmfr1",
1095        "id_mmfr2",
1096        "id_mmfr3",
1097        "id_isar0",
1098        "id_isar1",
1099        "id_isar2",
1100        "id_isar3",
1101        "id_isar4",
1102        "id_isar5",
1103        "ccsidr",
1104        "clidr",
1105        "aidr",
1106        "csselr",
1107        "csselr_ns",
1108        "csselr_s",
1109        "vpidr",
1110        "vmpidr",
1111        "sctlr",
1112        "sctlr_ns",
1113        "sctlr_s",
1114        "actlr",
1115        "actlr_ns",
1116        "actlr_s",
1117        "cpacr",
1118        "scr",
1119        "sder",
1120        "nsacr",
1121        "hsctlr",
1122        "hactlr",
1123        "hcr",
1124        "hdcr",
1125        "hcptr",
1126        "hstr",
1127        "hacr",
1128        "ttbr0",
1129        "ttbr0_ns",
1130        "ttbr0_s",
1131        "ttbr1",
1132        "ttbr1_ns",
1133        "ttbr1_s",
1134        "ttbcr",
1135        "ttbcr_ns",
1136        "ttbcr_s",
1137        "htcr",
1138        "vtcr",
1139        "dacr",
1140        "dacr_ns",
1141        "dacr_s",
1142        "dfsr",
1143        "dfsr_ns",
1144        "dfsr_s",
1145        "ifsr",
1146        "ifsr_ns",
1147        "ifsr_s",
1148        "adfsr",
1149        "adfsr_ns",
1150        "adfsr_s",
1151        "aifsr",
1152        "aifsr_ns",
1153        "aifsr_s",
1154        "hadfsr",
1155        "haifsr",
1156        "hsr",
1157        "dfar",
1158        "dfar_ns",
1159        "dfar_s",
1160        "ifar",
1161        "ifar_ns",
1162        "ifar_s",
1163        "hdfar",
1164        "hifar",
1165        "hpfar",
1166        "icialluis",
1167        "bpiallis",
1168        "par",
1169        "par_ns",
1170        "par_s",
1171        "iciallu",
1172        "icimvau",
1173        "cp15isb",
1174        "bpiall",
1175        "bpimva",
1176        "dcimvac",
1177        "dcisw",
1178        "ats1cpr",
1179        "ats1cpw",
1180        "ats1cur",
1181        "ats1cuw",
1182        "ats12nsopr",
1183        "ats12nsopw",
1184        "ats12nsour",
1185        "ats12nsouw",
1186        "dccmvac",
1187        "dccsw",
1188        "cp15dsb",
1189        "cp15dmb",
1190        "dccmvau",
1191        "dccimvac",
1192        "dccisw",
1193        "ats1hr",
1194        "ats1hw",
1195        "tlbiallis",
1196        "tlbimvais",
1197        "tlbiasidis",
1198        "tlbimvaais",
1199        "tlbimvalis",
1200        "tlbimvaalis",
1201        "itlbiall",
1202        "itlbimva",
1203        "itlbiasid",
1204        "dtlbiall",
1205        "dtlbimva",
1206        "dtlbiasid",
1207        "tlbiall",
1208        "tlbimva",
1209        "tlbiasid",
1210        "tlbimvaa",
1211        "tlbimval",
1212        "tlbimvaal",
1213        "tlbiipas2is",
1214        "tlbiipas2lis",
1215        "tlbiallhis",
1216        "tlbimvahis",
1217        "tlbiallnsnhis",
1218        "tlbimvalhis",
1219        "tlbiipas2",
1220        "tlbiipas2l",
1221        "tlbiallh",
1222        "tlbimvah",
1223        "tlbiallnsnh",
1224        "tlbimvalh",
1225        "pmcr",
1226        "pmcntenset",
1227        "pmcntenclr",
1228        "pmovsr",
1229        "pmswinc",
1230        "pmselr",
1231        "pmceid0",
1232        "pmceid1",
1233        "pmccntr",
1234        "pmxevtyper",
1235        "pmccfiltr",
1236        "pmxevcntr",
1237        "pmuserenr",
1238        "pmintenset",
1239        "pmintenclr",
1240        "pmovsset",
1241        "l2ctlr",
1242        "l2ectlr",
1243        "prrr",
1244        "prrr_ns",
1245        "prrr_s",
1246        "mair0",
1247        "mair0_ns",
1248        "mair0_s",
1249        "nmrr",
1250        "nmrr_ns",
1251        "nmrr_s",
1252        "mair1",
1253        "mair1_ns",
1254        "mair1_s",
1255        "amair0",
1256        "amair0_ns",
1257        "amair0_s",
1258        "amair1",
1259        "amair1_ns",
1260        "amair1_s",
1261        "hmair0",
1262        "hmair1",
1263        "hamair0",
1264        "hamair1",
1265        "vbar",
1266        "vbar_ns",
1267        "vbar_s",
1268        "mvbar",
1269        "rmr",
1270        "isr",
1271        "hvbar",
1272        "fcseidr",
1273        "contextidr",
1274        "contextidr_ns",
1275        "contextidr_s",
1276        "tpidrurw",
1277        "tpidrurw_ns",
1278        "tpidrurw_s",
1279        "tpidruro",
1280        "tpidruro_ns",
1281        "tpidruro_s",
1282        "tpidrprw",
1283        "tpidrprw_ns",
1284        "tpidrprw_s",
1285        "htpidr",
1286        "cntfrq",
1287        "cntkctl",
1288        "cntp_tval",
1289        "cntp_tval_ns",
1290        "cntp_tval_s",
1291        "cntp_ctl",
1292        "cntp_ctl_ns",
1293        "cntp_ctl_s",
1294        "cntv_tval",
1295        "cntv_ctl",
1296        "cnthctl",
1297        "cnthp_tval",
1298        "cnthp_ctl",
1299        "il1data0",
1300        "il1data1",
1301        "il1data2",
1302        "il1data3",
1303        "dl1data0",
1304        "dl1data1",
1305        "dl1data2",
1306        "dl1data3",
1307        "dl1data4",
1308        "ramindex",
1309        "l2actlr",
1310        "cbar",
1311        "httbr",
1312        "vttbr",
1313        "cntpct",
1314        "cntvct",
1315        "cntp_cval",
1316        "cntp_cval_ns",
1317        "cntp_cval_s",
1318        "cntv_cval",
1319        "cntvoff",
1320        "cnthp_cval",
1321        "cpumerrsr",
1322        "l2merrsr",
1323
1324        // AArch64 registers (Op0=2)
1325        "mdccint_el1",
1326        "osdtrrx_el1",
1327        "mdscr_el1",
1328        "osdtrtx_el1",
1329        "oseccr_el1",
1330        "dbgbvr0_el1",
1331        "dbgbvr1_el1",
1332        "dbgbvr2_el1",
1333        "dbgbvr3_el1",
1334        "dbgbvr4_el1",
1335        "dbgbvr5_el1",
1336        "dbgbcr0_el1",
1337        "dbgbcr1_el1",
1338        "dbgbcr2_el1",
1339        "dbgbcr3_el1",
1340        "dbgbcr4_el1",
1341        "dbgbcr5_el1",
1342        "dbgwvr0_el1",
1343        "dbgwvr1_el1",
1344        "dbgwvr2_el1",
1345        "dbgwvr3_el1",
1346        "dbgwcr0_el1",
1347        "dbgwcr1_el1",
1348        "dbgwcr2_el1",
1349        "dbgwcr3_el1",
1350        "mdccsr_el0",
1351        "mddtr_el0",
1352        "mddtrtx_el0",
1353        "mddtrrx_el0",
1354        "dbgvcr32_el2",
1355        "mdrar_el1",
1356        "oslar_el1",
1357        "oslsr_el1",
1358        "osdlr_el1",
1359        "dbgprcr_el1",
1360        "dbgclaimset_el1",
1361        "dbgclaimclr_el1",
1362        "dbgauthstatus_el1",
1363        "teecr32_el1",
1364        "teehbr32_el1",
1365
1366        // AArch64 registers (Op0=1,3)
1367        "midr_el1",
1368        "mpidr_el1",
1369        "revidr_el1",
1370        "id_pfr0_el1",
1371        "id_pfr1_el1",
1372        "id_dfr0_el1",
1373        "id_afr0_el1",
1374        "id_mmfr0_el1",
1375        "id_mmfr1_el1",
1376        "id_mmfr2_el1",
1377        "id_mmfr3_el1",
1378        "id_isar0_el1",
1379        "id_isar1_el1",
1380        "id_isar2_el1",
1381        "id_isar3_el1",
1382        "id_isar4_el1",
1383        "id_isar5_el1",
1384        "mvfr0_el1",
1385        "mvfr1_el1",
1386        "mvfr2_el1",
1387        "id_aa64pfr0_el1",
1388        "id_aa64pfr1_el1",
1389        "id_aa64dfr0_el1",
1390        "id_aa64dfr1_el1",
1391        "id_aa64afr0_el1",
1392        "id_aa64afr1_el1",
1393        "id_aa64isar0_el1",
1394        "id_aa64isar1_el1",
1395        "id_aa64mmfr0_el1",
1396        "id_aa64mmfr1_el1",
1397        "ccsidr_el1",
1398        "clidr_el1",
1399        "aidr_el1",
1400        "csselr_el1",
1401        "ctr_el0",
1402        "dczid_el0",
1403        "vpidr_el2",
1404        "vmpidr_el2",
1405        "sctlr_el1",
1406        "actlr_el1",
1407        "cpacr_el1",
1408        "sctlr_el2",
1409        "actlr_el2",
1410        "hcr_el2",
1411        "mdcr_el2",
1412        "cptr_el2",
1413        "hstr_el2",
1414        "hacr_el2",
1415        "sctlr_el3",
1416        "actlr_el3",
1417        "scr_el3",
1418        "sder32_el3",
1419        "cptr_el3",
1420        "mdcr_el3",
1421        "ttbr0_el1",
1422        "ttbr1_el1",
1423        "tcr_el1",
1424        "ttbr0_el2",
1425        "tcr_el2",
1426        "vttbr_el2",
1427        "vtcr_el2",
1428        "ttbr0_el3",
1429        "tcr_el3",
1430        "dacr32_el2",
1431        "spsr_el1",
1432        "elr_el1",
1433        "sp_el0",
1434        "spsel",
1435        "currentel",
1436        "nzcv",
1437        "daif",
1438        "fpcr",
1439        "fpsr",
1440        "dspsr_el0",
1441        "dlr_el0",
1442        "spsr_el2",
1443        "elr_el2",
1444        "sp_el1",
1445        "spsr_irq_aa64",
1446        "spsr_abt_aa64",
1447        "spsr_und_aa64",
1448        "spsr_fiq_aa64",
1449        "spsr_el3",
1450        "elr_el3",
1451        "sp_el2",
1452        "afsr0_el1",
1453        "afsr1_el1",
1454        "esr_el1",
1455        "ifsr32_el2",
1456        "afsr0_el2",
1457        "afsr1_el2",
1458        "esr_el2",
1459        "fpexc32_el2",
1460        "afsr0_el3",
1461        "afsr1_el3",
1462        "esr_el3",
1463        "far_el1",
1464        "far_el2",
1465        "hpfar_el2",
1466        "far_el3",
1467        "ic_ialluis",
1468        "par_el1",
1469        "ic_iallu",
1470        "dc_ivac_xt",
1471        "dc_isw_xt",
1472        "at_s1e1r_xt",
1473        "at_s1e1w_xt",
1474        "at_s1e0r_xt",
1475        "at_s1e0w_xt",
1476        "dc_csw_xt",
1477        "dc_cisw_xt",
1478        "dc_zva_xt",
1479        "ic_ivau_xt",
1480        "dc_cvac_xt",
1481        "dc_cvau_xt",
1482        "dc_civac_xt",
1483        "at_s1e2r_xt",
1484        "at_s1e2w_xt",
1485        "at_s12e1r_xt",
1486        "at_s12e1w_xt",
1487        "at_s12e0r_xt",
1488        "at_s12e0w_xt",
1489        "at_s1e3r_xt",
1490        "at_s1e3w_xt",
1491        "tlbi_vmalle1is",
1492        "tlbi_vae1is_xt",
1493        "tlbi_aside1is_xt",
1494        "tlbi_vaae1is_xt",
1495        "tlbi_vale1is_xt",
1496        "tlbi_vaale1is_xt",
1497        "tlbi_vmalle1",
1498        "tlbi_vae1_xt",
1499        "tlbi_aside1_xt",
1500        "tlbi_vaae1_xt",
1501        "tlbi_vale1_xt",
1502        "tlbi_vaale1_xt",
1503        "tlbi_ipas2e1is_xt",
1504        "tlbi_ipas2le1is_xt",
1505        "tlbi_alle2is",
1506        "tlbi_vae2is_xt",
1507        "tlbi_alle1is",
1508        "tlbi_vale2is_xt",
1509        "tlbi_vmalls12e1is",
1510        "tlbi_ipas2e1_xt",
1511        "tlbi_ipas2le1_xt",
1512        "tlbi_alle2",
1513        "tlbi_vae2_xt",
1514        "tlbi_alle1",
1515        "tlbi_vale2_xt",
1516        "tlbi_vmalls12e1",
1517        "tlbi_alle3is",
1518        "tlbi_vae3is_xt",
1519        "tlbi_vale3is_xt",
1520        "tlbi_alle3",
1521        "tlbi_vae3_xt",
1522        "tlbi_vale3_xt",
1523        "pmintenset_el1",
1524        "pmintenclr_el1",
1525        "pmcr_el0",
1526        "pmcntenset_el0",
1527        "pmcntenclr_el0",
1528        "pmovsclr_el0",
1529        "pmswinc_el0",
1530        "pmselr_el0",
1531        "pmceid0_el0",
1532        "pmceid1_el0",
1533        "pmccntr_el0",
1534        "pmxevtyper_el0",
1535        "pmccfiltr_el0",
1536        "pmxevcntr_el0",
1537        "pmuserenr_el0",
1538        "pmovsset_el0",
1539        "mair_el1",
1540        "amair_el1",
1541        "mair_el2",
1542        "amair_el2",
1543        "mair_el3",
1544        "amair_el3",
1545        "l2ctlr_el1",
1546        "l2ectlr_el1",
1547        "vbar_el1",
1548        "rvbar_el1",
1549        "isr_el1",
1550        "vbar_el2",
1551        "rvbar_el2",
1552        "vbar_el3",
1553        "rvbar_el3",
1554        "rmr_el3",
1555        "contextidr_el1",
1556        "tpidr_el1",
1557        "tpidr_el0",
1558        "tpidrro_el0",
1559        "tpidr_el2",
1560        "tpidr_el3",
1561        "cntkctl_el1",
1562        "cntfrq_el0",
1563        "cntpct_el0",
1564        "cntvct_el0",
1565        "cntp_tval_el0",
1566        "cntp_ctl_el0",
1567        "cntp_cval_el0",
1568        "cntv_tval_el0",
1569        "cntv_ctl_el0",
1570        "cntv_cval_el0",
1571        "pmevcntr0_el0",
1572        "pmevcntr1_el0",
1573        "pmevcntr2_el0",
1574        "pmevcntr3_el0",
1575        "pmevcntr4_el0",
1576        "pmevcntr5_el0",
1577        "pmevtyper0_el0",
1578        "pmevtyper1_el0",
1579        "pmevtyper2_el0",
1580        "pmevtyper3_el0",
1581        "pmevtyper4_el0",
1582        "pmevtyper5_el0",
1583        "cntvoff_el2",
1584        "cnthctl_el2",
1585        "cnthp_tval_el2",
1586        "cnthp_ctl_el2",
1587        "cnthp_cval_el2",
1588        "cntps_tval_el1",
1589        "cntps_ctl_el1",
1590        "cntps_cval_el1",
1591        "il1data0_el1",
1592        "il1data1_el1",
1593        "il1data2_el1",
1594        "il1data3_el1",
1595        "dl1data0_el1",
1596        "dl1data1_el1",
1597        "dl1data2_el1",
1598        "dl1data3_el1",
1599        "dl1data4_el1",
1600        "l2actlr_el1",
1601        "cpuactlr_el1",
1602        "cpuectlr_el1",
1603        "cpumerrsr_el1",
1604        "l2merrsr_el1",
1605        "cbar_el1",
1606        "contextidr_el2",
1607
1608        "ttbr1_el2",
1609        "cnthv_ctl_el2",
1610        "cnthv_cval_el2",
1611        "cnthv_tval_el2",
1612        "id_aa64mmfr2_el1",
1613
1614        // GICv3, CPU interface
1615        "icc_pmr_el1",
1616        "icc_iar0_el1",
1617        "icc_eoir0_el1",
1618        "icc_hppir0_el1",
1619        "icc_bpr0_el1",
1620        "icc_ap0r0_el1",
1621        "icc_ap0r1_el1",
1622        "icc_ap0r2_el1",
1623        "icc_ap0r3_el1",
1624        "icc_ap1r0_el1",
1625        "icc_ap1r0_el1_ns",
1626        "icc_ap1r0_el1_s",
1627        "icc_ap1r1_el1",
1628        "icc_ap1r1_el1_ns",
1629        "icc_ap1r1_el1_s",
1630        "icc_ap1r2_el1",
1631        "icc_ap1r2_el1_ns",
1632        "icc_ap1r2_el1_s",
1633        "icc_ap1r3_el1",
1634        "icc_ap1r3_el1_ns",
1635        "icc_ap1r3_el1_s",
1636        "icc_dir_el1",
1637        "icc_rpr_el1",
1638        "icc_sgi1r_el1",
1639        "icc_asgi1r_el1",
1640        "icc_sgi0r_el1",
1641        "icc_iar1_el1",
1642        "icc_eoir1_el1",
1643        "icc_hppir1_el1",
1644        "icc_bpr1_el1",
1645        "icc_bpr1_el1_ns",
1646        "icc_bpr1_el1_s",
1647        "icc_ctlr_el1",
1648        "icc_ctlr_el1_ns",
1649        "icc_ctlr_el1_s",
1650        "icc_sre_el1",
1651        "icc_sre_el1_ns",
1652        "icc_sre_el1_s",
1653        "icc_igrpen0_el1",
1654        "icc_igrpen1_el1",
1655        "icc_igrpen1_el1_ns",
1656        "icc_igrpen1_el1_s",
1657        "icc_sre_el2",
1658        "icc_ctlr_el3",
1659        "icc_sre_el3",
1660        "icc_igrpen1_el3",
1661
1662        // GICv3, CPU interface, virtualization
1663        "ich_ap0r0_el2",
1664        "ich_ap0r1_el2",
1665        "ich_ap0r2_el2",
1666        "ich_ap0r3_el2",
1667        "ich_ap1r0_el2",
1668        "ich_ap1r1_el2",
1669        "ich_ap1r2_el2",
1670        "ich_ap1r3_el2",
1671        "ich_hcr_el2",
1672        "ich_vtr_el2",
1673        "ich_misr_el2",
1674        "ich_eisr_el2",
1675        "ich_elrsr_el2",
1676        "ich_vmcr_el2",
1677        "ich_lr0_el2",
1678        "ich_lr1_el2",
1679        "ich_lr2_el2",
1680        "ich_lr3_el2",
1681        "ich_lr4_el2",
1682        "ich_lr5_el2",
1683        "ich_lr6_el2",
1684        "ich_lr7_el2",
1685        "ich_lr8_el2",
1686        "ich_lr9_el2",
1687        "ich_lr10_el2",
1688        "ich_lr11_el2",
1689        "ich_lr12_el2",
1690        "ich_lr13_el2",
1691        "ich_lr14_el2",
1692        "ich_lr15_el2",
1693
1694        "icv_pmr_el1",
1695        "icv_iar0_el1",
1696        "icv_eoir0_el1",
1697        "icv_hppir0_el1",
1698        "icv_bpr0_el1",
1699        "icv_ap0r0_el1",
1700        "icv_ap0r1_el1",
1701        "icv_ap0r2_el1",
1702        "icv_ap0r3_el1",
1703        "icv_ap1r0_el1",
1704        "icv_ap1r0_el1_ns",
1705        "icv_ap1r0_el1_s",
1706        "icv_ap1r1_el1",
1707        "icv_ap1r1_el1_ns",
1708        "icv_ap1r1_el1_s",
1709        "icv_ap1r2_el1",
1710        "icv_ap1r2_el1_ns",
1711        "icv_ap1r2_el1_s",
1712        "icv_ap1r3_el1",
1713        "icv_ap1r3_el1_ns",
1714        "icv_ap1r3_el1_s",
1715        "icv_dir_el1",
1716        "icv_rpr_el1",
1717        "icv_sgi1r_el1",
1718        "icv_asgi1r_el1",
1719        "icv_sgi0r_el1",
1720        "icv_iar1_el1",
1721        "icv_eoir1_el1",
1722        "icv_hppir1_el1",
1723        "icv_bpr1_el1",
1724        "icv_bpr1_el1_ns",
1725        "icv_bpr1_el1_s",
1726        "icv_ctlr_el1",
1727        "icv_ctlr_el1_ns",
1728        "icv_ctlr_el1_s",
1729        "icv_sre_el1",
1730        "icv_sre_el1_ns",
1731        "icv_sre_el1_s",
1732        "icv_igrpen0_el1",
1733        "icv_igrpen1_el1",
1734        "icv_igrpen1_el1_ns",
1735        "icv_igrpen1_el1_s",
1736
1737        "icc_ap0r0",
1738        "icc_ap0r1",
1739        "icc_ap0r2",
1740        "icc_ap0r3",
1741        "icc_ap1r0",
1742        "icc_ap1r0_ns",
1743        "icc_ap1r0_s",
1744        "icc_ap1r1",
1745        "icc_ap1r1_ns",
1746        "icc_ap1r1_s",
1747        "icc_ap1r2",
1748        "icc_ap1r2_ns",
1749        "icc_ap1r2_s",
1750        "icc_ap1r3",
1751        "icc_ap1r3_ns",
1752        "icc_ap1r3_s",
1753        "icc_asgi1r",
1754        "icc_bpr0",
1755        "icc_bpr1",
1756        "icc_bpr1_ns",
1757        "icc_bpr1_s",
1758        "icc_ctlr",
1759        "icc_ctlr_ns",
1760        "icc_ctlr_s",
1761        "icc_dir",
1762        "icc_eoir0",
1763        "icc_eoir1",
1764        "icc_hppir0",
1765        "icc_hppir1",
1766        "icc_hsre",
1767        "icc_iar0",
1768        "icc_iar1",
1769        "icc_igrpen0",
1770        "icc_igrpen1",
1771        "icc_igrpen1_ns",
1772        "icc_igrpen1_s",
1773        "icc_mctlr",
1774        "icc_mgrpen1",
1775        "icc_msre",
1776        "icc_pmr",
1777        "icc_rpr",
1778        "icc_sgi0r",
1779        "icc_sgi1r",
1780        "icc_sre",
1781        "icc_sre_ns",
1782        "icc_sre_s",
1783
1784        "ich_ap0r0",
1785        "ich_ap0r1",
1786        "ich_ap0r2",
1787        "ich_ap0r3",
1788        "ich_ap1r0",
1789        "ich_ap1r1",
1790        "ich_ap1r2",
1791        "ich_ap1r3",
1792        "ich_hcr",
1793        "ich_vtr",
1794        "ich_misr",
1795        "ich_eisr",
1796        "ich_elrsr",
1797        "ich_vmcr",
1798        "ich_lr0",
1799        "ich_lr1",
1800        "ich_lr2",
1801        "ich_lr3",
1802        "ich_lr4",
1803        "ich_lr5",
1804        "ich_lr6",
1805        "ich_lr7",
1806        "ich_lr8",
1807        "ich_lr9",
1808        "ich_lr10",
1809        "ich_lr11",
1810        "ich_lr12",
1811        "ich_lr13",
1812        "ich_lr14",
1813        "ich_lr15",
1814        "ich_lrc0",
1815        "ich_lrc1",
1816        "ich_lrc2",
1817        "ich_lrc3",
1818        "ich_lrc4",
1819        "ich_lrc5",
1820        "ich_lrc6",
1821        "ich_lrc7",
1822        "ich_lrc8",
1823        "ich_lrc9",
1824        "ich_lrc10",
1825        "ich_lrc11",
1826        "ich_lrc12",
1827        "ich_lrc13",
1828        "ich_lrc14",
1829        "ich_lrc15",
1830
1831        "id_aa64zfr0_el1",
1832        "zcr_el3",
1833        "zcr_el2",
1834        "zcr_el12",
1835        "zcr_el1",
1836
1837        "num_phys_regs",
1838
1839        // Dummy registers
1840        "nop",
1841        "raz",
1842        "cp14_unimpl",
1843        "cp15_unimpl",
1844        "unknown",
1845        "impl_defined",
1846        "erridr_el1",
1847        "errselr_el1",
1848        "erxfr_el1",
1849        "erxctlr_el1",
1850        "erxstatus_el1",
1851        "erxaddr_el1",
1852        "erxmisc0_el1",
1853        "erxmisc1_el1",
1854        "disr_el1",
1855        "vsesr_el2",
1856        "vdisr_el2",
1857    };
1858
1859    static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
1860                  "The miscRegName array and NUM_MISCREGS are inconsistent.");
1861
1862    // This mask selects bits of the CPSR that actually go in the CondCodes
1863    // integer register to allow renaming.
1864    static const uint32_t CondCodesMask   = 0xF00F0000;
1865    static const uint32_t CpsrMaskQ       = 0x08000000;
1866
1867    // APSR (Application Program Status Register Mask). It is the user level
1868    // alias for the CPSR. The APSR is a subset of the CPSR. Although
1869    // bits[15:0] are UNKNOWN on reads, it is permitted that, on a read of
1870    // APSR:
1871    // Bit[9] returns the value of CPSR.E.
1872    // Bits[8:6] return the value of CPSR.{A,I, F}, the mask bits.
1873    static const uint32_t ApsrMask = CpsrMaskQ | CondCodesMask | 0x000001D0;
1874
1875    // CPSR (Current Program Status Register Mask).
1876    static const uint32_t CpsrMask = ApsrMask | 0x00F003DF;
1877
1878    // This mask selects bits of the FPSCR that actually go in the FpCondCodes
1879    // integer register to allow renaming.
1880    static const uint32_t FpCondCodesMask = 0xF0000000;
1881    // This mask selects the cumulative FP exception flags of the FPSCR.
1882    static const uint32_t FpscrExcMask = 0x0000009F;
1883    // This mask selects the cumulative saturation flag of the FPSCR.
1884    static const uint32_t FpscrQcMask = 0x08000000;
1885
1886    /**
1887     * Check for permission to read coprocessor registers.
1888     *
1889     * Checks whether an instruction at the current program mode has
1890     * permissions to read the coprocessor registers. This function
1891     * returns whether the check is undefined and if not whether the
1892     * read access is permitted.
1893     *
1894     * @param the misc reg indicating the coprocessor
1895     * @param the SCR
1896     * @param the CPSR
1897     * @return a tuple of booleans: can_read, undefined
1898     */
1899    std::tuple<bool, bool> canReadCoprocReg(MiscRegIndex reg, SCR scr,
1900                                           CPSR cpsr);
1901
1902    /**
1903     * Check for permission to write coprocessor registers.
1904     *
1905     * Checks whether an instruction at the current program mode has
1906     * permissions to write the coprocessor registers. This function
1907     * returns whether the check is undefined and if not whether the
1908     * write access is permitted.
1909     *
1910     * @param the misc reg indicating the coprocessor
1911     * @param the SCR
1912     * @param the CPSR
1913     * @return a tuple of booleans: can_write, undefined
1914     */
1915    std::tuple<bool, bool> canWriteCoprocReg(MiscRegIndex reg, SCR scr,
1916                                             CPSR cpsr);
1917
1918    // Checks read access permissions to AArch64 system registers
1919    bool canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1920                              ThreadContext *tc);
1921
1922    // Checks write access permissions to AArch64 system registers
1923    bool canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr,
1924                               ThreadContext *tc);
1925
1926    // Uses just the scr.ns bit to pre flatten the misc regs. This is useful
1927    // for MCR/MRC instructions
1928    int
1929    snsBankedIndex(MiscRegIndex reg, ThreadContext *tc);
1930
1931    // Flattens a misc reg index using the specified security state. This is
1932    // used for opperations (eg address translations) where the security
1933    // state of the register access may differ from the current state of the
1934    // processor
1935    int
1936    snsBankedIndex(MiscRegIndex reg, ThreadContext *tc, bool ns);
1937
1938    // Takes a misc reg index and returns the root reg if its one of a set of
1939    // banked registers
1940    void
1941    preUnflattenMiscReg();
1942
1943    int
1944    unflattenMiscReg(int reg);
1945
1946}
1947
1948#endif // __ARCH_ARM_MISCREGS_HH__
1949