qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH v3 07/23] target/arm: Move exception_bkpt_insn to debug_helper.c
Date: Thu,  9 Jun 2022 13:28:45 -0700	[thread overview]
Message-ID: <20220609202901.1177572-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/debug_helper.c | 31 +++++++++++++++++++++++++++++++
 target/arm/op_helper.c    | 29 -----------------------------
 2 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
index a18a09a0c3..80dff0788b 100644
--- a/target/arm/debug_helper.c
+++ b/target/arm/debug_helper.c
@@ -430,6 +430,37 @@ void arm_debug_excp_handler(CPUState *cs)
     }
 }
 
+/*
+ * Raise an EXCP_BKPT with the specified syndrome register value,
+ * targeting the correct exception level for debug exceptions.
+ */
+void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
+{
+    int debug_el = arm_debug_target_el(env);
+    int cur_el = arm_current_el(env);
+
+    /* FSR will only be used if the debug target EL is AArch32. */
+    env->exception.fsr = arm_debug_exception_fsr(env);
+    /*
+     * FAR is UNKNOWN: clear vaddress to avoid potentially exposing
+     * values to the guest that it shouldn't be able to see at its
+     * exception/security level.
+     */
+    env->exception.vaddress = 0;
+    /*
+     * Other kinds of architectural debug exception are ignored if
+     * they target an exception level below the current one (in QEMU
+     * this is checked by arm_generate_debug_exceptions()). Breakpoint
+     * instructions are special because they always generate an exception
+     * to somewhere: if they can't go to the configured debug exception
+     * level they are taken to the current exception level.
+     */
+    if (debug_el < cur_el) {
+        debug_el = cur_el;
+    }
+    raise_exception(env, EXCP_BKPT, syndrome, debug_el);
+}
+
 #if !defined(CONFIG_USER_ONLY)
 
 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
index 97c8c9ec77..2a8bdc2cbf 100644
--- a/target/arm/op_helper.c
+++ b/target/arm/op_helper.c
@@ -399,35 +399,6 @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
     raise_exception(env, excp, syndrome, target_el);
 }
 
-/* Raise an EXCP_BKPT with the specified syndrome register value,
- * targeting the correct exception level for debug exceptions.
- */
-void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
-{
-    int debug_el = arm_debug_target_el(env);
-    int cur_el = arm_current_el(env);
-
-    /* FSR will only be used if the debug target EL is AArch32. */
-    env->exception.fsr = arm_debug_exception_fsr(env);
-    /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
-     * values to the guest that it shouldn't be able to see at its
-     * exception/security level.
-     */
-    env->exception.vaddress = 0;
-    /*
-     * Other kinds of architectural debug exception are ignored if
-     * they target an exception level below the current one (in QEMU
-     * this is checked by arm_generate_debug_exceptions()). Breakpoint
-     * instructions are special because they always generate an exception
-     * to somewhere: if they can't go to the configured debug exception
-     * level they are taken to the current exception level.
-     */
-    if (debug_el < cur_el) {
-        debug_el = cur_el;
-    }
-    raise_exception(env, EXCP_BKPT, syndrome, debug_el);
-}
-
 uint32_t HELPER(cpsr_read)(CPUARMState *env)
 {
     return cpsr_read(env) & ~CPSR_EXEC;
-- 
2.34.1



  parent reply	other threads:[~2022-06-09 20:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 20:28 [PATCH v3 00/23] target/arm: tidy exception routing Richard Henderson
2022-06-09 20:28 ` [PATCH v3 01/23] target/arm: Mark exception helpers as noreturn Richard Henderson
2022-06-09 20:28 ` [PATCH v3 02/23] target/arm: Add coproc parameter to syn_fp_access_trap Richard Henderson
2022-06-09 20:28 ` [PATCH v3 03/23] target/arm: Move exception_target_el out of line Richard Henderson
2022-06-09 20:28 ` [PATCH v3 04/23] target/arm: Move arm_singlestep_active " Richard Henderson
2022-06-09 20:28 ` [PATCH v3 05/23] target/arm: Move arm_generate_debug_exceptions " Richard Henderson
2022-06-09 20:28 ` [PATCH v3 06/23] target/arm: Use is_a64 in arm_generate_debug_exceptions Richard Henderson
2022-06-09 20:28 ` Richard Henderson [this message]
2022-06-09 20:28 ` [PATCH v3 08/23] target/arm: Move arm_debug_exception_fsr to debug_helper.c Richard Henderson
2022-06-09 20:28 ` [PATCH v3 09/23] target/arm: Rename helper_exception_with_syndrome Richard Henderson
2022-06-09 20:28 ` [PATCH v3 10/23] target/arm: Introduce gen_exception_insn_el_v Richard Henderson
2022-06-09 20:28 ` [PATCH v3 11/23] target/arm: Rename gen_exception_insn to gen_exception_insn_el Richard Henderson
2022-06-09 20:28 ` [PATCH v3 12/23] target/arm: Introduce gen_exception_insn Richard Henderson
2022-06-09 20:28 ` [PATCH v3 13/23] target/arm: Create helper_exception_swstep Richard Henderson
2022-06-09 20:28 ` [PATCH v3 14/23] target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL Richard Henderson
2022-06-09 20:28 ` [PATCH v3 15/23] target/arm: Move gen_exception to translate.c Richard Henderson
2022-06-09 20:28 ` [PATCH v3 16/23] target/arm: Rename gen_exception to gen_exception_el Richard Henderson
2022-06-09 20:28 ` [PATCH v3 17/23] target/arm: Introduce gen_exception Richard Henderson
2022-06-09 20:28 ` [PATCH v3 18/23] target/arm: Introduce gen_exception_el_v Richard Henderson
2022-06-09 20:28 ` [PATCH v3 19/23] target/arm: Introduce helper_exception_with_syndrome Richard Henderson
2022-06-09 20:28 ` [PATCH v3 20/23] target/arm: Remove default_exception_el Richard Henderson
2022-06-09 20:28 ` [PATCH v3 21/23] target/arm: Create raise_exception_debug Richard Henderson
2022-06-09 20:29 ` [PATCH v3 22/23] target/arm: Move arm_debug_target_el to debug_helper.c Richard Henderson
2022-06-09 20:29 ` [PATCH v3 23/23] target/arm: Fix Secure PL1 tests in fp_exception_el Richard Henderson
2022-06-10 12:52 ` [PATCH v3 00/23] target/arm: tidy exception routing Peter Maydell

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=20220609202901.1177572-8-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).