target/arm: Factor out unallocated_encoding for aarch32

Make this a static function private to translate.c.
Thus we can use the same idiom between aarch64 and aarch32
without actually sharing function implementations.

Backports commit 1ce21ba1eaf08b22da5925f3e37fc0b4322da858 from qemu
This commit is contained in:
Richard Henderson 2019-11-18 23:51:43 -05:00 committed by Lioncash
parent 1f59a43544
commit 87c06b7fae
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 13 additions and 12 deletions

View file

@ -110,8 +110,7 @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
if (!s->vfp_enabled && !ignore_vfp_enabled) {
assert(!arm_dc_feature(s, ARM_FEATURE_M));
gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
return false;
}

View file

@ -1304,6 +1304,13 @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
s->base.is_jmp = DISAS_NORETURN;
}
static void unallocated_encoding(DisasContext *s)
{
/* Unallocated and reserved encodings are uncategorized */
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
}
/* Force a TB lookup after an instruction that changes the CPU state. */
static inline void gen_lookup_tb(DisasContext *s)
{
@ -1335,8 +1342,7 @@ static inline void gen_hlt(DisasContext *s, int imm)
return;
}
gen_exception_insn(s, s->thumb ? 2 : 4, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
}
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
@ -7748,8 +7754,7 @@ static void gen_srs(DisasContext *s,
}
if (undef) {
gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
return;
}
@ -9378,8 +9383,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
break;
default:
illegal_op:
gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
break;
}
}
@ -11066,8 +11070,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
}
return;
illegal_op:
gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
}
static void disas_thumb_insn(DisasContext *s, uint32_t insn)
@ -11891,8 +11894,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
return;
illegal_op:
undef:
gen_exception_insn(s, 2, EXCP_UDEF, syn_uncategorized(),
default_exception_el(s));
unallocated_encoding(s);
}
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)