[PATCH v2 3/5] target/hppa: Use explicit big-endian LD/ST API

Philippe Mathieu-Daudé posted 5 patches 1 week, 1 day ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>
[PATCH v2 3/5] target/hppa: Use explicit big-endian LD/ST API
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
The HPPA architecture uses big endianness. Directly use
the big-endian LD/ST API.

Mechanical change using:

  $ end=be; \
    for acc in uw w l q tul; do \
      sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
             -e "s/st${acc}_p(/st${acc}_${end}_p(/" \
        $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/hppa/); \
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/hppa/gdbstub.c    | 2 +-
 target/hppa/int_helper.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
index 0c5e41410a0..4f016a0e61d 100644
--- a/target/hppa/gdbstub.c
+++ b/target/hppa/gdbstub.c
@@ -168,7 +168,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
         return 0;
     }
 
-    val = ldn_p(mem_buf, hppa_reg_size(env));
+    val = ldn_be_p(mem_buf, hppa_reg_size(env));
 
     switch (n) {
     case 0:
diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
index 4e4869285b5..d5a20cd549d 100644
--- a/target/hppa/int_helper.c
+++ b/target/hppa/int_helper.c
@@ -178,7 +178,7 @@ void hppa_cpu_do_interrupt(CPUState *cs)
                         break;
                     }
                 }
-                env->cr[CR_IIR] = ldl_phys(cs->as, paddr);
+                env->cr[CR_IIR] = ldl_be_phys(cs->as, paddr);
                 if (i == EXCP_ASSIST) {
                     /* stuff insn code into bits of FP exception register #1 */
                     env->fr[0] |= (env->cr[CR_IIR] & 0x03ffffff);
-- 
2.52.0


Re: [PATCH v2 3/5] target/hppa: Use explicit big-endian LD/ST API
Posted by Richard Henderson 2 days, 6 hours ago
On 12/30/25 09:55, Philippe Mathieu-Daudé wrote:
> The HPPA architecture uses big endianness. Directly use
> the big-endian LD/ST API.
> 
> Mechanical change using:
> 
>    $ end=be; \
>      for acc in uw w l q tul; do \
>        sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
>               -e "s/st${acc}_p(/st${acc}_${end}_p(/" \
>          $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/hppa/); \
>      done
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/hppa/gdbstub.c    | 2 +-
>   target/hppa/int_helper.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH v2 3/5] target/hppa: Use explicit big-endian LD/ST API
Posted by Manos Pitsidianakis 1 week, 1 day ago
On Tue, Dec 30, 2025 at 12:55 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> The HPPA architecture uses big endianness. Directly use
> the big-endian LD/ST API.
>
> Mechanical change using:
>
>   $ end=be; \
>     for acc in uw w l q tul; do \
>       sed -i -e "s/ld${acc}_p(/ld${acc}_${end}_p(/" \
>              -e "s/st${acc}_p(/st${acc}_${end}_p(/" \
>         $(git grep -wlE '(ld|st)t?u?[wlq]_p' target/hppa/); \
>     done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  target/hppa/gdbstub.c    | 2 +-
>  target/hppa/int_helper.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
> index 0c5e41410a0..4f016a0e61d 100644
> --- a/target/hppa/gdbstub.c
> +++ b/target/hppa/gdbstub.c
> @@ -168,7 +168,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>          return 0;
>      }
>
> -    val = ldn_p(mem_buf, hppa_reg_size(env));
> +    val = ldn_be_p(mem_buf, hppa_reg_size(env));
>
>      switch (n) {
>      case 0:
> diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
> index 4e4869285b5..d5a20cd549d 100644
> --- a/target/hppa/int_helper.c
> +++ b/target/hppa/int_helper.c
> @@ -178,7 +178,7 @@ void hppa_cpu_do_interrupt(CPUState *cs)
>                          break;
>                      }
>                  }
> -                env->cr[CR_IIR] = ldl_phys(cs->as, paddr);
> +                env->cr[CR_IIR] = ldl_be_phys(cs->as, paddr);
>                  if (i == EXCP_ASSIST) {
>                      /* stuff insn code into bits of FP exception register #1 */
>                      env->fr[0] |= (env->cr[CR_IIR] & 0x03ffffff);
> --
> 2.52.0
>