[PATCH 2/4] target/openrisc: Use explicit big-endian LD/ST API

Philippe Mathieu-Daudé posted 4 patches 1 month, 2 weeks ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Jia Liu <proljc@gmail.com>, Stafford Horne <shorne@gmail.com>
[PATCH 2/4] target/openrisc: Use explicit big-endian LD/ST API
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
The OpenRISC architecture uses big endianness. Directly
use the big-endian LD/ST API.

Mechanical change running:

  $ for a in uw w l q; do \
      sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
        $(git grep -wlE '(ld|st)u?[wlq]_p' target/openrisc/);
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/openrisc/gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c
index 45bba80d878..ca1592c6200 100644
--- a/target/openrisc/gdbstub.c
+++ b/target/openrisc/gdbstub.c
@@ -50,7 +50,7 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
     CPUOpenRISCState *env = cpu_env(cs);
     uint32_t tmp;
 
-    tmp = ldl_p(mem_buf);
+    tmp = ldl_be_p(mem_buf);
 
     if (n < 32) {
         cpu_set_gpr(env, n, tmp);
-- 
2.52.0


Re: [PATCH 2/4] target/openrisc: Use explicit big-endian LD/ST API
Posted by Richard Henderson 1 month ago
On 12/25/25 03:18, Philippe Mathieu-Daudé wrote:
> The OpenRISC architecture uses big endianness. Directly
> use the big-endian LD/ST API.
> 
> Mechanical change running:
> 
>    $ for a in uw w l q; do \
>        sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
>          $(git grep -wlE '(ld|st)u?[wlq]_p' target/openrisc/);
>      done
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/openrisc/gdbstub.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

r~

Re: [PATCH 2/4] target/openrisc: Use explicit big-endian LD/ST API
Posted by Manos Pitsidianakis 1 month, 1 week ago
On Wed, Dec 24, 2025 at 6:18 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> The OpenRISC architecture uses big endianness. Directly
> use the big-endian LD/ST API.
>
> Mechanical change running:
>
>   $ for a in uw w l q; do \
>       sed -i -e "s/ld${a}_p(/ld${a}_be_p(/" \
>         $(git grep -wlE '(ld|st)u?[wlq]_p' target/openrisc/);
>     done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

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

>  target/openrisc/gdbstub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c
> index 45bba80d878..ca1592c6200 100644
> --- a/target/openrisc/gdbstub.c
> +++ b/target/openrisc/gdbstub.c
> @@ -50,7 +50,7 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>      CPUOpenRISCState *env = cpu_env(cs);
>      uint32_t tmp;
>
> -    tmp = ldl_p(mem_buf);
> +    tmp = ldl_be_p(mem_buf);
>
>      if (n < 32) {
>          cpu_set_gpr(env, n, tmp);
> --
> 2.52.0
>