diff mbox series

[PATCH-for-10.1,2/3] target/sparc: Inline qemu_get_betl() and qemu_put_betl()

Message ID 20250323225047.35419-3-philmd@linaro.org
State New
Headers show
Series migration/cpu: Remove qemu_{get, put}_[s]betl[s] macros | expand

Commit Message

Philippe Mathieu-Daudé March 23, 2025, 10:50 p.m. UTC
We only use qemu_get_betl() and qemu_put_betl() once in
the whole code base. Inline them (checking TARGET_SPARC64
instead of TARGET_LONG_BITS == 64) so we can remove them
later as unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/sparc/machine.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Pierrick Bouvier March 24, 2025, 8:53 p.m. UTC | #1
On 3/23/25 15:50, Philippe Mathieu-Daudé wrote:
> We only use qemu_get_betl() and qemu_put_betl() once in
> the whole code base. Inline them (checking TARGET_SPARC64
> instead of TARGET_LONG_BITS == 64) so we can remove them
> later as unused.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/sparc/machine.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/target/sparc/machine.c b/target/sparc/machine.c
> index 222e5709c55..cc58812781b 100644
> --- a/target/sparc/machine.c
> +++ b/target/sparc/machine.c
> @@ -87,7 +87,13 @@ static int get_fsr(QEMUFile *f, void *opaque, size_t size,
>                      const VMStateField *field)
>   {
>       SPARCCPU *cpu = opaque;
> -    target_ulong val = qemu_get_betl(f);
> +    target_ulong val;
> +
> +#ifdef TARGET_SPARC64
> +    val = qemu_get_be64(f);
> +#else
> +    val = qemu_get_be32(f);
> +#endif
>   
>       cpu_put_fsr(&cpu->env, val);
>       return 0;
> @@ -99,7 +105,11 @@ static int put_fsr(QEMUFile *f, void *opaque, size_t size,
>       SPARCCPU *cpu = opaque;
>       target_ulong val = cpu_get_fsr(&cpu->env);
>   
> -    qemu_put_betl(f, val);
> +#ifdef TARGET_SPARC64
> +    qemu_put_be64(f, val);
> +#else
> +    qemu_put_be32(f, val);
> +#endif
>       return 0;
>   }
>   

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

Patch

diff --git a/target/sparc/machine.c b/target/sparc/machine.c
index 222e5709c55..cc58812781b 100644
--- a/target/sparc/machine.c
+++ b/target/sparc/machine.c
@@ -87,7 +87,13 @@  static int get_fsr(QEMUFile *f, void *opaque, size_t size,
                    const VMStateField *field)
 {
     SPARCCPU *cpu = opaque;
-    target_ulong val = qemu_get_betl(f);
+    target_ulong val;
+
+#ifdef TARGET_SPARC64
+    val = qemu_get_be64(f);
+#else
+    val = qemu_get_be32(f);
+#endif
 
     cpu_put_fsr(&cpu->env, val);
     return 0;
@@ -99,7 +105,11 @@  static int put_fsr(QEMUFile *f, void *opaque, size_t size,
     SPARCCPU *cpu = opaque;
     target_ulong val = cpu_get_fsr(&cpu->env);
 
-    qemu_put_betl(f, val);
+#ifdef TARGET_SPARC64
+    qemu_put_be64(f, val);
+#else
+    qemu_put_be32(f, val);
+#endif
     return 0;
 }