On 2/22/23 09:35, Aaron Lindsay wrote:
+static G_NORETURN +void pauth_fail_exception(CPUARMState *env, bool data, int keynumber, uintptr_t ra) +{ + int target_el = arm_current_el(env); + if (target_el == 0) { + uint64_t hcr = arm_hcr_el2_eff(env); + if (arm_is_el2_enabled(env) && (hcr & HCR_TGE)) + target_el = 2; + else + target_el = 1; + } + + raise_exception_ra(env, EXCP_UDEF, syn_pacfail(data, keynumber), target_el, ra);
Use exception_target_el(), no need to check TGE here.
@@ -406,6 +421,16 @@ static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier, uint64_t xor_mask = MAKE_64BIT_MASK(bot_bit, top_bit - bot_bit + 1) & ~MAKE_64BIT_MASK(55, 1); result = ((ptr ^ pac) & xor_mask) | (ptr & ~xor_mask); + if (cpu_isar_feature(aa64_fpac_combine, env_archcpu(env)) || + (cpu_isar_feature(aa64_fpac, env_archcpu(env)) && + !is_combined)) {
Indentation is off.
+ int error_code = ((data ? 1 : 0) << 1) | (keynumber);
'? 1 : 0' is not required. r~