2 * Copyright (c) 2010-2020 ARM Limited
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.
14 * Copyright (c) 2009 The Regents of The University of Michigan
15 * All rights reserved.
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.
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.
41 #ifndef __ARCH_ARM_MISCREGS_HH__
42 #define __ARCH_ARM_MISCREGS_HH__
47 #include "arch/arm/miscregs_types.hh"
48 #include "base/compiler.hh"
49 #include "dev/arm/generic_timer_miscregs_types.hh"
81 MISCREG_PRRR_MAIR0_NS,
84 MISCREG_NMRR_MAIR1_NS,
86 MISCREG_PMXEVTYPER_PMCCFILTR,
90 // AArch32 CP14 registers (debug/trace/ThumbEE/Jazelle control)
190 MISCREG_DBGAUTHSTATUS,
194 MISCREG_TEECR, // not in ARM DDI 0487A.b+
196 MISCREG_TEEHBR, // not in ARM DDI 0487A.b+
200 // AArch32 CP15 registers (system control)
334 MISCREG_TLBIIPAS2LIS,
337 MISCREG_TLBIALLNSNHIS,
394 MISCREG_CONTEXTIDR_NS,
395 MISCREG_CONTEXTIDR_S,
406 // BEGIN Generic Timer (AArch32)
414 MISCREG_CNTP_CVAL_NS,
417 MISCREG_CNTP_TVAL_NS,
428 // END Generic Timer (AArch32)
446 // AArch64 registers (Op0=2)
462 MISCREG_DBGBVR10_EL1,
463 MISCREG_DBGBVR11_EL1,
464 MISCREG_DBGBVR12_EL1,
465 MISCREG_DBGBVR13_EL1,
466 MISCREG_DBGBVR14_EL1,
467 MISCREG_DBGBVR15_EL1,
478 MISCREG_DBGBCR10_EL1,
479 MISCREG_DBGBCR11_EL1,
480 MISCREG_DBGBCR12_EL1,
481 MISCREG_DBGBCR13_EL1,
482 MISCREG_DBGBCR14_EL1,
483 MISCREG_DBGBCR15_EL1,
494 MISCREG_DBGWVR10_EL1,
495 MISCREG_DBGWVR11_EL1,
496 MISCREG_DBGWVR12_EL1,
497 MISCREG_DBGWVR13_EL1,
498 MISCREG_DBGWVR14_EL1,
499 MISCREG_DBGWVR15_EL1,
510 MISCREG_DBGWCR10_EL1,
511 MISCREG_DBGWCR11_EL1,
512 MISCREG_DBGWCR12_EL1,
513 MISCREG_DBGWCR13_EL1,
514 MISCREG_DBGWCR14_EL1,
515 MISCREG_DBGWCR15_EL1,
520 MISCREG_DBGVCR32_EL2,
526 MISCREG_DBGCLAIMSET_EL1,
527 MISCREG_DBGCLAIMCLR_EL1,
528 MISCREG_DBGAUTHSTATUS_EL1,
529 MISCREG_TEECR32_EL1, // not in ARM DDI 0487A.b+
530 MISCREG_TEEHBR32_EL1, // not in ARM DDI 0487A.b+
532 // AArch64 registers (Op0=1,3)
540 MISCREG_ID_MMFR0_EL1,
541 MISCREG_ID_MMFR1_EL1,
542 MISCREG_ID_MMFR2_EL1,
543 MISCREG_ID_MMFR3_EL1,
544 MISCREG_ID_ISAR0_EL1,
545 MISCREG_ID_ISAR1_EL1,
546 MISCREG_ID_ISAR2_EL1,
547 MISCREG_ID_ISAR3_EL1,
548 MISCREG_ID_ISAR4_EL1,
549 MISCREG_ID_ISAR5_EL1,
553 MISCREG_ID_AA64PFR0_EL1,
554 MISCREG_ID_AA64PFR1_EL1,
555 MISCREG_ID_AA64DFR0_EL1,
556 MISCREG_ID_AA64DFR1_EL1,
557 MISCREG_ID_AA64AFR0_EL1,
558 MISCREG_ID_AA64AFR1_EL1,
559 MISCREG_ID_AA64ISAR0_EL1,
560 MISCREG_ID_AA64ISAR1_EL1,
561 MISCREG_ID_AA64MMFR0_EL1,
562 MISCREG_ID_AA64MMFR1_EL1,
618 MISCREG_SPSR_IRQ_AA64,
619 MISCREG_SPSR_ABT_AA64,
620 MISCREG_SPSR_UND_AA64,
621 MISCREG_SPSR_FIQ_AA64,
662 MISCREG_AT_S12E1R_Xt,
663 MISCREG_AT_S12E1W_Xt,
664 MISCREG_AT_S12E0R_Xt,
665 MISCREG_AT_S12E0W_Xt,
668 MISCREG_TLBI_VMALLE1IS,
669 MISCREG_TLBI_VAE1IS_Xt,
670 MISCREG_TLBI_ASIDE1IS_Xt,
671 MISCREG_TLBI_VAAE1IS_Xt,
672 MISCREG_TLBI_VALE1IS_Xt,
673 MISCREG_TLBI_VAALE1IS_Xt,
674 MISCREG_TLBI_VMALLE1,
675 MISCREG_TLBI_VAE1_Xt,
676 MISCREG_TLBI_ASIDE1_Xt,
677 MISCREG_TLBI_VAAE1_Xt,
678 MISCREG_TLBI_VALE1_Xt,
679 MISCREG_TLBI_VAALE1_Xt,
680 MISCREG_TLBI_IPAS2E1IS_Xt,
681 MISCREG_TLBI_IPAS2LE1IS_Xt,
682 MISCREG_TLBI_ALLE2IS,
683 MISCREG_TLBI_VAE2IS_Xt,
684 MISCREG_TLBI_ALLE1IS,
685 MISCREG_TLBI_VALE2IS_Xt,
686 MISCREG_TLBI_VMALLS12E1IS,
687 MISCREG_TLBI_IPAS2E1_Xt,
688 MISCREG_TLBI_IPAS2LE1_Xt,
690 MISCREG_TLBI_VAE2_Xt,
692 MISCREG_TLBI_VALE2_Xt,
693 MISCREG_TLBI_VMALLS12E1,
694 MISCREG_TLBI_ALLE3IS,
695 MISCREG_TLBI_VAE3IS_Xt,
696 MISCREG_TLBI_VALE3IS_Xt,
698 MISCREG_TLBI_VAE3_Xt,
699 MISCREG_TLBI_VALE3_Xt,
700 MISCREG_PMINTENSET_EL1,
701 MISCREG_PMINTENCLR_EL1,
703 MISCREG_PMCNTENSET_EL0,
704 MISCREG_PMCNTENCLR_EL0,
705 MISCREG_PMOVSCLR_EL0,
711 MISCREG_PMXEVTYPER_EL0,
712 MISCREG_PMCCFILTR_EL0,
713 MISCREG_PMXEVCNTR_EL0,
714 MISCREG_PMUSERENR_EL0,
715 MISCREG_PMOVSSET_EL0,
735 MISCREG_CONTEXTIDR_EL1,
736 MISCREG_CONTEXTIDR_EL12,
742 // BEGIN Generic Timer (AArch64)
746 MISCREG_CNTP_CTL_EL0,
747 MISCREG_CNTP_CVAL_EL0,
748 MISCREG_CNTP_TVAL_EL0,
749 MISCREG_CNTV_CTL_EL0,
750 MISCREG_CNTV_CVAL_EL0,
751 MISCREG_CNTV_TVAL_EL0,
752 MISCREG_CNTP_CTL_EL02,
753 MISCREG_CNTP_CVAL_EL02,
754 MISCREG_CNTP_TVAL_EL02,
755 MISCREG_CNTV_CTL_EL02,
756 MISCREG_CNTV_CVAL_EL02,
757 MISCREG_CNTV_TVAL_EL02,
759 MISCREG_CNTKCTL_EL12,
760 MISCREG_CNTPS_CTL_EL1,
761 MISCREG_CNTPS_CVAL_EL1,
762 MISCREG_CNTPS_TVAL_EL1,
764 MISCREG_CNTHP_CTL_EL2,
765 MISCREG_CNTHP_CVAL_EL2,
766 MISCREG_CNTHP_TVAL_EL2,
767 MISCREG_CNTHPS_CTL_EL2,
768 MISCREG_CNTHPS_CVAL_EL2,
769 MISCREG_CNTHPS_TVAL_EL2,
771 MISCREG_CNTHV_CTL_EL2,
772 MISCREG_CNTHV_CVAL_EL2,
773 MISCREG_CNTHV_TVAL_EL2,
774 MISCREG_CNTHVS_CTL_EL2,
775 MISCREG_CNTHVS_CVAL_EL2,
776 MISCREG_CNTHVS_TVAL_EL2,
779 // END Generic Timer (AArch64)
780 MISCREG_PMEVCNTR0_EL0,
781 MISCREG_PMEVCNTR1_EL0,
782 MISCREG_PMEVCNTR2_EL0,
783 MISCREG_PMEVCNTR3_EL0,
784 MISCREG_PMEVCNTR4_EL0,
785 MISCREG_PMEVCNTR5_EL0,
786 MISCREG_PMEVTYPER0_EL0,
787 MISCREG_PMEVTYPER1_EL0,
788 MISCREG_PMEVTYPER2_EL0,
789 MISCREG_PMEVTYPER3_EL0,
790 MISCREG_PMEVTYPER4_EL0,
791 MISCREG_PMEVTYPER5_EL0,
792 MISCREG_IL1DATA0_EL1,
793 MISCREG_IL1DATA1_EL1,
794 MISCREG_IL1DATA2_EL1,
795 MISCREG_IL1DATA3_EL1,
796 MISCREG_DL1DATA0_EL1,
797 MISCREG_DL1DATA1_EL1,
798 MISCREG_DL1DATA2_EL1,
799 MISCREG_DL1DATA3_EL1,
800 MISCREG_DL1DATA4_EL1,
802 MISCREG_CPUACTLR_EL1,
803 MISCREG_CPUECTLR_EL1,
804 MISCREG_CPUMERRSR_EL1,
805 MISCREG_L2MERRSR_EL1,
807 MISCREG_CONTEXTIDR_EL2,
809 // Introduced in ARMv8.1
812 MISCREG_ID_AA64MMFR2_EL1,
814 //PAuth Key Regsiters
815 MISCREG_APDAKeyHi_EL1,
816 MISCREG_APDAKeyLo_EL1,
817 MISCREG_APDBKeyHi_EL1,
818 MISCREG_APDBKeyLo_EL1,
819 MISCREG_APGAKeyHi_EL1,
820 MISCREG_APGAKeyLo_EL1,
821 MISCREG_APIAKeyHi_EL1,
822 MISCREG_APIAKeyLo_EL1,
823 MISCREG_APIBKeyHi_EL1,
824 MISCREG_APIBKeyLo_EL1,
826 // GICv3, CPU interface
828 MISCREG_ICC_IAR0_EL1,
829 MISCREG_ICC_EOIR0_EL1,
830 MISCREG_ICC_HPPIR0_EL1,
831 MISCREG_ICC_BPR0_EL1,
832 MISCREG_ICC_AP0R0_EL1,
833 MISCREG_ICC_AP0R1_EL1,
834 MISCREG_ICC_AP0R2_EL1,
835 MISCREG_ICC_AP0R3_EL1,
836 MISCREG_ICC_AP1R0_EL1,
837 MISCREG_ICC_AP1R0_EL1_NS,
838 MISCREG_ICC_AP1R0_EL1_S,
839 MISCREG_ICC_AP1R1_EL1,
840 MISCREG_ICC_AP1R1_EL1_NS,
841 MISCREG_ICC_AP1R1_EL1_S,
842 MISCREG_ICC_AP1R2_EL1,
843 MISCREG_ICC_AP1R2_EL1_NS,
844 MISCREG_ICC_AP1R2_EL1_S,
845 MISCREG_ICC_AP1R3_EL1,
846 MISCREG_ICC_AP1R3_EL1_NS,
847 MISCREG_ICC_AP1R3_EL1_S,
850 MISCREG_ICC_SGI1R_EL1,
851 MISCREG_ICC_ASGI1R_EL1,
852 MISCREG_ICC_SGI0R_EL1,
853 MISCREG_ICC_IAR1_EL1,
854 MISCREG_ICC_EOIR1_EL1,
855 MISCREG_ICC_HPPIR1_EL1,
856 MISCREG_ICC_BPR1_EL1,
857 MISCREG_ICC_BPR1_EL1_NS,
858 MISCREG_ICC_BPR1_EL1_S,
859 MISCREG_ICC_CTLR_EL1,
860 MISCREG_ICC_CTLR_EL1_NS,
861 MISCREG_ICC_CTLR_EL1_S,
863 MISCREG_ICC_SRE_EL1_NS,
864 MISCREG_ICC_SRE_EL1_S,
865 MISCREG_ICC_IGRPEN0_EL1,
866 MISCREG_ICC_IGRPEN1_EL1,
867 MISCREG_ICC_IGRPEN1_EL1_NS,
868 MISCREG_ICC_IGRPEN1_EL1_S,
870 MISCREG_ICC_CTLR_EL3,
872 MISCREG_ICC_IGRPEN1_EL3,
874 // GICv3, CPU interface, virtualization
875 MISCREG_ICH_AP0R0_EL2,
876 MISCREG_ICH_AP0R1_EL2,
877 MISCREG_ICH_AP0R2_EL2,
878 MISCREG_ICH_AP0R3_EL2,
879 MISCREG_ICH_AP1R0_EL2,
880 MISCREG_ICH_AP1R1_EL2,
881 MISCREG_ICH_AP1R2_EL2,
882 MISCREG_ICH_AP1R3_EL2,
885 MISCREG_ICH_MISR_EL2,
886 MISCREG_ICH_EISR_EL2,
887 MISCREG_ICH_ELRSR_EL2,
888 MISCREG_ICH_VMCR_EL2,
899 MISCREG_ICH_LR10_EL2,
900 MISCREG_ICH_LR11_EL2,
901 MISCREG_ICH_LR12_EL2,
902 MISCREG_ICH_LR13_EL2,
903 MISCREG_ICH_LR14_EL2,
904 MISCREG_ICH_LR15_EL2,
907 MISCREG_ICV_IAR0_EL1,
908 MISCREG_ICV_EOIR0_EL1,
909 MISCREG_ICV_HPPIR0_EL1,
910 MISCREG_ICV_BPR0_EL1,
911 MISCREG_ICV_AP0R0_EL1,
912 MISCREG_ICV_AP0R1_EL1,
913 MISCREG_ICV_AP0R2_EL1,
914 MISCREG_ICV_AP0R3_EL1,
915 MISCREG_ICV_AP1R0_EL1,
916 MISCREG_ICV_AP1R0_EL1_NS,
917 MISCREG_ICV_AP1R0_EL1_S,
918 MISCREG_ICV_AP1R1_EL1,
919 MISCREG_ICV_AP1R1_EL1_NS,
920 MISCREG_ICV_AP1R1_EL1_S,
921 MISCREG_ICV_AP1R2_EL1,
922 MISCREG_ICV_AP1R2_EL1_NS,
923 MISCREG_ICV_AP1R2_EL1_S,
924 MISCREG_ICV_AP1R3_EL1,
925 MISCREG_ICV_AP1R3_EL1_NS,
926 MISCREG_ICV_AP1R3_EL1_S,
929 MISCREG_ICV_SGI1R_EL1,
930 MISCREG_ICV_ASGI1R_EL1,
931 MISCREG_ICV_SGI0R_EL1,
932 MISCREG_ICV_IAR1_EL1,
933 MISCREG_ICV_EOIR1_EL1,
934 MISCREG_ICV_HPPIR1_EL1,
935 MISCREG_ICV_BPR1_EL1,
936 MISCREG_ICV_BPR1_EL1_NS,
937 MISCREG_ICV_BPR1_EL1_S,
938 MISCREG_ICV_CTLR_EL1,
939 MISCREG_ICV_CTLR_EL1_NS,
940 MISCREG_ICV_CTLR_EL1_S,
942 MISCREG_ICV_SRE_EL1_NS,
943 MISCREG_ICV_SRE_EL1_S,
944 MISCREG_ICV_IGRPEN0_EL1,
945 MISCREG_ICV_IGRPEN1_EL1,
946 MISCREG_ICV_IGRPEN1_EL1_NS,
947 MISCREG_ICV_IGRPEN1_EL1_S,
954 MISCREG_ICC_AP1R0_NS,
957 MISCREG_ICC_AP1R1_NS,
960 MISCREG_ICC_AP1R2_NS,
963 MISCREG_ICC_AP1R3_NS,
983 MISCREG_ICC_IGRPEN1_NS,
984 MISCREG_ICC_IGRPEN1_S,
1044 MISCREG_ID_AA64ZFR0_EL1,
1050 // NUM_PHYS_MISCREGS specifies the number of actual physical
1051 // registers, not considering the following pseudo-registers
1052 // (dummy registers), like UNKNOWN, CP15_UNIMPL, MISCREG_IMPDEF_UNIMPL.
1053 // Checkpointing should use this physical index when
1054 // saving/restoring register values.
1060 MISCREG_CP14_UNIMPL,
1061 MISCREG_CP15_UNIMPL,
1064 // Implementation defined register: this represent
1065 // a pool of unimplemented registers whose access can throw
1066 // either UNDEFINED or hypervisor trap exception.
1067 MISCREG_IMPDEF_UNIMPL,
1069 // RAS extension (unimplemented)
1071 MISCREG_ERRSELR_EL1,
1073 MISCREG_ERXCTLR_EL1,
1074 MISCREG_ERXSTATUS_EL1,
1075 MISCREG_ERXADDR_EL1,
1076 MISCREG_ERXMISC0_EL1,
1077 MISCREG_ERXMISC1_EL1,
1085 // Total number of Misc Registers: Physical + Dummy
1090 MISCREG_IMPLEMENTED,
1091 MISCREG_UNVERIFIABLE, // Does the value change on every read (e.g. a
1092 // arch generic counter)
1093 MISCREG_WARN_NOT_FAIL, // If MISCREG_IMPLEMENTED is deasserted, it
1094 // tells whether the instruction should raise a
1096 MISCREG_MUTEX, // True if the register corresponds to a pair of
1097 // mutually exclusive registers
1098 MISCREG_BANKED, // True if the register is banked between the two
1099 // security states, and this is the parent node of the
1100 // two banked registers
1101 MISCREG_BANKED64, // True if the register is banked between the two
1102 // security states, and this is the parent node of
1103 // the two banked registers. Used in AA64 only.
1104 MISCREG_BANKED_CHILD, // The entry is one of the child registers that
1105 // forms a banked set of regs (along with the
1106 // other child regs)
1108 // Access permissions
1114 // Privileged modes other than hypervisor or monitor
1122 // Hypervisor mode, HCR_EL2.E2H == 1
1125 // Monitor mode, SCR.NS == 0
1128 // Monitor mode, SCR.NS == 1
1131 // Monitor mode, HCR_EL2.E2H == 1
1138 extern std::bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS];
1140 // Decodes 32-bit CP14 registers accessible through MCR/MRC instructions
1141 MiscRegIndex decodeCP14Reg(unsigned crn, unsigned opc1,
1142 unsigned crm, unsigned opc2);
1143 MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1,
1144 unsigned crn, unsigned crm,
1146 // Whether a particular AArch64 system register is -always- read only.
1147 bool aarch64SysRegReadOnly(MiscRegIndex miscReg);
1149 // Decodes 32-bit CP15 registers accessible through MCR/MRC instructions
1150 MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1,
1151 unsigned crm, unsigned opc2);
1153 // Decodes 64-bit CP15 registers accessible through MCRR/MRRC instructions
1154 MiscRegIndex decodeCP15Reg64(unsigned crm, unsigned opc1);
1157 const char * const miscRegName[] = {
1187 "pmxevtyper_pmccfiltr",
1191 // AArch32 CP14 registers
1301 // AArch32 CP15 registers
1545 // AArch64 registers (Op0=2)
1627 "dbgauthstatus_el1",
1631 // AArch64 registers (Op0=1,3)
1779 "tlbi_ipas2e1is_xt",
1780 "tlbi_ipas2le1is_xt",
1785 "tlbi_vmalls12e1is",
1917 // GICv3, CPU interface
1958 "icc_igrpen1_el1_ns",
1959 "icc_igrpen1_el1_s",
1965 // GICv3, CPU interface, virtualization
2037 "icv_igrpen1_el1_ns",
2038 "icv_igrpen1_el1_s",
2165 static_assert(sizeof(miscRegName) / sizeof(*miscRegName) == NUM_MISCREGS,
2166 "The miscRegName array and NUM_MISCREGS are inconsistent.");
2168 // This mask selects bits of the CPSR that actually go in the CondCodes
2169 // integer register to allow renaming.
2170 static const uint32_t CondCodesMask = 0xF00F0000;
2171 static const uint32_t CpsrMaskQ = 0x08000000;
2173 // APSR (Application Program Status Register Mask). It is the user level
2174 // alias for the CPSR. The APSR is a subset of the CPSR. Although
2175 // bits[15:0] are UNKNOWN on reads, it is permitted that, on a read of
2177 // Bit[9] returns the value of CPSR.E.
2178 // Bits[8:6] return the value of CPSR.{A,I, F}, the mask bits.
2179 static const uint32_t ApsrMask = CpsrMaskQ | CondCodesMask | 0x000001D0;
2181 // CPSR (Current Program Status Register Mask).
2182 static const uint32_t CpsrMask = ApsrMask | 0x00F003DF;
2184 // This mask selects bits of the FPSCR that actually go in the FpCondCodes
2185 // integer register to allow renaming.
2186 static const uint32_t FpCondCodesMask = 0xF0000000;
2187 // This mask selects the cumulative saturation flag of the FPSCR.
2188 static const uint32_t FpscrQcMask = 0x08000000;
2189 // This mask selects the AHP bit of the FPSCR.
2190 static const uint32_t FpscrAhpMask = 0x04000000;
2191 // This mask selects the cumulative FP exception flags of the FPSCR.
2192 static const uint32_t FpscrExcMask = 0x0000009F;
2195 * Check for permission to read coprocessor registers.
2197 * Checks whether an instruction at the current program mode has
2198 * permissions to read the coprocessor registers. This function
2199 * returns whether the check is undefined and if not whether the
2200 * read access is permitted.
2202 * @param the misc reg indicating the coprocessor
2205 * @param the thread context on the core
2206 * @return a tuple of booleans: can_read, undefined
2208 std::tuple<bool, bool> canReadCoprocReg(MiscRegIndex reg, SCR scr,
2209 CPSR cpsr, ThreadContext *tc);
2212 * Check for permission to write coprocessor registers.
2214 * Checks whether an instruction at the current program mode has
2215 * permissions to write the coprocessor registers. This function
2216 * returns whether the check is undefined and if not whether the
2217 * write access is permitted.
2219 * @param the misc reg indicating the coprocessor
2222 * @param the thread context on the core
2223 * @return a tuple of booleans: can_write, undefined
2225 std::tuple<bool, bool> canWriteCoprocReg(MiscRegIndex reg, SCR scr,
2226 CPSR cpsr, ThreadContext *tc);
2228 // Checks for UNDEFINED behaviours when accessing AArch32
2229 // Generic Timer system registers
2230 bool AArch32isUndefinedGenericTimer(MiscRegIndex reg, ThreadContext *tc);
2232 // Checks read access permissions to AArch64 system registers
2233 bool canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
2236 // Checks write access permissions to AArch64 system registers
2237 bool canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr,
2240 // Uses just the scr.ns bit to pre flatten the misc regs. This is useful
2241 // for MCR/MRC instructions
2243 snsBankedIndex(MiscRegIndex reg, ThreadContext *tc);
2245 // Flattens a misc reg index using the specified security state. This is
2246 // used for opperations (eg address translations) where the security
2247 // state of the register access may differ from the current state of the
2250 snsBankedIndex(MiscRegIndex reg, ThreadContext *tc, bool ns);
2253 snsBankedIndex64(MiscRegIndex reg, ThreadContext *tc);
2255 // Takes a misc reg index and returns the root reg if its one of a set of
2258 preUnflattenMiscReg();
2261 unflattenMiscReg(int reg);
2265 #endif // __ARCH_ARM_MISCREGS_HH__