[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c |
Date: |
Mon, 27 Jan 2025 11:26:09 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/excp_helper.c | 21 ---------------------
target/ppc/tcg-excp_helper.c | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index b05eb7f5aec..8956466db1d 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -136,27 +136,6 @@ static void dump_hcall(CPUPPCState *env)
env->nip);
}
-#ifdef CONFIG_TCG
-/* Return true iff byteswap is needed to load instruction */
-static inline bool insn_need_byteswap(CPUArchState *env)
-{
- /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */
- return !!(env->msr & ((target_ulong)1 << MSR_LE));
-}
-
-uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr)
-{
- uint32_t insn = cpu_ldl_code(env, addr);
-
- if (insn_need_byteswap(env)) {
- insn = bswap32(insn);
- }
-
- return insn;
-}
-
-#endif
-
static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp)
{
const char *es;
diff --git a/target/ppc/tcg-excp_helper.c b/target/ppc/tcg-excp_helper.c
index 3402dbe05ee..6950b78774d 100644
--- a/target/ppc/tcg-excp_helper.c
+++ b/target/ppc/tcg-excp_helper.c
@@ -199,4 +199,22 @@ bool ppc_cpu_debug_check_watchpoint(CPUState *cs,
CPUWatchpoint *wp)
return false;
}
+/* Return true iff byteswap is needed to load instruction */
+static inline bool insn_need_byteswap(CPUArchState *env)
+{
+ /* SYSTEM builds TARGET_BIG_ENDIAN. Need to swap when MSR[LE] is set */
+ return !!(env->msr & ((target_ulong)1 << MSR_LE));
+}
+
+uint32_t ppc_ldl_code(CPUArchState *env, target_ulong addr)
+{
+ uint32_t insn = cpu_ldl_code(env, addr);
+
+ if (insn_need_byteswap(env)) {
+ insn = bswap32(insn);
+ }
+
+ return insn;
+}
+
#endif /* !CONFIG_USER_ONLY */
--
2.47.1
- Re: [PATCH v2 01/15] hw/ppc/spapr: Restrict CONFER hypercall to TCG, (continued)
- [PATCH v2 02/15] hw/ppc/spapr: Restrict part of PAGE_INIT hypercall to TCG, Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 03/15] target/ppc: Make ppc_ldl_code() declaration public, Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 04/15] target/ppc: Move TCG specific exception handlers to tcg-excp_helper.c, Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 06/15] target/ppc: Ensure powerpc_checkstop() is only called under TCG, Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 05/15] target/ppc: Move ppc_ldl_code() to tcg-excp_helper.c,
Philippe Mathieu-Daudé <=
- [PATCH v2 07/15] target/ppc: Restrict powerpc_checkstop() to TCG, Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 08/15] target/ppc: Remove raise_exception_ra(), Philippe Mathieu-Daudé, 2025/01/27
- [PATCH v2 09/15] target/ppc: Restrict exception helpers to TCG, Philippe Mathieu-Daudé, 2025/01/27