diff mbox series

[PATCH-for-10.1,5/8] target/mips: Replace ldtul_p() -> ldn_p(sizeof(target_ulong))

Message ID 20250325154058.92735-6-philmd@linaro.org
State New
Headers show
Series target/mips: Make 'cpu-qom.h' target agnostic | expand

Commit Message

Philippe Mathieu-Daudé March 25, 2025, 3:40 p.m. UTC
Replace the single ldtul_p() call by a generic ldn_p() one.
No logical change.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/mips/gdbstub.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Pierrick Bouvier March 26, 2025, 3:24 p.m. UTC | #1
On 3/25/25 08:40, Philippe Mathieu-Daudé wrote:
> Replace the single ldtul_p() call by a generic ldn_p() one.
> No logical change.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/mips/gdbstub.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/target/mips/gdbstub.c b/target/mips/gdbstub.c
> index 169d47416a6..b9fc667373e 100644
> --- a/target/mips/gdbstub.c
> +++ b/target/mips/gdbstub.c
> @@ -79,12 +79,13 @@ int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>   {
>       CPUMIPSState *env = cpu_env(cs);
>       target_ulong tmp;
> +    size_t regsize = sizeof(tmp);
>   
> -    tmp = ldtul_p(mem_buf);
> +    tmp = ldn_p(mem_buf, regsize);
>   
>       if (n < 32) {
>           env->active_tc.gpr[n] = tmp;
> -        return sizeof(target_ulong);
> +        return regsize;
>       }
>       if (env->CP0_Config1 & (1 << CP0C1_FP) && n >= 38 && n < 72) {
>           switch (n) {
> @@ -104,7 +105,7 @@ int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>               }
>               break;
>           }
> -        return sizeof(target_ulong);
> +        return regsize;
>       }
>       switch (n) {
>       case 32:
> @@ -144,5 +145,5 @@ int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>           break;
>       }
>   
> -    return sizeof(target_ulong);
> +    return regsize;
>   }

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/target/mips/gdbstub.c b/target/mips/gdbstub.c
index 169d47416a6..b9fc667373e 100644
--- a/target/mips/gdbstub.c
+++ b/target/mips/gdbstub.c
@@ -79,12 +79,13 @@  int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
 {
     CPUMIPSState *env = cpu_env(cs);
     target_ulong tmp;
+    size_t regsize = sizeof(tmp);
 
-    tmp = ldtul_p(mem_buf);
+    tmp = ldn_p(mem_buf, regsize);
 
     if (n < 32) {
         env->active_tc.gpr[n] = tmp;
-        return sizeof(target_ulong);
+        return regsize;
     }
     if (env->CP0_Config1 & (1 << CP0C1_FP) && n >= 38 && n < 72) {
         switch (n) {
@@ -104,7 +105,7 @@  int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
             }
             break;
         }
-        return sizeof(target_ulong);
+        return regsize;
     }
     switch (n) {
     case 32:
@@ -144,5 +145,5 @@  int mips_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         break;
     }
 
-    return sizeof(target_ulong);
+    return regsize;
 }