mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
target/arm: Add PAuth system registers
Backports commit 967aa94f2b0df08d744b6d0bfa21031175e8a0e6 from qemu
This commit is contained in:
parent
d633a04e61
commit
6e1c9df11f
|
@ -4468,6 +4468,70 @@ static CPAccessResult access_lor_other(CPUARMState *env,
|
||||||
return access_lor_ns(env);
|
return access_lor_ns(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_AARCH64
|
||||||
|
static CPAccessResult access_pauth(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||||
|
bool isread)
|
||||||
|
{
|
||||||
|
int el = arm_current_el(env);
|
||||||
|
|
||||||
|
if (el < 2 &&
|
||||||
|
arm_feature(env, ARM_FEATURE_EL2) &&
|
||||||
|
!(arm_hcr_el2_eff(env) & HCR_APK)) {
|
||||||
|
return CP_ACCESS_TRAP_EL2;
|
||||||
|
}
|
||||||
|
if (el < 3 &&
|
||||||
|
arm_feature(env, ARM_FEATURE_EL3) &&
|
||||||
|
!(env->cp15.scr_el3 & SCR_APK)) {
|
||||||
|
return CP_ACCESS_TRAP_EL3;
|
||||||
|
}
|
||||||
|
return CP_ACCESS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ARMCPRegInfo pauth_reginfo[] = {
|
||||||
|
{ .name = "APDAKEYLO_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 0,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apda_key.lo) },
|
||||||
|
{ .name = "APDAKEYHI_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 1,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apda_key.hi) },
|
||||||
|
{ .name = "APDBKEYLO_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 2,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apdb_key.lo) },
|
||||||
|
{ .name = "APDBKEYHI_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 2, .opc2 = 3,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apdb_key.hi) },
|
||||||
|
{ .name = "APGAKEYLO_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 0,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apga_key.lo) },
|
||||||
|
{ .name = "APGAKEYHI_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 3, .opc2 = 1,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apga_key.hi) },
|
||||||
|
{ .name = "APIAKEYLO_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 0,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apia_key.lo) },
|
||||||
|
{ .name = "APIAKEYHI_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 1,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apia_key.hi) },
|
||||||
|
{ .name = "APIBKEYLO_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 2,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apib_key.lo) },
|
||||||
|
{ .name = "APIBKEYHI_EL1", .state = ARM_CP_STATE_AA64,
|
||||||
|
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 3,
|
||||||
|
.access = PL1_RW, .accessfn = access_pauth,
|
||||||
|
.fieldoffset = offsetof(CPUARMState, apib_key.hi) },
|
||||||
|
REGINFO_SENTINEL
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
void register_cp_regs_for_features(ARMCPU *cpu)
|
void register_cp_regs_for_features(ARMCPU *cpu)
|
||||||
{
|
{
|
||||||
/* Register all the coprocessor registers based on feature bits */
|
/* Register all the coprocessor registers based on feature bits */
|
||||||
|
@ -5067,6 +5131,12 @@ void register_cp_regs_for_features(ARMCPU *cpu)
|
||||||
define_one_arm_cp_reg(cpu, &zcr_el3_reginfo);
|
define_one_arm_cp_reg(cpu, &zcr_el3_reginfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_AARCH64
|
||||||
|
if (cpu_isar_feature(aa64_pauth, cpu)) {
|
||||||
|
define_arm_cp_regs(cpu, pauth_reginfo);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
|
void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
|
||||||
|
|
Loading…
Reference in a new issue