[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/15] target/ppc: Restrict powerpc_checkstop() to TCG
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 07/15] target/ppc: Restrict powerpc_checkstop() to TCG |
Date: |
Thu, 23 Jan 2025 22:56:01 +0100 |
Expose powerpc_checkstop() prototype, and move it to
tcg-excp_helper.c, only built when TCG is available.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/internal.h | 2 ++
target/ppc/excp_helper.c | 26 --------------------------
target/ppc/tcg-excp_helper.c | 28 ++++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index 46db6adfcf6..42e33be496f 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -289,6 +289,8 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr
physaddr,
void ppc_cpu_debug_excp_handler(CPUState *cs);
bool ppc_cpu_debug_check_breakpoint(CPUState *cs);
bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp);
+
+G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason);
#endif
FIELD(GER_MSK, XMSK, 0, 4)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index b08cd53688c..236e5078f56 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -400,32 +400,6 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu,
target_ulong vector,
}
#ifdef CONFIG_TCG
-/*
- * This stops the machine and logs CPU state without killing QEMU (like
- * cpu_abort()) because it is often a guest error as opposed to a QEMU error,
- * so the machine can still be debugged.
- */
-static G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason)
-{
- CPUState *cs = env_cpu(env);
- FILE *f;
-
- f = qemu_log_trylock();
- if (f) {
- fprintf(f, "Entering checkstop state: %s\n", reason);
- cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP);
- qemu_log_unlock(f);
- }
-
- /*
- * This stops the machine and logs CPU state without killing QEMU
- * (like cpu_abort()) so the machine can still be debugged (because
- * it is often a guest error).
- */
- qemu_system_guest_panicked(NULL);
- cpu_loop_exit_noexc(cs);
-}
-
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
void helper_attn(CPUPPCState *env)
{
diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c
index 6950b78774d..93c2d6b5a03 100644
--- a/target/ppc/tcg-excp_helper.c
+++ b/target/ppc/tcg-excp_helper.c
@@ -17,7 +17,9 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "exec/cpu_ldst.h"
+#include "system/runstate.h"
#include "hw/ppc/ppc.h"
#include "internal.h"
@@ -199,6 +201,32 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs,
CPUWatchpoint *wp)
return false;
}
+/*
+ * This stops the machine and logs CPU state without killing QEMU (like
+ * cpu_abort()) because it is often a guest error as opposed to a QEMU error,
+ * so the machine can still be debugged.
+ */
+G_NORETURN void powerpc_checkstop(CPUPPCState *env, const char *reason)
+{
+ CPUState *cs = env_cpu(env);
+ FILE *f;
+
+ f = qemu_log_trylock();
+ if (f) {
+ fprintf(f, "Entering checkstop state: %s\n", reason);
+ cpu_dump_state(cs, f, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+ qemu_log_unlock(f);
+ }
+
+ /*
+ * This stops the machine and logs CPU state without killing QEMU
+ * (like cpu_abort()) so the machine can still be debugged (because
+ * it is often a guest error).
+ */
+ qemu_system_guest_panicked(NULL);
+ cpu_loop_exit_noexc(cs);
+}
+
/* Return true iff byteswap is needed to load instruction */
static inline bool insn_need_byteswap(CPUArchState *env)
{
--
2.47.1
- [PATCH 00/15] target/ppc: Move TCG code from excp_helper.c to tcg-excp_helper.c, Philippe Mathieu-Daudé, 2025/01/23
- [RFC PATCH 01/15] hw/ppc/spapr: Restrict CONFER hypercall to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 02/15] hw/ppc/spapr: Restrict part of PAGE_INIT hypercall to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 03/15] target/ppc: Make ppc_ldl_code() declaration public, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 04/15] target/ppc: Move TCG specific exception handlers to tcg-excp_helper.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 06/15] target/ppc: Ensure powerpc_checkstop() is only called under TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 07/15] target/ppc: Restrict powerpc_checkstop() to TCG,
Philippe Mathieu-Daudé <=
- [PATCH 08/15] target/ppc: Remove raise_exception_ra(), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 09/15] target/ppc: Restrict exception helpers to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 10/15] target/ppc: Restrict ppc_tcg_hv_emu() to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 11/15] target/ppc: Restrict various common helpers to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 12/15] target/ppc: Fix style in excp_helper.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 14/15] target/ppc: Restrict various system helpers to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 13/15] target/ppc: Make powerpc_excp() prototype public, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 15/15] target/ppc: Restrict ATTN helper to TCG, Philippe Mathieu-Daudé, 2025/01/23