target/arm: Use unallocated_encoding for aarch32

Promote this function from aarch64 to fully general use.
Use it to unify the code sequences for generating illegal
opcode exceptions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190807045335.1361-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2019-08-15 09:46:45 +01:00 committed by Peter Maydell
parent 06bcbda3f6
commit 3cb3663715
5 changed files with 15 additions and 21 deletions

View File

@ -338,13 +338,6 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
} }
} }
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));
}
static void init_tmp_a64_array(DisasContext *s) static void init_tmp_a64_array(DisasContext *s)
{ {
#ifdef CONFIG_DEBUG_TCG #ifdef CONFIG_DEBUG_TCG

View File

@ -18,8 +18,6 @@
#ifndef TARGET_ARM_TRANSLATE_A64_H #ifndef TARGET_ARM_TRANSLATE_A64_H
#define TARGET_ARM_TRANSLATE_A64_H #define TARGET_ARM_TRANSLATE_A64_H
void unallocated_encoding(DisasContext *s);
#define unsupported_encoding(s, insn) \ #define unsupported_encoding(s, insn) \
do { \ do { \
qemu_log_mask(LOG_UNIMP, \ qemu_log_mask(LOG_UNIMP, \

View File

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

View File

@ -1270,6 +1270,13 @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
s->base.is_jmp = DISAS_NORETURN; s->base.is_jmp = DISAS_NORETURN;
} }
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. */ /* Force a TB lookup after an instruction that changes the CPU state. */
static inline void gen_lookup_tb(DisasContext *s) static inline void gen_lookup_tb(DisasContext *s)
{ {
@ -1300,8 +1307,7 @@ static inline void gen_hlt(DisasContext *s, int imm)
return; return;
} }
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), unallocated_encoding(s);
default_exception_el(s));
} }
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn, static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
@ -7623,8 +7629,7 @@ static void gen_srs(DisasContext *s,
} }
if (undef) { if (undef) {
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), unallocated_encoding(s);
default_exception_el(s));
return; return;
} }
@ -9251,8 +9256,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
break; break;
default: default:
illegal_op: illegal_op:
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), unallocated_encoding(s);
default_exception_el(s));
break; break;
} }
} }
@ -10940,8 +10944,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
} }
return; return;
illegal_op: illegal_op:
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), unallocated_encoding(s);
default_exception_el(s));
} }
static void disas_thumb_insn(DisasContext *s, uint32_t insn) static void disas_thumb_insn(DisasContext *s, uint32_t insn)
@ -11764,8 +11767,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
return; return;
illegal_op: illegal_op:
undef: undef:
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), unallocated_encoding(s);
default_exception_el(s));
} }
static bool insn_crosses_page(CPUARMState *env, DisasContext *s) static bool insn_crosses_page(CPUARMState *env, DisasContext *s)

View File

@ -99,6 +99,8 @@ typedef struct DisasCompare {
bool value_global; bool value_global;
} DisasCompare; } DisasCompare;
void unallocated_encoding(DisasContext *s);
/* Share the TCG temporaries common between 32 and 64 bit modes. */ /* Share the TCG temporaries common between 32 and 64 bit modes. */
extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF; extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;
extern TCGv_i64 cpu_exclusive_addr; extern TCGv_i64 cpu_exclusive_addr;