@@ -3738,6 +3738,36 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
37383738 .access = PL1_RW , .accessfn = access_trap_aa32s_el1 ,
37393739 .writefn = sdcr_write ,
37403740 .fieldoffset = offsetoflow32 (CPUARMState , cp15 .mdcr_el3 ) },
3741+ // zhuowei: hack: KTRR for Apple CPUs
3742+ { .name = "KTRR_MYSTERY0_EL1" , .state = ARM_CP_STATE_AA64 ,
3743+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 0 ,
3744+ .resetvalue = 0 ,
3745+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_mystery0_el1 ) },
3746+ { .name = "KTRR_MYSTERY1_EL1" , .state = ARM_CP_STATE_AA64 ,
3747+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 1 ,
3748+ .resetvalue = 0 ,
3749+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_mystery1_el1 ) },
3750+ { .name = "KTRR_LOCK_EL1" , .state = ARM_CP_STATE_AA64 ,
3751+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 2 ,
3752+ .resetvalue = 0 ,
3753+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_lock_el1 ) },
3754+ { .name = "KTRR_LOWER_EL1" , .state = ARM_CP_STATE_AA64 ,
3755+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 3 ,
3756+ .resetvalue = 0 ,
3757+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_lower_el1 ) },
3758+ { .name = "KTRR_UPPER_EL1" , .state = ARM_CP_STATE_AA64 ,
3759+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 4 ,
3760+ .resetvalue = 0 ,
3761+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_upper_el1 ) },
3762+ // no ktrr register 5, I think.
3763+ { .name = "KTRR_MYSTERY6_EL1" , .state = ARM_CP_STATE_AA64 ,
3764+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 6 ,
3765+ .resetvalue = 0 ,
3766+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_mystery6_el1 ) },
3767+ { .name = "KTRR_MYSTERY7_EL1" , .state = ARM_CP_STATE_AA64 ,
3768+ .opc0 = 3 , .opc1 = 4 , .crn = 15 , .crm = 2 , .opc2 = 7 ,
3769+ .resetvalue = 0 ,
3770+ .access = PL1_RW , .fieldoffset = offsetof(CPUARMState , cp15 .ktrr_mystery7_el1 ) },
37413771 REGINFO_SENTINEL
37423772};
37433773
@@ -5843,7 +5873,8 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
58435873 break ;
58445874 }
58455875 /* assert our permissions are not too lax (stricter is fine) */
5846- assert ((r -> access & ~mask ) == 0 );
5876+ // zhuowei: hack. make KTRR registers writable from EL1 even though they have opc1=4
5877+ // assert((r->access & ~mask) == 0);
58475878 }
58485879
58495880 /* Check that the register definition has enough info to handle
0 commit comments