From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 12/28] target/arm: Introduce gen_exception_insn
Date: Fri, 10 Jun 2022 17:07:22 +0100 [thread overview]
Message-ID: <20220610160738.2230762-13-peter.maydell@linaro.org> (raw)
In-Reply-To: <20220610160738.2230762-1-peter.maydell@linaro.org>
From: Richard Henderson <richard.henderson@linaro.org>
Create a new wrapper function that passes the default
exception target to gen_exception_insn_el.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/translate.h | 1 +
target/arm/translate-a64.c | 15 ++++++---------
target/arm/translate-m-nocp.c | 3 +--
target/arm/translate-mve.c | 3 +--
target/arm/translate.c | 29 +++++++++++++----------------
5 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/target/arm/translate.h b/target/arm/translate.h
index 9ae76535ada..4575af6e1c9 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -281,6 +281,7 @@ MemOp pow2_align(unsigned i);
void unallocated_encoding(DisasContext *s);
void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
uint32_t syn, uint32_t target_el);
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t syn);
/* Return state of Alternate Half-precision flag, caller frees result */
static inline TCGv_i32 get_ahp_flag(void)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 14bc80dba03..0581118f566 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1816,8 +1816,7 @@ static void gen_sysreg_undef(DisasContext *s, bool isread,
} else {
syndrome = syn_uncategorized();
}
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syndrome,
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syndrome);
}
/* MRS - move from system register
@@ -2069,8 +2068,8 @@ static void disas_exc(DisasContext *s, uint32_t insn)
switch (op2_ll) {
case 1: /* SVC */
gen_ss_advance(s);
- gen_exception_insn_el(s, s->base.pc_next, EXCP_SWI,
- syn_aa64_svc(imm16), default_exception_el(s));
+ gen_exception_insn(s, s->base.pc_next, EXCP_SWI,
+ syn_aa64_svc(imm16));
break;
case 2: /* HVC */
if (s->current_el == 0) {
@@ -14725,8 +14724,7 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
* Illegal execution state. This has priority over BTI
* exceptions, but comes after instruction abort exceptions.
*/
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
- syn_illegalstate(), default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate());
return;
}
@@ -14757,9 +14755,8 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
if (s->btype != 0
&& s->guarded_page
&& !btype_destination_ok(insn, s->bt, s->btype)) {
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
- syn_btitrap(s->btype),
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+ syn_btitrap(s->btype));
return;
}
} else {
diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c
index 636bfb1788a..4029d7fdd49 100644
--- a/target/arm/translate-m-nocp.c
+++ b/target/arm/translate-m-nocp.c
@@ -765,8 +765,7 @@ static bool trans_NOCP(DisasContext *s, arg_nocp *a)
}
if (a->cp != 10) {
- gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
- syn_uncategorized(), default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized());
return true;
}
diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c
index 5aec2a15555..0cf1b5ea4f5 100644
--- a/target/arm/translate-mve.c
+++ b/target/arm/translate-mve.c
@@ -100,8 +100,7 @@ bool mve_eci_check(DisasContext *s)
return true;
default:
/* Reserved value: INVSTATE UsageFault */
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
return false;
}
}
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 44f462a3a31..c7d422b5415 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -1106,6 +1106,11 @@ void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el));
}
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t syn)
+{
+ gen_exception_insn_el(s, pc, excp, syn, default_exception_el(s));
+}
+
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
{
gen_set_condexec(s);
@@ -1117,8 +1122,7 @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
void unallocated_encoding(DisasContext *s)
{
/* Unallocated and reserved encodings are uncategorized */
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized());
}
/* Force a TB lookup after an instruction that changes the CPU state. */
@@ -2731,8 +2735,6 @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
* an exception and return false. Otherwise it will return true,
* and set *tgtmode and *regno appropriately.
*/
- int exc_target = default_exception_el(s);
-
/* These instructions are present only in ARMv8, or in ARMv7 with the
* Virtualization Extensions.
*/
@@ -2869,8 +2871,7 @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
undef:
/* If we get here then some access check did not pass */
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
- syn_uncategorized(), exc_target);
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized());
return false;
}
@@ -8583,8 +8584,7 @@ static bool trans_LE(DisasContext *s, arg_LE *a)
tmp = load_cpu_field(v7m.ltpsize);
tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc);
tcg_temp_free_i32(tmp);
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
gen_set_label(skipexc);
}
@@ -9054,8 +9054,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
* UsageFault exception.
*/
if (arm_dc_feature(s, ARM_FEATURE_M)) {
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
- default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
return;
}
@@ -9064,8 +9063,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
* Illegal execution state. This has priority over BTI
* exceptions, but comes after instruction abort exceptions.
*/
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
- syn_illegalstate(), default_exception_el(s));
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate());
return;
}
@@ -9634,8 +9632,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
* Illegal execution state. This has priority over BTI
* exceptions, but comes after instruction abort exceptions.
*/
- gen_exception_insn_el(dc, dc->pc_curr, EXCP_UDEF,
- syn_illegalstate(), default_exception_el(dc));
+ gen_exception_insn(dc, dc->pc_curr, EXCP_UDEF, syn_illegalstate());
return;
}
@@ -9708,8 +9705,8 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
*/
tcg_remove_ops_after(dc->insn_eci_rewind);
dc->condjmp = 0;
- gen_exception_insn_el(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
- default_exception_el(dc));
+ gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE,
+ syn_uncategorized());
}
arm_post_translate_insn(dc);
--
2.25.1
next prev parent reply other threads:[~2022-06-10 16:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 16:07 [PULL 00/28] target-arm queue Peter Maydell
2022-06-10 16:07 ` [PULL 01/28] target/arm: Mark exception helpers as noreturn Peter Maydell
2022-06-10 16:07 ` [PULL 02/28] target/arm: Add coproc parameter to syn_fp_access_trap Peter Maydell
2022-08-12 14:47 ` Peter Maydell
2022-06-10 16:07 ` [PULL 03/28] target/arm: Move exception_target_el out of line Peter Maydell
2022-06-10 16:07 ` [PULL 04/28] target/arm: Move arm_singlestep_active " Peter Maydell
2022-06-10 16:07 ` [PULL 05/28] target/arm: Move arm_generate_debug_exceptions " Peter Maydell
2022-06-10 16:07 ` [PULL 06/28] target/arm: Use is_a64 in arm_generate_debug_exceptions Peter Maydell
2022-06-10 16:07 ` [PULL 07/28] target/arm: Move exception_bkpt_insn to debug_helper.c Peter Maydell
2022-06-10 16:07 ` [PULL 08/28] target/arm: Move arm_debug_exception_fsr " Peter Maydell
2022-06-10 16:07 ` [PULL 09/28] target/arm: Rename helper_exception_with_syndrome Peter Maydell
2022-06-10 16:07 ` [PULL 10/28] target/arm: Introduce gen_exception_insn_el_v Peter Maydell
2022-06-10 16:07 ` [PULL 11/28] target/arm: Rename gen_exception_insn to gen_exception_insn_el Peter Maydell
2022-06-10 16:07 ` Peter Maydell [this message]
2022-06-10 16:07 ` [PULL 13/28] target/arm: Create helper_exception_swstep Peter Maydell
2022-06-10 16:07 ` [PULL 14/28] target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL Peter Maydell
2022-06-10 16:07 ` [PULL 15/28] target/arm: Move gen_exception to translate.c Peter Maydell
2022-06-10 16:07 ` [PULL 16/28] target/arm: Rename gen_exception to gen_exception_el Peter Maydell
2022-06-10 16:07 ` [PULL 17/28] target/arm: Introduce gen_exception Peter Maydell
2022-06-10 16:07 ` [PULL 18/28] target/arm: Introduce gen_exception_el_v Peter Maydell
2022-06-10 16:07 ` [PULL 19/28] target/arm: Introduce helper_exception_with_syndrome Peter Maydell
2022-06-10 16:07 ` [PULL 20/28] target/arm: Remove default_exception_el Peter Maydell
2022-06-10 16:07 ` [PULL 21/28] target/arm: Create raise_exception_debug Peter Maydell
2022-06-10 16:07 ` [PULL 22/28] target/arm: Move arm_debug_target_el to debug_helper.c Peter Maydell
2022-06-10 16:07 ` [PULL 23/28] target/arm: Fix Secure PL1 tests in fp_exception_el Peter Maydell
2022-06-10 16:07 ` [PULL 24/28] tests/qtest: Reduce npcm7xx_sdhci test image size Peter Maydell
2022-06-10 16:07 ` [PULL 25/28] target/arm: Adjust format test in scr_write Peter Maydell
2022-06-10 16:07 ` [PULL 26/28] target/arm: SCR_EL3.RW is RAO/WI without AArch32 EL[12] Peter Maydell
2022-06-10 16:07 ` [PULL 27/28] gdbstub: Don't use GDB syscalls if no GDB is attached Peter Maydell
2022-06-10 16:07 ` [PULL 28/28] semihosting/config: Merge --semihosting-config option groups Peter Maydell
2022-06-10 23:10 ` [PULL 00/28] target-arm queue Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220610160738.2230762-13-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.