diff mbox series

[PATCH-for-10.1,3/5] target/ppc/gdbstub: Replace TARGET_LONG_SIZE -> sizeof(target_ulong)

Message ID 20250325130221.76116-4-philmd@linaro.org
State New
Headers show
Series exec: Remove TARGET_LONG_SIZE definition | expand

Commit Message

Philippe Mathieu-Daudé March 25, 2025, 1:02 p.m. UTC
TARGET_LONG_SIZE is equivalent of sizeof(target_ulong).
Since this is the single use of TARGET_LONG_SIZE in a
source file, use the equivalent form to be able to remove
the definition in a pair of commits.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/gdbstub.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
index 3b28d4e21c7..4d36dcfb563 100644
--- a/target/ppc/gdbstub.c
+++ b/target/ppc/gdbstub.c
@@ -367,6 +367,7 @@  static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);
     CPUPPCState *env = &cpu->env;
+    target_ulong val;
     int reg;
     int len;
 
@@ -375,10 +376,7 @@  static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
         return 0;
     }
 
-    len = TARGET_LONG_SIZE;
-
     /* Handle those SPRs that are not part of the env->spr[] array */
-    target_ulong val;
     switch (reg) {
 #if defined(TARGET_PPC64)
     case SPR_CFAR:
@@ -402,6 +400,7 @@  static int gdb_get_spr_reg(CPUState *cs, GByteArray *buf, int n)
     }
     gdb_get_regl(buf, val);
 
+    len = sizeof(val);
     ppc_maybe_bswap_register(env, gdb_get_reg_ptr(buf, len), len);
     return len;
 }
@@ -410,6 +409,7 @@  static int gdb_set_spr_reg(CPUState *cs, uint8_t *mem_buf, int n)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);
     CPUPPCState *env = &cpu->env;
+    target_ulong val;
     int reg;
     int len;
 
@@ -418,11 +418,11 @@  static int gdb_set_spr_reg(CPUState *cs, uint8_t *mem_buf, int n)
         return 0;
     }
 
-    len = TARGET_LONG_SIZE;
+    len = sizeof(val);
     ppc_maybe_bswap_register(env, mem_buf, len);
 
     /* Handle those SPRs that are not part of the env->spr[] array */
-    target_ulong val = ldn_p(mem_buf, len);
+    val = ldn_p(mem_buf, len);
     switch (reg) {
 #if defined(TARGET_PPC64)
     case SPR_CFAR: