gen_exception_insn(s, 0, EXCP_UDEF, syndrome);
}
+/*
+ * Look up @key, returning the cpreg, which must exist.
+ * Additionally, the new cpreg must also be accessible.
+ */
+static const ARMCPRegInfo *
+redirect_cpreg(DisasContext *s, uint32_t key, bool isread)
+{
+ const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key);
+ assert(ri);
+ assert(cp_access_ok(s->current_el, ri, isread));
+ return ri;
+}
+
/* MRS - move from system register
* MSR (register) - move to system register
* SYS
* fine-grained-traps on EL1 also do not apply here.
*/
key = ENCODE_AA64_CP_REG(op0, 0, crn, crm, op2);
- ri = get_arm_cp_reginfo(s->cp_regs, key);
- assert(ri);
- assert(cp_access_ok(s->current_el, ri, isread));
+ ri = redirect_cpreg(s, key, isread);
/*
* We might not have done an update_pc earlier, so check we don't
* need it. We could support this in future if necessary.