* [PATCH v2 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p()
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:10 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 02/25] target/hexagon: Replace ldtul_p() -> ldl_p() Philippe Mathieu-Daudé
` (25 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
Use ldn_p(TARGET_LONG_SIZE) instead of ldl_p() / ldq_p().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/gdbstub/helpers.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index 26140ef1ac0..fd83e366a51 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -94,10 +94,10 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
#if TARGET_LONG_BITS == 64
#define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
-#define ldtul_p(addr) ldq_p(addr)
#else
#define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
-#define ldtul_p(addr) ldl_p(addr)
#endif
+#define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
+
#endif /* _GDBSTUB_HELPERS_H_ */
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p()
2024-10-04 16:30 ` [PATCH v2 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p() Philippe Mathieu-Daudé
@ 2024-10-05 1:10 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:10 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> Use ldn_p(TARGET_LONG_SIZE) instead of ldl_p() / ldq_p().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/gdbstub/helpers.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
> index 26140ef1ac0..fd83e366a51 100644
> --- a/include/gdbstub/helpers.h
> +++ b/include/gdbstub/helpers.h
> @@ -94,10 +94,10 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
>
> #if TARGET_LONG_BITS == 64
> #define gdb_get_regl(buf, val) gdb_get_reg64(buf, val)
> -#define ldtul_p(addr) ldq_p(addr)
> #else
> #define gdb_get_regl(buf, val) gdb_get_reg32(buf, val)
> -#define ldtul_p(addr) ldl_p(addr)
> #endif
>
> +#define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
This does not aid anything in the short term.
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 02/25] target/hexagon: Replace ldtul_p() -> ldl_p()
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p() Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:08 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 03/25] target/alpha: Replace ldtul_p() -> ldq_p() Philippe Mathieu-Daudé
` (24 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The Hexagon target is only built for 64-bit.
Using ldtul_p() is pointless, replace by ldl_p().
Mechanical change doing:
$ sed -i -e 's/ldtul_p/ldl_p/' \
$(git grep -wl ldtul_p target/hexagon/)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hexagon/gdbstub.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c
index 94e1db8ef8d..557b3029785 100644
--- a/target/hexagon/gdbstub.c
+++ b/target/hexagon/gdbstub.c
@@ -52,7 +52,7 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUHexagonState *env = cpu_env(cs);
if (n == HEX_REG_P3_0_ALIASED) {
- uint32_t p3_0 = ldtul_p(mem_buf);
+ uint32_t p3_0 = ldl_p(mem_buf);
for (int i = 0; i < NUM_PREGS; i++) {
env->pred[i] = extract32(p3_0, i * 8, 8);
}
@@ -60,14 +60,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
}
if (n < TOTAL_PER_THREAD_REGS) {
- env->gpr[n] = ldtul_p(mem_buf);
+ env->gpr[n] = ldl_p(mem_buf);
return sizeof(target_ulong);
}
n -= TOTAL_PER_THREAD_REGS;
if (n < NUM_PREGS) {
- env->pred[n] = ldtul_p(mem_buf) & 0xff;
+ env->pred[n] = ldl_p(mem_buf) & 0xff;
return sizeof(uint8_t);
}
@@ -117,7 +117,7 @@ static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
{
int i;
for (i = 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) {
- env->VRegs[n].uw[i] = ldtul_p(mem_buf);
+ env->VRegs[n].uw[i] = ldl_p(mem_buf);
mem_buf += 4;
}
return MAX_VEC_SIZE_BYTES;
@@ -127,7 +127,7 @@ static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
{
int i;
for (i = 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) {
- env->QRegs[n].uw[i] = ldtul_p(mem_buf);
+ env->QRegs[n].uw[i] = ldl_p(mem_buf);
mem_buf += 4;
}
return MAX_VEC_SIZE_BYTES / 8;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 03/25] target/alpha: Replace ldtul_p() -> ldq_p()
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 01/25] gdbstub/helpers: Have ldtul_p() definition use ldn_p() Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 02/25] target/hexagon: Replace ldtul_p() -> ldl_p() Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:10 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 04/25] target/s390x: " Philippe Mathieu-Daudé
` (23 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The Alpha target is only built for 64-bit.
Using ldtul_p() is pointless, replace by ldq_p().
Mechanical change doing:
$ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/alpha/)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/alpha/gdbstub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/alpha/gdbstub.c b/target/alpha/gdbstub.c
index 13694fd321e..bf5091c2a6e 100644
--- a/target/alpha/gdbstub.c
+++ b/target/alpha/gdbstub.c
@@ -59,7 +59,7 @@ int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
int alpha_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
CPUAlphaState *env = cpu_env(cs);
- target_ulong tmp = ldtul_p(mem_buf);
+ target_ulong tmp = ldq_p(mem_buf);
CPU_DoubleU d;
switch (n) {
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 03/25] target/alpha: Replace ldtul_p() -> ldq_p()
2024-10-04 16:30 ` [PATCH v2 03/25] target/alpha: Replace ldtul_p() -> ldq_p() Philippe Mathieu-Daudé
@ 2024-10-05 1:10 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:10 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The Alpha target is only built for 64-bit.
> Using ldtul_p() is pointless, replace by ldq_p().
>
> Mechanical change doing:
>
> $ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/alpha/)
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/alpha/gdbstub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 04/25] target/s390x: Replace ldtul_p() -> ldq_p()
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 03/25] target/alpha: Replace ldtul_p() -> ldq_p() Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:11 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers Philippe Mathieu-Daudé
` (22 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The S390X target is only built for 64-bit.
Using ldtul_p() is pointless, replace by ldq_p().
Mechanical change doing:
$ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/s390x/)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/s390x/gdbstub.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c
index a9f4eb92adf..9ffec0bccbc 100644
--- a/target/s390x/gdbstub.c
+++ b/target/s390x/gdbstub.c
@@ -46,7 +46,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
CPUS390XState *env = cpu_env(cs);
- target_ulong tmpl = ldtul_p(mem_buf);
+ target_ulong tmpl = ldq_p(mem_buf);
switch (n) {
case S390_PSWM_REGNUM:
@@ -126,7 +126,7 @@ static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n)
env->fpc = ldl_p(mem_buf);
return 4;
case S390_F0_REGNUM ... S390_F15_REGNUM:
- *get_freg(env, n - S390_F0_REGNUM) = ldtul_p(mem_buf);
+ *get_freg(env, n - S390_F0_REGNUM) = ldq_p(mem_buf);
return 8;
default:
return 0;
@@ -167,11 +167,11 @@ static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_V0L_REGNUM ... S390_V15L_REGNUM:
- env->vregs[n][1] = ldtul_p(mem_buf + 8);
+ env->vregs[n][1] = ldq_p(mem_buf + 8);
return 8;
case S390_V16_REGNUM ... S390_V31_REGNUM:
- env->vregs[n][0] = ldtul_p(mem_buf);
- env->vregs[n][1] = ldtul_p(mem_buf + 8);
+ env->vregs[n][0] = ldq_p(mem_buf);
+ env->vregs[n][1] = ldq_p(mem_buf + 8);
return 16;
default:
return 0;
@@ -203,7 +203,7 @@ static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_C0_REGNUM ... S390_C15_REGNUM:
- env->cregs[n] = ldtul_p(mem_buf);
+ env->cregs[n] = ldq_p(mem_buf);
if (tcg_enabled()) {
tlb_flush(env_cpu(env));
}
@@ -246,19 +246,19 @@ static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_VIRT_CKC_REGNUM:
- env->ckc = ldtul_p(mem_buf);
+ env->ckc = ldq_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_CPUTM_REGNUM:
- env->cputm = ldtul_p(mem_buf);
+ env->cputm = ldq_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_BEA_REGNUM:
- env->gbea = ldtul_p(mem_buf);
+ env->gbea = ldq_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_PREFIX_REGNUM:
- env->psa = ldtul_p(mem_buf);
+ env->psa = ldq_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
default:
@@ -298,19 +298,19 @@ static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_VIRT_KVM_PP_REGNUM:
- env->pp = ldtul_p(mem_buf);
+ env->pp = ldq_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFT_REGNUM:
- env->pfault_token = ldtul_p(mem_buf);
+ env->pfault_token = ldq_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFS_REGNUM:
- env->pfault_select = ldtul_p(mem_buf);
+ env->pfault_select = ldq_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFC_REGNUM:
- env->pfault_compare = ldtul_p(mem_buf);
+ env->pfault_compare = ldq_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
default:
@@ -338,7 +338,7 @@ static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n)
S390CPU *cpu = S390_CPU(cs);
CPUS390XState *env = &cpu->env;
- env->gscb[n] = ldtul_p(mem_buf);
+ env->gscb[n] = ldq_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 04/25] target/s390x: Replace ldtul_p() -> ldq_p()
2024-10-04 16:30 ` [PATCH v2 04/25] target/s390x: " Philippe Mathieu-Daudé
@ 2024-10-05 1:11 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The S390X target is only built for 64-bit.
> Using ldtul_p() is pointless, replace by ldq_p().
>
> Mechanical change doing:
>
> $ sed -i -e 's/ldtul_p/ldq_p/' $(git grep -wl ldtul_p target/s390x/)
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/s390x/gdbstub.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 04/25] target/s390x: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:13 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 06/25] target/alpha: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
` (21 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
Introduce ldtul_le_p() and ldtul_be_p() to use directly
in place of ldtul_p() when a target endianness is fixed.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/gdbstub/helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
index fd83e366a51..e783d166865 100644
--- a/include/gdbstub/helpers.h
+++ b/include/gdbstub/helpers.h
@@ -99,5 +99,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
#endif
#define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
+#define ldtul_le_p(addr) ldn_le_p(addr, TARGET_LONG_SIZE)
+#define ldtul_be_p(addr) ldn_be_p(addr, TARGET_LONG_SIZE)
#endif /* _GDBSTUB_HELPERS_H_ */
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers
2024-10-04 16:30 ` [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers Philippe Mathieu-Daudé
@ 2024-10-05 1:13 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> Introduce ldtul_le_p() and ldtul_be_p() to use directly
> in place of ldtul_p() when a target endianness is fixed.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/gdbstub/helpers.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/gdbstub/helpers.h b/include/gdbstub/helpers.h
> index fd83e366a51..e783d166865 100644
> --- a/include/gdbstub/helpers.h
> +++ b/include/gdbstub/helpers.h
> @@ -99,5 +99,7 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
> #endif
>
> #define ldtul_p(addr) ldn_p(addr, TARGET_LONG_SIZE)
> +#define ldtul_le_p(addr) ldn_le_p(addr, TARGET_LONG_SIZE)
> +#define ldtul_be_p(addr) ldn_be_p(addr, TARGET_LONG_SIZE)
I'd be happier if these were defined in the preceeding ifdef for now.
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 06/25] target/alpha: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 05/25] gdbstub/helpers: Introduce ldtul_$endian_p() helpers Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:13 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 07/25] target/hexagon: " Philippe Mathieu-Daudé
` (20 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The Alpha architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/alpha/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/alpha/gdbstub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/alpha/gdbstub.c b/target/alpha/gdbstub.c
index bf5091c2a6e..1a7e2dd9202 100644
--- a/target/alpha/gdbstub.c
+++ b/target/alpha/gdbstub.c
@@ -59,7 +59,7 @@ int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
int alpha_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
CPUAlphaState *env = cpu_env(cs);
- target_ulong tmp = ldq_p(mem_buf);
+ target_ulong tmp = ldq_le_p(mem_buf);
CPU_DoubleU d;
switch (n) {
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 06/25] target/alpha: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 06/25] target/alpha: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
@ 2024-10-05 1:13 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The Alpha architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/alpha/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/alpha/gdbstub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 07/25] target/hexagon: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 06/25] target/alpha: Use explicit little-endian LD/ST API Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:16 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 08/25] hw/i386: " Philippe Mathieu-Daudé
` (19 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The Hexagon architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/hexagon/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hexagon/gdbstub.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c
index 557b3029785..12d6b3bbcbb 100644
--- a/target/hexagon/gdbstub.c
+++ b/target/hexagon/gdbstub.c
@@ -52,7 +52,7 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUHexagonState *env = cpu_env(cs);
if (n == HEX_REG_P3_0_ALIASED) {
- uint32_t p3_0 = ldl_p(mem_buf);
+ uint32_t p3_0 = ldl_le_p(mem_buf);
for (int i = 0; i < NUM_PREGS; i++) {
env->pred[i] = extract32(p3_0, i * 8, 8);
}
@@ -60,14 +60,14 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
}
if (n < TOTAL_PER_THREAD_REGS) {
- env->gpr[n] = ldl_p(mem_buf);
+ env->gpr[n] = ldl_le_p(mem_buf);
return sizeof(target_ulong);
}
n -= TOTAL_PER_THREAD_REGS;
if (n < NUM_PREGS) {
- env->pred[n] = ldl_p(mem_buf) & 0xff;
+ env->pred[n] = ldl_le_p(mem_buf) & 0xff;
return sizeof(uint8_t);
}
@@ -117,7 +117,7 @@ static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
{
int i;
for (i = 0; i < ARRAY_SIZE(env->VRegs[n].uw); i++) {
- env->VRegs[n].uw[i] = ldl_p(mem_buf);
+ env->VRegs[n].uw[i] = ldl_le_p(mem_buf);
mem_buf += 4;
}
return MAX_VEC_SIZE_BYTES;
@@ -127,7 +127,7 @@ static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
{
int i;
for (i = 0; i < ARRAY_SIZE(env->QRegs[n].uw); i++) {
- env->QRegs[n].uw[i] = ldl_p(mem_buf);
+ env->QRegs[n].uw[i] = ldl_le_p(mem_buf);
mem_buf += 4;
}
return MAX_VEC_SIZE_BYTES / 8;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 07/25] target/hexagon: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 07/25] target/hexagon: " Philippe Mathieu-Daudé
@ 2024-10-05 1:16 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The Hexagon architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/hexagon/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/hexagon/gdbstub.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 08/25] hw/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 07/25] target/hexagon: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:17 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 09/25] target/i386: " Philippe Mathieu-Daudé
` (18 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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' hw/i386/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/multiboot.c | 36 ++++++++++++++++++------------------
hw/i386/x86-common.c | 26 +++++++++++++-------------
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 3332712ab35..ba4ead5270c 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -133,9 +133,9 @@ static void mb_add_mod(MultibootState *s,
p = (char *)s->mb_buf + s->offset_mbinfo + MB_MOD_SIZE * s->mb_mods_count;
- stl_p(p + MB_MOD_START, start);
- stl_p(p + MB_MOD_END, end);
- stl_p(p + MB_MOD_CMDLINE, cmdline_phys);
+ stl_le_p(p + MB_MOD_START, start);
+ stl_le_p(p + MB_MOD_END, end);
+ stl_le_p(p + MB_MOD_CMDLINE, cmdline_phys);
mb_debug("mod%02d: "HWADDR_FMT_plx" - "HWADDR_FMT_plx,
s->mb_mods_count, start, end);
@@ -168,9 +168,9 @@ int load_multiboot(X86MachineState *x86ms,
/* Ok, let's see if it is a multiboot image.
The header is 12x32bit long, so the latest entry may be 8192 - 48. */
for (i = 0; i < (8192 - 48); i += 4) {
- if (ldl_p(header+i) == 0x1BADB002) {
- uint32_t checksum = ldl_p(header+i+8);
- flags = ldl_p(header+i+4);
+ if (ldl_le_p(header+i) == 0x1BADB002) {
+ uint32_t checksum = ldl_le_p(header+i+8);
+ flags = ldl_le_p(header+i+4);
checksum += flags;
checksum += (uint32_t)0x1BADB002;
if (!checksum) {
@@ -223,11 +223,11 @@ int load_multiboot(X86MachineState *x86ms,
mb_kernel_size, (size_t)mh_entry_addr);
} else {
/* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
- uint32_t mh_header_addr = ldl_p(header+i+12);
- uint32_t mh_load_end_addr = ldl_p(header+i+20);
- uint32_t mh_bss_end_addr = ldl_p(header+i+24);
+ uint32_t mh_header_addr = ldl_le_p(header+i+12);
+ uint32_t mh_load_end_addr = ldl_le_p(header+i+20);
+ uint32_t mh_bss_end_addr = ldl_le_p(header+i+24);
- mh_load_addr = ldl_p(header+i+16);
+ mh_load_addr = ldl_le_p(header+i+16);
if (mh_header_addr < mh_load_addr) {
error_report("invalid load_addr address");
exit(1);
@@ -239,7 +239,7 @@ int load_multiboot(X86MachineState *x86ms,
uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr);
uint32_t mb_load_size = 0;
- mh_entry_addr = ldl_p(header+i+28);
+ mh_entry_addr = ldl_le_p(header+i+28);
if (mh_load_end_addr) {
if (mh_load_end_addr < mh_load_addr) {
@@ -364,22 +364,22 @@ int load_multiboot(X86MachineState *x86ms,
/* Commandline support */
kcmdline = g_strdup_printf("%s %s", kernel_filename, kernel_cmdline);
- stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline));
+ stl_le_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline));
- stl_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name));
+ stl_le_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, bootloader_name));
- stl_p(bootinfo + MBI_MODS_ADDR, mbs.mb_buf_phys + mbs.offset_mbinfo);
- stl_p(bootinfo + MBI_MODS_COUNT, mbs.mb_mods_count); /* mods_count */
+ stl_le_p(bootinfo + MBI_MODS_ADDR, mbs.mb_buf_phys + mbs.offset_mbinfo);
+ stl_le_p(bootinfo + MBI_MODS_COUNT, mbs.mb_mods_count); /* mods_count */
/* the kernel is where we want it to be now */
- stl_p(bootinfo + MBI_FLAGS, MULTIBOOT_FLAGS_MEMORY
+ stl_le_p(bootinfo + MBI_FLAGS, MULTIBOOT_FLAGS_MEMORY
| MULTIBOOT_FLAGS_BOOT_DEVICE
| MULTIBOOT_FLAGS_CMDLINE
| MULTIBOOT_FLAGS_MODULES
| MULTIBOOT_FLAGS_MMAP
| MULTIBOOT_FLAGS_BOOTLOADER);
- stl_p(bootinfo + MBI_BOOT_DEVICE, 0x8000ffff); /* XXX: use the -boot switch? */
- stl_p(bootinfo + MBI_MMAP_ADDR, ADDR_E820_MAP);
+ stl_le_p(bootinfo + MBI_BOOT_DEVICE, 0x8000ffff); /* XXX: use the -boot switch? */
+ stl_le_p(bootinfo + MBI_MMAP_ADDR, ADDR_E820_MAP);
mb_debug("multiboot: entry_addr = %#x", mh_entry_addr);
mb_debug(" mb_buf_phys = "HWADDR_FMT_plx, mbs.mb_buf_phys);
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 992ea1f25e9..b86c38212ea 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -586,7 +586,7 @@ static bool load_elfboot(const char *kernel_filename,
uint64_t elf_low, elf_high;
int kernel_size;
- if (ldl_p(header) != 0x464c457f) {
+ if (ldl_le_p(header) != 0x464c457f) {
return false; /* no elfboot */
}
@@ -669,8 +669,8 @@ void x86_load_linux(X86MachineState *x86ms,
* kernel protocol version.
* Please see https://www.kernel.org/doc/Documentation/x86/boot.txt
*/
- if (ldl_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ {
- protocol = lduw_p(header + 0x206);
+ if (ldl_le_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ {
+ protocol = lduw_le_p(header + 0x206);
} else {
/*
* This could be a multiboot kernel. If it is, let's stop treating it
@@ -762,7 +762,7 @@ void x86_load_linux(X86MachineState *x86ms,
/* highest address for loading the initrd */
if (protocol >= 0x20c &&
- lduw_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
+ lduw_le_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
/*
* Linux has supported initrd up to 4 GB for a very long time (2007,
* long before XLF_CAN_BE_LOADED_ABOVE_4G which was added in 2013),
@@ -781,7 +781,7 @@ void x86_load_linux(X86MachineState *x86ms,
*/
initrd_max = UINT32_MAX;
} else if (protocol >= 0x203) {
- initrd_max = ldl_p(header + 0x22c);
+ initrd_max = ldl_le_p(header + 0x22c);
} else {
initrd_max = 0x37ffffff;
}
@@ -797,10 +797,10 @@ void x86_load_linux(X86MachineState *x86ms,
sev_load_ctx.cmdline_size = strlen(kernel_cmdline) + 1;
if (protocol >= 0x202) {
- stl_p(header + 0x228, cmdline_addr);
+ stl_le_p(header + 0x228, cmdline_addr);
} else {
- stw_p(header + 0x20, 0xA33F);
- stw_p(header + 0x22, cmdline_addr - real_addr);
+ stw_le_p(header + 0x20, 0xA33F);
+ stw_le_p(header + 0x22, cmdline_addr - real_addr);
}
/* handle vga= parameter */
@@ -824,7 +824,7 @@ void x86_load_linux(X86MachineState *x86ms,
exit(1);
}
}
- stw_p(header + 0x1fa, video_mode);
+ stw_le_p(header + 0x1fa, video_mode);
}
/* loader type */
@@ -839,7 +839,7 @@ void x86_load_linux(X86MachineState *x86ms,
/* heap */
if (protocol >= 0x201) {
header[0x211] |= 0x80; /* CAN_USE_HEAP */
- stw_p(header + 0x224, cmdline_addr - real_addr - 0x200);
+ stw_le_p(header + 0x224, cmdline_addr - real_addr - 0x200);
}
/* load initrd */
@@ -879,8 +879,8 @@ void x86_load_linux(X86MachineState *x86ms,
sev_load_ctx.initrd_data = initrd_data;
sev_load_ctx.initrd_size = initrd_size;
- stl_p(header + 0x218, initrd_addr);
- stl_p(header + 0x21c, initrd_size);
+ stl_le_p(header + 0x218, initrd_addr);
+ stl_le_p(header + 0x21c, initrd_size);
}
/* load kernel and setup */
@@ -926,7 +926,7 @@ void x86_load_linux(X86MachineState *x86ms,
kernel_size = setup_data_offset + sizeof(struct setup_data) + dtb_size;
kernel = g_realloc(kernel, kernel_size);
- stq_p(header + 0x250, prot_addr + setup_data_offset);
+ stq_le_p(header + 0x250, prot_addr + setup_data_offset);
setup_data = (struct setup_data *)(kernel + setup_data_offset);
setup_data->next = 0;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 08/25] hw/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 08/25] hw/i386: " Philippe Mathieu-Daudé
@ 2024-10-05 1:17 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The x86 architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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' hw/i386/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/i386/multiboot.c | 36 ++++++++++++++++++------------------
> hw/i386/x86-common.c | 26 +++++++++++++-------------
> 2 files changed, 31 insertions(+), 31 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 09/25] target/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 08/25] hw/i386: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:18 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 10/25] target/avr: " Philippe Mathieu-Daudé
` (17 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/i386/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/gdbstub.c | 30 +++++++++++++-------------
target/i386/tcg/sysemu/excp_helper.c | 4 ++--
target/i386/xsave_helper.c | 32 ++++++++++++++--------------
3 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index 4acf485879e..28ccf06309d 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -89,10 +89,10 @@ static int gdb_read_reg_cs64(uint32_t hflags, GByteArray *buf, target_ulong val)
static int gdb_write_reg_cs64(uint32_t hflags, uint8_t *buf, target_ulong *val)
{
if (hflags & HF_CS64_MASK) {
- *val = ldq_p(buf);
+ *val = ldq_le_p(buf);
return 8;
}
- *val = ldl_p(buf);
+ *val = ldl_le_p(buf);
return 4;
}
@@ -221,7 +221,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf)
{
CPUX86State *env = &cpu->env;
- uint16_t selector = ldl_p(mem_buf);
+ uint16_t selector = ldl_le_p(mem_buf);
if (selector != env->segs[sreg].selector) {
#if defined(CONFIG_USER_ONLY)
@@ -262,15 +262,15 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
if (n < CPU_NB_REGS) {
if (TARGET_LONG_BITS == 64) {
if (env->hflags & HF_CS64_MASK) {
- env->regs[gpr_map[n]] = ldtul_p(mem_buf);
+ env->regs[gpr_map[n]] = ldtul_le_p(mem_buf);
} else if (n < CPU_NB_REGS32) {
- env->regs[gpr_map[n]] = ldtul_p(mem_buf) & 0xffffffffUL;
+ env->regs[gpr_map[n]] = ldtul_le_p(mem_buf) & 0xffffffffUL;
}
return sizeof(target_ulong);
} else if (n < CPU_NB_REGS32) {
n = gpr_map32[n];
env->regs[n] &= ~0xffffffffUL;
- env->regs[n] |= (uint32_t)ldl_p(mem_buf);
+ env->regs[n] |= (uint32_t)ldl_le_p(mem_buf);
return 4;
}
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
@@ -281,8 +281,8 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
} else if (n >= IDX_XMM_REGS && n < IDX_XMM_REGS + CPU_NB_REGS) {
n -= IDX_XMM_REGS;
if (n < CPU_NB_REGS32 || TARGET_LONG_BITS == 64) {
- env->xmm_regs[n].ZMM_Q(0) = ldq_p(mem_buf);
- env->xmm_regs[n].ZMM_Q(1) = ldq_p(mem_buf + 8);
+ env->xmm_regs[n].ZMM_Q(0) = ldq_le_p(mem_buf);
+ env->xmm_regs[n].ZMM_Q(1) = ldq_le_p(mem_buf + 8);
return 16;
}
} else {
@@ -290,18 +290,18 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
case IDX_IP_REG:
if (TARGET_LONG_BITS == 64) {
if (env->hflags & HF_CS64_MASK) {
- env->eip = ldq_p(mem_buf);
+ env->eip = ldq_le_p(mem_buf);
} else {
- env->eip = ldq_p(mem_buf) & 0xffffffffUL;
+ env->eip = ldq_le_p(mem_buf) & 0xffffffffUL;
}
return 8;
} else {
env->eip &= ~0xffffffffUL;
- env->eip |= (uint32_t)ldl_p(mem_buf);
+ env->eip |= (uint32_t)ldl_le_p(mem_buf);
return 4;
}
case IDX_FLAGS_REG:
- env->eflags = ldl_p(mem_buf);
+ env->eflags = ldl_le_p(mem_buf);
return 4;
case IDX_SEG_REGS:
@@ -327,10 +327,10 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
return 4;
case IDX_FP_REGS + 8:
- cpu_set_fpuc(env, ldl_p(mem_buf));
+ cpu_set_fpuc(env, ldl_le_p(mem_buf));
return 4;
case IDX_FP_REGS + 9:
- tmp = ldl_p(mem_buf);
+ tmp = ldl_le_p(mem_buf);
env->fpstt = (tmp >> 11) & 7;
env->fpus = tmp & ~0x3800;
return 4;
@@ -348,7 +348,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
return 4;
case IDX_MXCSR_REG:
- cpu_set_mxcsr(env, ldl_p(mem_buf));
+ cpu_set_mxcsr(env, ldl_le_p(mem_buf));
return 4;
case IDX_CTL_CR0_REG:
diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 8fb05b1f531..de6765099f3 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -86,7 +86,7 @@ static bool ptw_translate(PTETranslate *inout, hwaddr addr, uint64_t ra)
static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra)
{
if (likely(in->haddr)) {
- return ldl_p(in->haddr);
+ return ldl_le_p(in->haddr);
}
return cpu_ldl_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra);
}
@@ -94,7 +94,7 @@ static inline uint32_t ptw_ldl(const PTETranslate *in, uint64_t ra)
static inline uint64_t ptw_ldq(const PTETranslate *in, uint64_t ra)
{
if (likely(in->haddr)) {
- return ldq_p(in->haddr);
+ return ldq_le_p(in->haddr);
}
return cpu_ldq_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, ra);
}
diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c
index 996e9f3bfef..fc10bfa6718 100644
--- a/target/i386/xsave_helper.c
+++ b/target/i386/xsave_helper.c
@@ -43,8 +43,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *xmm = legacy->xmm_regs[i];
- stq_p(xmm, env->xmm_regs[i].ZMM_Q(0));
- stq_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1));
+ stq_le_p(xmm, env->xmm_regs[i].ZMM_Q(0));
+ stq_le_p(xmm + 8, env->xmm_regs[i].ZMM_Q(1));
}
header->xstate_bv = env->xstate_bv;
@@ -58,8 +58,8 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *ymmh = avx->ymmh[i];
- stq_p(ymmh, env->xmm_regs[i].ZMM_Q(2));
- stq_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3));
+ stq_le_p(ymmh, env->xmm_regs[i].ZMM_Q(2));
+ stq_le_p(ymmh + 8, env->xmm_regs[i].ZMM_Q(3));
}
}
@@ -101,10 +101,10 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
uint8_t *zmmh = zmm_hi256->zmm_hi256[i];
- stq_p(zmmh, env->xmm_regs[i].ZMM_Q(4));
- stq_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5));
- stq_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6));
- stq_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7));
+ stq_le_p(zmmh, env->xmm_regs[i].ZMM_Q(4));
+ stq_le_p(zmmh + 8, env->xmm_regs[i].ZMM_Q(5));
+ stq_le_p(zmmh + 16, env->xmm_regs[i].ZMM_Q(6));
+ stq_le_p(zmmh + 24, env->xmm_regs[i].ZMM_Q(7));
}
#ifdef TARGET_X86_64
@@ -177,8 +177,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *xmm = legacy->xmm_regs[i];
- env->xmm_regs[i].ZMM_Q(0) = ldq_p(xmm);
- env->xmm_regs[i].ZMM_Q(1) = ldq_p(xmm + 8);
+ env->xmm_regs[i].ZMM_Q(0) = ldq_le_p(xmm);
+ env->xmm_regs[i].ZMM_Q(1) = ldq_le_p(xmm + 8);
}
env->xstate_bv = header->xstate_bv;
@@ -191,8 +191,8 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *ymmh = avx->ymmh[i];
- env->xmm_regs[i].ZMM_Q(2) = ldq_p(ymmh);
- env->xmm_regs[i].ZMM_Q(3) = ldq_p(ymmh + 8);
+ env->xmm_regs[i].ZMM_Q(2) = ldq_le_p(ymmh);
+ env->xmm_regs[i].ZMM_Q(3) = ldq_le_p(ymmh + 8);
}
}
@@ -241,10 +241,10 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
for (i = 0; i < CPU_NB_REGS; i++) {
const uint8_t *zmmh = zmm_hi256->zmm_hi256[i];
- env->xmm_regs[i].ZMM_Q(4) = ldq_p(zmmh);
- env->xmm_regs[i].ZMM_Q(5) = ldq_p(zmmh + 8);
- env->xmm_regs[i].ZMM_Q(6) = ldq_p(zmmh + 16);
- env->xmm_regs[i].ZMM_Q(7) = ldq_p(zmmh + 24);
+ env->xmm_regs[i].ZMM_Q(4) = ldq_le_p(zmmh);
+ env->xmm_regs[i].ZMM_Q(5) = ldq_le_p(zmmh + 8);
+ env->xmm_regs[i].ZMM_Q(6) = ldq_le_p(zmmh + 16);
+ env->xmm_regs[i].ZMM_Q(7) = ldq_le_p(zmmh + 24);
}
#ifdef TARGET_X86_64
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 09/25] target/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 09/25] target/i386: " Philippe Mathieu-Daudé
@ 2024-10-05 1:18 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The x86 architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/i386/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/i386/gdbstub.c | 30 +++++++++++++-------------
> target/i386/tcg/sysemu/excp_helper.c | 4 ++--
> target/i386/xsave_helper.c | 32 ++++++++++++++--------------
> 3 files changed, 33 insertions(+), 33 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 10/25] target/avr: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 09/25] target/i386: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:18 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 11/25] linux-user/i386: " Philippe Mathieu-Daudé
` (16 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The AVR architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/avr/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/avr/gdbstub.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/avr/gdbstub.c b/target/avr/gdbstub.c
index d6d3c1479b3..aea71282a58 100644
--- a/target/avr/gdbstub.c
+++ b/target/avr/gdbstub.c
@@ -69,13 +69,13 @@ int avr_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
/* SP */
if (n == 33) {
- env->sp = lduw_p(mem_buf);
+ env->sp = lduw_le_p(mem_buf);
return 2;
}
/* PC */
if (n == 34) {
- env->pc_w = ldl_p(mem_buf) / 2;
+ env->pc_w = ldl_le_p(mem_buf) / 2;
return 4;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 10/25] target/avr: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 10/25] target/avr: " Philippe Mathieu-Daudé
@ 2024-10-05 1:18 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The AVR architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/avr/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/avr/gdbstub.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 11/25] linux-user/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 10/25] target/avr: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:19 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 12/25] target/loongarch: " Philippe Mathieu-Daudé
` (15 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/i386/signal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index cb90711834f..0f11dba831f 100644
--- a/linux-user/i386/signal.c
+++ b/linux-user/i386/signal.c
@@ -754,8 +754,8 @@ static bool restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc)
env->eip = tswapl(sc->rip);
#endif
- cpu_x86_load_seg(env, R_CS, lduw_p(&sc->cs) | 3);
- cpu_x86_load_seg(env, R_SS, lduw_p(&sc->ss) | 3);
+ cpu_x86_load_seg(env, R_CS, lduw_le_p(&sc->cs) | 3);
+ cpu_x86_load_seg(env, R_SS, lduw_le_p(&sc->ss) | 3);
tmpflags = tswapl(sc->eflags);
env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 11/25] linux-user/i386: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 11/25] linux-user/i386: " Philippe Mathieu-Daudé
@ 2024-10-05 1:19 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The x86 architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> linux-user/i386/signal.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 12/25] target/loongarch: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 11/25] linux-user/i386: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:22 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 13/25] target/sh4: " Philippe Mathieu-Daudé
` (14 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The LoongArch architecture uses little endianness. Directly
use the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/loongarch/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/loongarch/gdbstub.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c
index 3a03cf9cba9..dafa4feb75d 100644
--- a/target/loongarch/gdbstub.c
+++ b/target/loongarch/gdbstub.c
@@ -67,10 +67,10 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
int length = 0;
if (is_la64(env)) {
- tmp = ldq_p(mem_buf);
+ tmp = ldq_le_p(mem_buf);
read_length = 8;
} else {
- tmp = ldl_p(mem_buf);
+ tmp = ldl_le_p(mem_buf);
read_length = 4;
}
@@ -106,13 +106,13 @@ static int loongarch_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n)
int length = 0;
if (0 <= n && n < 32) {
- env->fpr[n].vreg.D(0) = ldq_p(mem_buf);
+ env->fpr[n].vreg.D(0) = ldq_le_p(mem_buf);
length = 8;
} else if (32 <= n && n < 40) {
env->cf[n - 32] = ldub_p(mem_buf);
length = 1;
} else if (n == 40) {
- env->fcsr0 = ldl_p(mem_buf);
+ env->fcsr0 = ldl_le_p(mem_buf);
length = 4;
}
return length;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 12/25] target/loongarch: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 12/25] target/loongarch: " Philippe Mathieu-Daudé
@ 2024-10-05 1:22 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The LoongArch architecture uses little endianness. Directly
> use the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/loongarch/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/loongarch/gdbstub.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 13/25] target/sh4: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 12/25] target/loongarch: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-07 19:59 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 14/25] target/tricore: " Philippe Mathieu-Daudé
` (13 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
Since commit 73ceb12960e ("Remove the unused sh4eb target")
we only build the SH4 architecture for little endianness.
Directly use the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/sh4/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/sh4/gdbstub.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/target/sh4/gdbstub.c b/target/sh4/gdbstub.c
index 75926d4e049..194be1d5db3 100644
--- a/target/sh4/gdbstub.c
+++ b/target/sh4/gdbstub.c
@@ -80,59 +80,59 @@ int superh_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case 0 ... 7:
if ((env->sr & (1u << SR_MD)) && (env->sr & (1u << SR_RB))) {
- env->gregs[n + 16] = ldl_p(mem_buf);
+ env->gregs[n + 16] = ldl_le_p(mem_buf);
} else {
- env->gregs[n] = ldl_p(mem_buf);
+ env->gregs[n] = ldl_le_p(mem_buf);
}
break;
case 8 ... 15:
- env->gregs[n] = ldl_p(mem_buf);
+ env->gregs[n] = ldl_le_p(mem_buf);
break;
case 16:
- env->pc = ldl_p(mem_buf);
+ env->pc = ldl_le_p(mem_buf);
break;
case 17:
- env->pr = ldl_p(mem_buf);
+ env->pr = ldl_le_p(mem_buf);
break;
case 18:
- env->gbr = ldl_p(mem_buf);
+ env->gbr = ldl_le_p(mem_buf);
break;
case 19:
- env->vbr = ldl_p(mem_buf);
+ env->vbr = ldl_le_p(mem_buf);
break;
case 20:
- env->mach = ldl_p(mem_buf);
+ env->mach = ldl_le_p(mem_buf);
break;
case 21:
- env->macl = ldl_p(mem_buf);
+ env->macl = ldl_le_p(mem_buf);
break;
case 22:
- cpu_write_sr(env, ldl_p(mem_buf));
+ cpu_write_sr(env, ldl_le_p(mem_buf));
break;
case 23:
- env->fpul = ldl_p(mem_buf);
+ env->fpul = ldl_le_p(mem_buf);
break;
case 24:
- env->fpscr = ldl_p(mem_buf);
+ env->fpscr = ldl_le_p(mem_buf);
break;
case 25 ... 40:
if (env->fpscr & FPSCR_FR) {
- env->fregs[n - 9] = ldl_p(mem_buf);
+ env->fregs[n - 9] = ldl_le_p(mem_buf);
} else {
- env->fregs[n - 25] = ldl_p(mem_buf);
+ env->fregs[n - 25] = ldl_le_p(mem_buf);
}
break;
case 41:
- env->ssr = ldl_p(mem_buf);
+ env->ssr = ldl_le_p(mem_buf);
break;
case 42:
- env->spc = ldl_p(mem_buf);
+ env->spc = ldl_le_p(mem_buf);
break;
case 43 ... 50:
- env->gregs[n - 43] = ldl_p(mem_buf);
+ env->gregs[n - 43] = ldl_le_p(mem_buf);
break;
case 51 ... 58:
- env->gregs[n - (51 - 16)] = ldl_p(mem_buf);
+ env->gregs[n - (51 - 16)] = ldl_le_p(mem_buf);
break;
default:
return 0;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 13/25] target/sh4: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 13/25] target/sh4: " Philippe Mathieu-Daudé
@ 2024-10-07 19:59 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-07 19:59 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc
On 4/10/24 13:30, Philippe Mathieu-Daudé wrote:
> Since commit 73ceb12960e ("Remove the unused sh4eb target")
> we only build the SH4 architecture for little endianness.
> Directly use the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/sh4/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/sh4/gdbstub.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/target/sh4/gdbstub.c b/target/sh4/gdbstub.c
> index 75926d4e049..194be1d5db3 100644
> --- a/target/sh4/gdbstub.c
> +++ b/target/sh4/gdbstub.c
> @@ -80,59 +80,59 @@ int superh_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
As rth probably noticed, this is is wrong for the
sh4eb-linux-user target which we still build.
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 14/25] target/tricore: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 13/25] target/sh4: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-05 1:24 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 15/25] target/rx: " Philippe Mathieu-Daudé
` (12 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The TriCore architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/tricore/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/tricore/gdbstub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c
index 29a70051ffe..0b73b1280e0 100644
--- a/target/tricore/gdbstub.c
+++ b/target/tricore/gdbstub.c
@@ -124,7 +124,7 @@ int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUTriCoreState *env = cpu_env(cs);
uint32_t tmp;
- tmp = ldl_p(mem_buf);
+ tmp = ldl_le_p(mem_buf);
if (n < 16) { /* data registers */
env->gpr_d[n] = tmp;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 14/25] target/tricore: Use explicit little-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 14/25] target/tricore: " Philippe Mathieu-Daudé
@ 2024-10-05 1:24 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The TriCore architecture uses little endianness. Directly use
> the little-endian LD/ST API.
>
> Mechanical change using:
>
> $ end=le; \
> 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/tricore/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/tricore/gdbstub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c
> index 29a70051ffe..0b73b1280e0 100644
> --- a/target/tricore/gdbstub.c
> +++ b/target/tricore/gdbstub.c
> @@ -124,7 +124,7 @@ int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
> CPUTriCoreState *env = cpu_env(cs);
> uint32_t tmp;
>
> - tmp = ldl_p(mem_buf);
> + tmp = ldl_le_p(mem_buf);
>
> if (n < 16) { /* data registers */
> env->gpr_d[n] = tmp;
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 15/25] target/rx: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 14/25] target/tricore: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 16/25] target/riscv: " Philippe Mathieu-Daudé
` (11 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The RX architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/rx/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/rx/cpu.c | 2 +-
target/rx/gdbstub.c | 24 ++++++++++++------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 36d2a6f1890..458b8ee072d 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -86,7 +86,7 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type)
resetvec = rom_ptr(0xfffffffc, 4);
if (resetvec) {
/* In the case of kernel, it is ignored because it is not set. */
- env->pc = ldl_p(resetvec);
+ env->pc = ldl_le_p(resetvec);
}
rx_cpu_unpack_psw(env, 0, 1);
env->regs[0] = env->isp = env->usp = 0;
diff --git a/target/rx/gdbstub.c b/target/rx/gdbstub.c
index f222bf003be..30074c9da7b 100644
--- a/target/rx/gdbstub.c
+++ b/target/rx/gdbstub.c
@@ -56,7 +56,7 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
uint32_t psw;
switch (n) {
case 0 ... 15:
- env->regs[n] = ldl_p(mem_buf);
+ env->regs[n] = ldl_le_p(mem_buf);
if (n == 0) {
if (env->psw_u) {
env->usp = env->regs[0];
@@ -66,38 +66,38 @@ int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
}
break;
case 16:
- env->usp = ldl_p(mem_buf);
+ env->usp = ldl_le_p(mem_buf);
if (env->psw_u) {
- env->regs[0] = ldl_p(mem_buf);
+ env->regs[0] = ldl_le_p(mem_buf);
}
break;
case 17:
- env->isp = ldl_p(mem_buf);
+ env->isp = ldl_le_p(mem_buf);
if (!env->psw_u) {
- env->regs[0] = ldl_p(mem_buf);
+ env->regs[0] = ldl_le_p(mem_buf);
}
break;
case 18:
- psw = ldl_p(mem_buf);
+ psw = ldl_le_p(mem_buf);
rx_cpu_unpack_psw(env, psw, 1);
break;
case 19:
- env->pc = ldl_p(mem_buf);
+ env->pc = ldl_le_p(mem_buf);
break;
case 20:
- env->intb = ldl_p(mem_buf);
+ env->intb = ldl_le_p(mem_buf);
break;
case 21:
- env->bpsw = ldl_p(mem_buf);
+ env->bpsw = ldl_le_p(mem_buf);
break;
case 22:
- env->bpc = ldl_p(mem_buf);
+ env->bpc = ldl_le_p(mem_buf);
break;
case 23:
- env->fintv = ldl_p(mem_buf);
+ env->fintv = ldl_le_p(mem_buf);
break;
case 24:
- env->fpsw = ldl_p(mem_buf);
+ env->fpsw = ldl_le_p(mem_buf);
break;
case 25:
return 8;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 16/25] target/riscv: Use explicit little-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 15/25] target/rx: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 17/25] hw/m68k: Use explicit big-endian " Philippe Mathieu-Daudé
` (10 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The Risc-V architecture uses little endianness. Directly use
the little-endian LD/ST API.
Mechanical change using:
$ end=le; \
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/riscv/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/riscv/gdbstub.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
index c07df972f1e..2e042f117f3 100644
--- a/target/riscv/gdbstub.c
+++ b/target/riscv/gdbstub.c
@@ -84,15 +84,15 @@ int riscv_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
switch (mcc->misa_mxl_max) {
case MXL_RV32:
- tmp = (int32_t)ldl_p(mem_buf);
+ tmp = (int32_t)ldl_le_p(mem_buf);
length = 4;
break;
case MXL_RV64:
case MXL_RV128:
if (env->xl < MXL_RV64) {
- tmp = (int32_t)ldq_p(mem_buf);
+ tmp = (int32_t)ldq_le_p(mem_buf);
} else {
- tmp = ldq_p(mem_buf);
+ tmp = ldq_le_p(mem_buf);
}
length = 8;
break;
@@ -130,7 +130,7 @@ static int riscv_gdb_set_fpu(CPUState *cs, uint8_t *mem_buf, int n)
CPURISCVState *env = &cpu->env;
if (n < 32) {
- env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */
+ env->fpr[n] = ldq_le_p(mem_buf); /* always 64-bit */
return sizeof(uint64_t);
}
return 0;
@@ -162,7 +162,7 @@ static int riscv_gdb_set_vector(CPUState *cs, uint8_t *mem_buf, int n)
if (n < 32) {
int i;
for (i = 0; i < vlenb; i += 8) {
- env->vreg[(n * vlenb + i) / 8] = ldq_p(mem_buf + i);
+ env->vreg[(n * vlenb + i) / 8] = ldq_le_p(mem_buf + i);
}
return vlenb;
}
@@ -193,7 +193,7 @@ static int riscv_gdb_set_csr(CPUState *cs, uint8_t *mem_buf, int n)
CPURISCVState *env = &cpu->env;
if (n < CSR_TABLE_SIZE) {
- target_ulong val = ldtul_p(mem_buf);
+ target_ulong val = ldtul_le_p(mem_buf);
int result;
result = riscv_csrrw_debug(env, n, NULL, val, -1);
@@ -226,7 +226,7 @@ static int riscv_gdb_set_virtual(CPUState *cs, uint8_t *mem_buf, int n)
RISCVCPU *cpu = RISCV_CPU(cs);
CPURISCVState *env = &cpu->env;
- env->priv = ldtul_p(mem_buf) & 0x3;
+ env->priv = ldtul_le_p(mem_buf) & 0x3;
if (env->priv == PRV_RESERVED) {
env->priv = PRV_S;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 17/25] hw/m68k: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 16/25] target/riscv: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:40 ` Philippe Mathieu-Daudé
2024-10-05 1:29 ` Richard Henderson
2024-10-04 16:30 ` [PATCH v2 18/25] target/m68k: " Philippe Mathieu-Daudé
` (9 subsequent siblings)
26 siblings, 2 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The M68K 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' hw/m68k/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/m68k/bootinfo.h | 28 ++++++++++++++--------------
hw/m68k/mcf5208.c | 2 +-
hw/m68k/next-cube.c | 2 +-
hw/m68k/q800.c | 4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h
index 70c1dc0e8c3..0b3e7c4ea01 100644
--- a/hw/m68k/bootinfo.h
+++ b/hw/m68k/bootinfo.h
@@ -14,39 +14,39 @@
#define BOOTINFO0(base, id) \
do { \
- stw_p(base, id); \
+ stw_be_p(base, id); \
base += 2; \
- stw_p(base, sizeof(struct bi_record)); \
+ stw_be_p(base, sizeof(struct bi_record)); \
base += 2; \
} while (0)
#define BOOTINFO1(base, id, value) \
do { \
- stw_p(base, id); \
+ stw_be_p(base, id); \
base += 2; \
- stw_p(base, sizeof(struct bi_record) + 4); \
+ stw_be_p(base, sizeof(struct bi_record) + 4); \
base += 2; \
- stl_p(base, value); \
+ stl_be_p(base, value); \
base += 4; \
} while (0)
#define BOOTINFO2(base, id, value1, value2) \
do { \
- stw_p(base, id); \
+ stw_be_p(base, id); \
base += 2; \
- stw_p(base, sizeof(struct bi_record) + 8); \
+ stw_be_p(base, sizeof(struct bi_record) + 8); \
base += 2; \
- stl_p(base, value1); \
+ stl_be_p(base, value1); \
base += 4; \
- stl_p(base, value2); \
+ stl_be_p(base, value2); \
base += 4; \
} while (0)
#define BOOTINFOSTR(base, id, string) \
do { \
- stw_p(base, id); \
+ stw_be_p(base, id); \
base += 2; \
- stw_p(base, \
+ stw_be_p(base, \
(sizeof(struct bi_record) + strlen(string) + \
1 /* null termination */ + 3 /* padding */) & ~3); \
base += 2; \
@@ -59,13 +59,13 @@
#define BOOTINFODATA(base, id, data, len) \
do { \
- stw_p(base, id); \
+ stw_be_p(base, id); \
base += 2; \
- stw_p(base, \
+ stw_be_p(base, \
(sizeof(struct bi_record) + len + \
2 /* length field */ + 3 /* padding */) & ~3); \
base += 2; \
- stw_p(base, len); \
+ stw_be_p(base, len); \
base += 2; \
for (unsigned i_ = 0; i_ < len; ++i_) { \
stb_p(base++, data[i_]); \
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index b6677ad6bc3..e37cd50d189 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -359,7 +359,7 @@ static void mcf5208evb_init(MachineState *machine)
/* Initial PC is always at offset 4 in firmware binaries */
ptr = rom_ptr(0x4, 4);
assert(ptr != NULL);
- env->pc = ldl_p(ptr);
+ env->pc = ldl_be_p(ptr);
}
/* Load kernel. */
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 9b78767ea8e..9832213e7ec 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -1036,7 +1036,7 @@ static void next_cube_init(MachineState *machine)
/* Initial PC is always at offset 4 in firmware binaries */
ptr = rom_ptr(0x01000004, 4);
g_assert(ptr != NULL);
- env->pc = ldl_p(ptr);
+ env->pc = ldl_be_p(ptr);
if (env->pc >= 0x01020000) {
error_report("'%s' does not seem to be a valid firmware image.",
bios_name);
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index fa7683bf76f..556604e1dcf 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -684,9 +684,9 @@ static void q800_machine_init(MachineState *machine)
ptr = rom_ptr(MACROM_ADDR, bios_size);
assert(ptr != NULL);
- stl_phys(cs->as, 0, ldl_p(ptr)); /* reset initial SP */
+ stl_phys(cs->as, 0, ldl_be_p(ptr)); /* reset initial SP */
stl_phys(cs->as, 4,
- MACROM_ADDR + ldl_p(ptr + 4)); /* reset initial PC */
+ MACROM_ADDR + ldl_be_p(ptr + 4)); /* reset initial PC */
}
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 17/25] hw/m68k: Use explicit big-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 17/25] hw/m68k: Use explicit big-endian " Philippe Mathieu-Daudé
@ 2024-10-04 16:40 ` Philippe Mathieu-Daudé
2024-10-05 1:29 ` Richard Henderson
1 sibling, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:40 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc
On 4/10/24 18:30, Philippe Mathieu-Daudé wrote:
> The M68K 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' hw/m68k/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Per v1:
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
> ---
> hw/m68k/bootinfo.h | 28 ++++++++++++++--------------
> hw/m68k/mcf5208.c | 2 +-
> hw/m68k/next-cube.c | 2 +-
> hw/m68k/q800.c | 4 ++--
> 4 files changed, 18 insertions(+), 18 deletions(-)
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 17/25] hw/m68k: Use explicit big-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 17/25] hw/m68k: Use explicit big-endian " Philippe Mathieu-Daudé
2024-10-04 16:40 ` Philippe Mathieu-Daudé
@ 2024-10-05 1:29 ` Richard Henderson
1 sibling, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:29 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> The M68K 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' hw/m68k/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/m68k/bootinfo.h | 28 ++++++++++++++--------------
> hw/m68k/mcf5208.c | 2 +-
> hw/m68k/next-cube.c | 2 +-
> hw/m68k/q800.c | 4 ++--
> 4 files changed, 18 insertions(+), 18 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 18/25] target/m68k: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 17/25] hw/m68k: Use explicit big-endian " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:41 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 19/25] hw/sparc: " Philippe Mathieu-Daudé
` (8 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The M68K 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/m68k/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/m68k/gdbstub.c | 2 +-
target/m68k/helper.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c
index 15547e2313c..136159f98f2 100644
--- a/target/m68k/gdbstub.c
+++ b/target/m68k/gdbstub.c
@@ -52,7 +52,7 @@ int m68k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUM68KState *env = cpu_env(cs);
uint32_t tmp;
- tmp = ldl_p(mem_buf);
+ tmp = ldl_be_p(mem_buf);
if (n < 8) {
/* D0-D7 */
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 4c85badd5d3..9d3db8419de 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -57,15 +57,15 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
if (n < 8) {
float_status s;
- env->fregs[n].d = float64_to_floatx80(ldq_p(mem_buf), &s);
+ env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s);
return 8;
}
switch (n) {
case 8: /* fpcontrol */
- cpu_m68k_set_fpcr(env, ldl_p(mem_buf));
+ cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf));
return 4;
case 9: /* fpstatus */
- env->fpsr = ldl_p(mem_buf);
+ env->fpsr = ldl_be_p(mem_buf);
return 4;
case 10: /* fpiar, not implemented */
return 4;
@@ -107,10 +107,10 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
}
switch (n) {
case 8: /* fpcontrol */
- cpu_m68k_set_fpcr(env, ldl_p(mem_buf));
+ cpu_m68k_set_fpcr(env, ldl_be_p(mem_buf));
return 4;
case 9: /* fpstatus */
- cpu_m68k_set_fpsr(env, ldl_p(mem_buf));
+ cpu_m68k_set_fpsr(env, ldl_be_p(mem_buf));
return 4;
case 10: /* fpiar, not implemented */
return 4;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 18/25] target/m68k: Use explicit big-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 18/25] target/m68k: " Philippe Mathieu-Daudé
@ 2024-10-04 16:41 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:41 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc
On 4/10/24 18:30, Philippe Mathieu-Daudé wrote:
> The M68K 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/m68k/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Per v1:
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
> ---
> target/m68k/gdbstub.c | 2 +-
> target/m68k/helper.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 19/25] hw/sparc: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 18/25] target/m68k: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 20/25] target/sparc: " Philippe Mathieu-Daudé
` (7 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The SPARC architecture uses big endianness. Directly use
the big-endian LD/ST API.
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' hw/sparc/);done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/sparc/leon3.c | 42 +++++++++++++++++++++---------------------
hw/sparc/sun4m.c | 6 +++---
hw/sparc64/sun4u.c | 6 +++---
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 6aaa04cb191..021b5070128 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -78,21 +78,21 @@ typedef struct ResetData {
static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)
{
- stl_p(code++, 0x82100000); /* mov %g0, %g1 */
- stl_p(code++, 0x84100000); /* mov %g0, %g2 */
- stl_p(code++, 0x03000000 +
+ stl_be_p(code++, 0x82100000); /* mov %g0, %g1 */
+ stl_be_p(code++, 0x84100000); /* mov %g0, %g2 */
+ stl_be_p(code++, 0x03000000 +
extract32(addr, 10, 22));
/* sethi %hi(addr), %g1 */
- stl_p(code++, 0x82106000 +
+ stl_be_p(code++, 0x82106000 +
extract32(addr, 0, 10));
/* or %g1, addr, %g1 */
- stl_p(code++, 0x05000000 +
+ stl_be_p(code++, 0x05000000 +
extract32(val, 10, 22));
/* sethi %hi(val), %g2 */
- stl_p(code++, 0x8410a000 +
+ stl_be_p(code++, 0x8410a000 +
extract32(val, 0, 10));
/* or %g2, val, %g2 */
- stl_p(code++, 0xc4204000); /* st %g2, [ %g1 ] */
+ stl_be_p(code++, 0xc4204000); /* st %g2, [ %g1 ] */
return code;
}
@@ -112,13 +112,13 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr)
/* If we are running on a secondary CPU, jump directly to the kernel. */
- stl_p(p++, 0x85444000); /* rd %asr17, %g2 */
- stl_p(p++, 0x8530a01c); /* srl %g2, 0x1c, %g2 */
- stl_p(p++, 0x80908000); /* tst %g2 */
+ stl_be_p(p++, 0x85444000); /* rd %asr17, %g2 */
+ stl_be_p(p++, 0x8530a01c); /* srl %g2, 0x1c, %g2 */
+ stl_be_p(p++, 0x80908000); /* tst %g2 */
/* Filled below. */
sec_cpu_branch_p = p;
- stl_p(p++, 0x0BADC0DE); /* bne xxx */
- stl_p(p++, 0x01000000); /* nop */
+ stl_be_p(p++, 0x0BADC0DE); /* bne xxx */
+ stl_be_p(p++, 0x01000000); /* nop */
/* Initialize the UARTs */
/* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
@@ -133,17 +133,17 @@ static void write_bootloader(void *ptr, hwaddr kernel_addr)
p = gen_store_u32(p, 0x80000318, 3);
/* Now, the relative branch above can be computed. */
- stl_p(sec_cpu_branch_p, 0x12800000
- + (p - sec_cpu_branch_p));
+ stl_be_p(sec_cpu_branch_p, 0x12800000
+ + (p - sec_cpu_branch_p));
/* JUMP to the entry point */
- stl_p(p++, 0x82100000); /* mov %g0, %g1 */
- stl_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22));
- /* sethi %hi(kernel_addr), %g1 */
- stl_p(p++, 0x82106000 + extract32(kernel_addr, 0, 10));
- /* or kernel_addr, %g1 */
- stl_p(p++, 0x81c04000); /* jmp %g1 */
- stl_p(p++, 0x01000000); /* nop */
+ stl_be_p(p++, 0x82100000); /* mov %g0, %g1 */
+ stl_be_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22));
+ /* sethi %hi(kernel_addr), %g1 */
+ stl_be_p(p++, 0x82106000 + extract32(kernel_addr, 0, 10));
+ /* or kernel_addr, %g1 */
+ stl_be_p(p++, 0x81c04000); /* jmp %g1 */
+ stl_be_p(p++, 0x01000000); /* nop */
}
static void leon3_cpu_reset(void *opaque)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index d52e6a7213f..f375f0d389b 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -271,9 +271,9 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
if (*initrd_size > 0) {
for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
ptr = rom_ptr(KERNEL_LOAD_ADDR + i, 24);
- if (ptr && ldl_p(ptr) == 0x48647253) { /* HdrS */
- stl_p(ptr + 16, INITRD_LOAD_ADDR);
- stl_p(ptr + 20, *initrd_size);
+ if (ptr && ldl_be_p(ptr) == 0x48647253) { /* HdrS */
+ stl_be_p(ptr + 16, INITRD_LOAD_ADDR);
+ stl_be_p(ptr + 20, *initrd_size);
break;
}
}
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 4ece1ac1ffc..e591e5a741a 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -210,9 +210,9 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
if (*initrd_size > 0) {
for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
ptr = rom_ptr(*kernel_addr + i, 32);
- if (ptr && ldl_p(ptr + 8) == 0x48647253) { /* HdrS */
- stl_p(ptr + 24, *initrd_addr + *kernel_addr);
- stl_p(ptr + 28, *initrd_size);
+ if (ptr && ldl_be_p(ptr + 8) == 0x48647253) { /* HdrS */
+ stl_be_p(ptr + 24, *initrd_addr + *kernel_addr);
+ stl_be_p(ptr + 28, *initrd_size);
break;
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 20/25] target/sparc: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 19/25] hw/sparc: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 21/25] target/hppa: " Philippe Mathieu-Daudé
` (6 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The SPARC architectures use 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/sparc/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/sparc/gdbstub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/sparc/gdbstub.c b/target/sparc/gdbstub.c
index ec0036e9ef6..6c82b7db8cf 100644
--- a/target/sparc/gdbstub.c
+++ b/target/sparc/gdbstub.c
@@ -110,11 +110,11 @@ int sparc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
#if defined(TARGET_ABI32)
uint32_t tmp;
- tmp = ldl_p(mem_buf);
+ tmp = ldl_be_p(mem_buf);
#else
target_ulong tmp;
- tmp = ldtul_p(mem_buf);
+ tmp = ldtul_be_p(mem_buf);
#endif
if (n < 8) {
@@ -165,7 +165,7 @@ int sparc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
#else
else if (n < 64) {
/* f0-f31 */
- tmp = ldl_p(mem_buf);
+ tmp = ldl_be_p(mem_buf);
if (n & 1) {
env->fpr[(n - 32) / 2].l.lower = tmp;
} else {
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 21/25] target/hppa: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 20/25] target/sparc: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 22/25] hw/s390x: " Philippe Mathieu-Daudé
` (5 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
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 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
index 0daa52f7af2..537d0d2dfff 100644
--- a/target/hppa/gdbstub.c
+++ b/target/hppa/gdbstub.c
@@ -150,7 +150,7 @@ int hppa_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
CPUHPPAState *env = cpu_env(cs);
- uint32_t val = ldl_p(mem_buf);
+ uint32_t val = ldl_be_p(mem_buf);
switch (n) {
case 0:
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 22/25] hw/s390x: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 21/25] target/hppa: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-07 5:54 ` Thomas Huth
2024-10-04 16:30 ` [PATCH v2 23/25] target/s390x: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The S390X 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' hw/s390x/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/s390x/ipl.c | 4 +-
hw/s390x/s390-pci-inst.c | 166 +++++++++++++++++++--------------------
2 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index dd71689642b..5ab74339087 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -252,8 +252,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
*/
romptr = rom_ptr(INITRD_PARM_START, 16);
if (romptr) {
- stq_p(romptr, initrd_offset);
- stq_p(romptr + 1, initrd_size);
+ stq_be_p(romptr, initrd_offset);
+ stq_be_p(romptr + 1, initrd_size);
}
}
}
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 30149546c08..41655082dac 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -55,26 +55,26 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
uint64_t resume_token;
rc = 0;
- if (lduw_p(&rrb->request.hdr.len) != 32) {
+ if (lduw_be_p(&rrb->request.hdr.len) != 32) {
res_code = CLP_RC_LEN;
rc = -EINVAL;
goto out;
}
- if ((ldl_p(&rrb->request.fmt) & CLP_MASK_FMT) != 0) {
+ if ((ldl_be_p(&rrb->request.fmt) & CLP_MASK_FMT) != 0) {
res_code = CLP_RC_FMT;
rc = -EINVAL;
goto out;
}
- if ((ldl_p(&rrb->request.fmt) & ~CLP_MASK_FMT) != 0 ||
- ldq_p(&rrb->request.reserved1) != 0) {
+ if ((ldl_be_p(&rrb->request.fmt) & ~CLP_MASK_FMT) != 0 ||
+ ldq_be_p(&rrb->request.reserved1) != 0) {
res_code = CLP_RC_RESNOT0;
rc = -EINVAL;
goto out;
}
- resume_token = ldq_p(&rrb->request.resume_token);
+ resume_token = ldq_be_p(&rrb->request.resume_token);
if (resume_token) {
pbdev = s390_pci_find_dev_by_idx(s, resume_token);
@@ -87,13 +87,13 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
pbdev = s390_pci_find_next_avail_dev(s, NULL);
}
- if (lduw_p(&rrb->response.hdr.len) < 48) {
+ if (lduw_be_p(&rrb->response.hdr.len) < 48) {
res_code = CLP_RC_8K;
rc = -EINVAL;
goto out;
}
- initial_l2 = lduw_p(&rrb->response.hdr.len);
+ initial_l2 = lduw_be_p(&rrb->response.hdr.len);
if ((initial_l2 - LIST_PCI_HDR_LEN) % sizeof(ClpFhListEntry)
!= 0) {
res_code = CLP_RC_LEN;
@@ -102,33 +102,33 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
goto out;
}
- stl_p(&rrb->response.fmt, 0);
- stq_p(&rrb->response.reserved1, 0);
- stl_p(&rrb->response.mdd, FH_MASK_SHM);
- stw_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS);
+ stl_be_p(&rrb->response.fmt, 0);
+ stq_be_p(&rrb->response.reserved1, 0);
+ stl_be_p(&rrb->response.mdd, FH_MASK_SHM);
+ stw_be_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS);
rrb->response.flags = UID_CHECKING_ENABLED;
rrb->response.entry_size = sizeof(ClpFhListEntry);
i = 0;
g_l2 = LIST_PCI_HDR_LEN;
while (g_l2 < initial_l2 && pbdev) {
- stw_p(&rrb->response.fh_list[i].device_id,
+ stw_be_p(&rrb->response.fh_list[i].device_id,
pci_get_word(pbdev->pdev->config + PCI_DEVICE_ID));
- stw_p(&rrb->response.fh_list[i].vendor_id,
+ stw_be_p(&rrb->response.fh_list[i].vendor_id,
pci_get_word(pbdev->pdev->config + PCI_VENDOR_ID));
/* Ignore RESERVED devices. */
- stl_p(&rrb->response.fh_list[i].config,
+ stl_be_p(&rrb->response.fh_list[i].config,
pbdev->state == ZPCI_FS_STANDBY ? 0 : 1 << 31);
- stl_p(&rrb->response.fh_list[i].fid, pbdev->fid);
- stl_p(&rrb->response.fh_list[i].fh, pbdev->fh);
+ stl_be_p(&rrb->response.fh_list[i].fid, pbdev->fid);
+ stl_be_p(&rrb->response.fh_list[i].fh, pbdev->fh);
g_l2 += sizeof(ClpFhListEntry);
/* Add endian check for DPRINTF? */
trace_s390_pci_list_entry(g_l2,
- lduw_p(&rrb->response.fh_list[i].vendor_id),
- lduw_p(&rrb->response.fh_list[i].device_id),
- ldl_p(&rrb->response.fh_list[i].fid),
- ldl_p(&rrb->response.fh_list[i].fh));
+ lduw_be_p(&rrb->response.fh_list[i].vendor_id),
+ lduw_be_p(&rrb->response.fh_list[i].device_id),
+ ldl_be_p(&rrb->response.fh_list[i].fid),
+ ldl_be_p(&rrb->response.fh_list[i].fh));
pbdev = s390_pci_find_next_avail_dev(s, pbdev);
i++;
}
@@ -138,13 +138,13 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
} else {
resume_token = pbdev->fh & FH_MASK_INDEX;
}
- stq_p(&rrb->response.resume_token, resume_token);
- stw_p(&rrb->response.hdr.len, g_l2);
- stw_p(&rrb->response.hdr.rsp, CLP_RC_OK);
+ stq_be_p(&rrb->response.resume_token, resume_token);
+ stw_be_p(&rrb->response.hdr.len, g_l2);
+ stw_be_p(&rrb->response.hdr.rsp, CLP_RC_OK);
out:
if (rc) {
trace_s390_pci_list(rc);
- stw_p(&rrb->response.hdr.rsp, res_code);
+ stw_be_p(&rrb->response.hdr.rsp, res_code);
}
return rc;
}
@@ -172,7 +172,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
return 0;
}
reqh = (ClpReqHdr *)buffer;
- req_len = lduw_p(&reqh->len);
+ req_len = lduw_be_p(&reqh->len);
if (req_len < 16 || req_len > 8184 || (req_len % 8 != 0)) {
s390_program_interrupt(env, PGM_OPERAND, ra);
return 0;
@@ -184,7 +184,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
return 0;
}
resh = (ClpRspHdr *)(buffer + req_len);
- res_len = lduw_p(&resh->len);
+ res_len = lduw_be_p(&resh->len);
if (res_len < 8 || res_len > 8176 || (res_len % 8 != 0)) {
s390_program_interrupt(env, PGM_OPERAND, ra);
return 0;
@@ -201,11 +201,11 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
}
if (req_len != 32) {
- stw_p(&resh->rsp, CLP_RC_LEN);
+ stw_be_p(&resh->rsp, CLP_RC_LEN);
goto out;
}
- switch (lduw_p(&reqh->cmd)) {
+ switch (lduw_be_p(&reqh->cmd)) {
case CLP_LIST_PCI: {
ClpReqRspListPci *rrb = (ClpReqRspListPci *)buffer;
list_pci(rrb, &cc);
@@ -215,9 +215,9 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
ClpReqSetPci *reqsetpci = (ClpReqSetPci *)reqh;
ClpRspSetPci *ressetpci = (ClpRspSetPci *)resh;
- pbdev = s390_pci_find_dev_by_fh(s, ldl_p(&reqsetpci->fh));
+ pbdev = s390_pci_find_dev_by_fh(s, ldl_be_p(&reqsetpci->fh));
if (!pbdev) {
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH);
goto out;
}
@@ -225,17 +225,17 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
case CLP_SET_ENABLE_PCI_FN:
switch (reqsetpci->ndas) {
case 0:
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_DMAAS);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_DMAAS);
goto out;
case 1:
break;
default:
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_RES);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_RES);
goto out;
}
if (pbdev->fh & FH_MASK_ENABLE) {
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
goto out;
}
@@ -249,29 +249,29 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
/* Take this opportunity to make sure we are sync'd with host */
if (!s390_pci_get_host_fh(pbdev, &pbdev->fh) ||
!(pbdev->fh & FH_MASK_ENABLE)) {
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FH);
goto out;
}
}
pbdev->fh |= FH_MASK_ENABLE;
pbdev->state = ZPCI_FS_ENABLED;
- stl_p(&ressetpci->fh, pbdev->fh);
- stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
+ stl_be_p(&ressetpci->fh, pbdev->fh);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
case CLP_SET_DISABLE_PCI_FN:
if (!(pbdev->fh & FH_MASK_ENABLE)) {
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
goto out;
}
device_cold_reset(DEVICE(pbdev));
pbdev->fh &= ~FH_MASK_ENABLE;
pbdev->state = ZPCI_FS_DISABLED;
- stl_p(&ressetpci->fh, pbdev->fh);
- stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
+ stl_be_p(&ressetpci->fh, pbdev->fh);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
default:
trace_s390_pci_unknown("set-pci", reqsetpci->oc);
- stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
+ stw_be_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
break;
}
break;
@@ -280,23 +280,23 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
ClpReqQueryPci *reqquery = (ClpReqQueryPci *)reqh;
ClpRspQueryPci *resquery = (ClpRspQueryPci *)resh;
- pbdev = s390_pci_find_dev_by_fh(s, ldl_p(&reqquery->fh));
+ pbdev = s390_pci_find_dev_by_fh(s, ldl_be_p(&reqquery->fh));
if (!pbdev) {
- trace_s390_pci_nodev("query", ldl_p(&reqquery->fh));
- stw_p(&resquery->hdr.rsp, CLP_RC_SETPCIFN_FH);
+ trace_s390_pci_nodev("query", ldl_be_p(&reqquery->fh));
+ stw_be_p(&resquery->hdr.rsp, CLP_RC_SETPCIFN_FH);
goto out;
}
- stq_p(&resquery->sdma, pbdev->zpci_fn.sdma);
- stq_p(&resquery->edma, pbdev->zpci_fn.edma);
- stw_p(&resquery->pchid, pbdev->zpci_fn.pchid);
- stw_p(&resquery->vfn, pbdev->zpci_fn.vfn);
+ stq_be_p(&resquery->sdma, pbdev->zpci_fn.sdma);
+ stq_be_p(&resquery->edma, pbdev->zpci_fn.edma);
+ stw_be_p(&resquery->pchid, pbdev->zpci_fn.pchid);
+ stw_be_p(&resquery->vfn, pbdev->zpci_fn.vfn);
resquery->flags = pbdev->zpci_fn.flags;
resquery->pfgid = pbdev->zpci_fn.pfgid;
resquery->pft = pbdev->zpci_fn.pft;
resquery->fmbl = pbdev->zpci_fn.fmbl;
- stl_p(&resquery->fid, pbdev->zpci_fn.fid);
- stl_p(&resquery->uid, pbdev->zpci_fn.uid);
+ stl_be_p(&resquery->fid, pbdev->zpci_fn.fid);
+ stl_be_p(&resquery->uid, pbdev->zpci_fn.uid);
memcpy(resquery->pfip, pbdev->zpci_fn.pfip, CLP_PFIP_NR_SEGMENTS);
memcpy(resquery->util_str, pbdev->zpci_fn.util_str, CLP_UTIL_STR_LEN);
@@ -304,16 +304,16 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
uint32_t data = pci_get_long(pbdev->pdev->config +
PCI_BASE_ADDRESS_0 + (i * 4));
- stl_p(&resquery->bar[i], data);
+ stl_be_p(&resquery->bar[i], data);
resquery->bar_size[i] = pbdev->pdev->io_regions[i].size ?
ctz64(pbdev->pdev->io_regions[i].size) : 0;
trace_s390_pci_bar(i,
- ldl_p(&resquery->bar[i]),
+ ldl_be_p(&resquery->bar[i]),
pbdev->pdev->io_regions[i].size,
resquery->bar_size[i]);
}
- stw_p(&resquery->hdr.rsp, CLP_RC_OK);
+ stw_be_p(&resquery->hdr.rsp, CLP_RC_OK);
break;
}
case CLP_QUERY_PCI_FNGRP: {
@@ -326,23 +326,23 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
if (!group) {
/* We do not allow access to unknown groups */
/* The group must have been obtained with a vfio device */
- stw_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID);
+ stw_be_p(&resgrp->hdr.rsp, CLP_RC_QUERYPCIFG_PFGID);
goto out;
}
resgrp->fr = group->zpci_group.fr;
- stq_p(&resgrp->dasm, group->zpci_group.dasm);
- stq_p(&resgrp->msia, group->zpci_group.msia);
- stw_p(&resgrp->mui, group->zpci_group.mui);
- stw_p(&resgrp->i, group->zpci_group.i);
- stw_p(&resgrp->maxstbl, group->zpci_group.maxstbl);
+ stq_be_p(&resgrp->dasm, group->zpci_group.dasm);
+ stq_be_p(&resgrp->msia, group->zpci_group.msia);
+ stw_be_p(&resgrp->mui, group->zpci_group.mui);
+ stw_be_p(&resgrp->i, group->zpci_group.i);
+ stw_be_p(&resgrp->maxstbl, group->zpci_group.maxstbl);
resgrp->version = group->zpci_group.version;
resgrp->dtsm = group->zpci_group.dtsm;
- stw_p(&resgrp->hdr.rsp, CLP_RC_OK);
+ stw_be_p(&resgrp->hdr.rsp, CLP_RC_OK);
break;
}
default:
- trace_s390_pci_unknown("clp", lduw_p(&reqh->cmd));
- stw_p(&resh->rsp, CLP_RC_CMD);
+ trace_s390_pci_unknown("clp", lduw_be_p(&reqh->cmd));
+ stw_be_p(&resh->rsp, CLP_RC_CMD);
break;
}
@@ -914,7 +914,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
for (i = 0; i < len / 8; i++) {
result = memory_region_dispatch_write(mr, offset + i * 8,
- ldq_p(buffer + i * 8),
+ ldq_be_p(buffer + i * 8),
MO_64, MEMTXATTRS_UNSPECIFIED);
if (result != MEMTX_OK) {
s390_program_interrupt(env, PGM_OPERAND, ra);
@@ -935,13 +935,13 @@ specification_error:
static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib)
{
int ret, len;
- uint8_t isc = FIB_DATA_ISC(ldl_p(&fib.data));
+ uint8_t isc = FIB_DATA_ISC(ldl_be_p(&fib.data));
pbdev->routes.adapter.adapter_id = css_get_adapter_id(
CSS_IO_ADAPTER_PCI, isc);
- pbdev->summary_ind = get_indicator(ldq_p(&fib.aisb), sizeof(uint64_t));
- len = BITS_TO_LONGS(FIB_DATA_NOI(ldl_p(&fib.data))) * sizeof(unsigned long);
- pbdev->indicator = get_indicator(ldq_p(&fib.aibv), len);
+ pbdev->summary_ind = get_indicator(ldq_be_p(&fib.aisb), sizeof(uint64_t));
+ len = BITS_TO_LONGS(FIB_DATA_NOI(ldl_be_p(&fib.data))) * sizeof(unsigned long);
+ pbdev->indicator = get_indicator(ldq_be_p(&fib.aibv), len);
ret = map_indicator(&pbdev->routes.adapter, pbdev->summary_ind);
if (ret) {
@@ -953,13 +953,13 @@ static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib)
goto out;
}
- pbdev->routes.adapter.summary_addr = ldq_p(&fib.aisb);
- pbdev->routes.adapter.summary_offset = FIB_DATA_AISBO(ldl_p(&fib.data));
- pbdev->routes.adapter.ind_addr = ldq_p(&fib.aibv);
- pbdev->routes.adapter.ind_offset = FIB_DATA_AIBVO(ldl_p(&fib.data));
+ pbdev->routes.adapter.summary_addr = ldq_be_p(&fib.aisb);
+ pbdev->routes.adapter.summary_offset = FIB_DATA_AISBO(ldl_be_p(&fib.data));
+ pbdev->routes.adapter.ind_addr = ldq_be_p(&fib.aibv);
+ pbdev->routes.adapter.ind_offset = FIB_DATA_AIBVO(ldl_be_p(&fib.data));
pbdev->isc = isc;
- pbdev->noi = FIB_DATA_NOI(ldl_p(&fib.data));
- pbdev->sum = FIB_DATA_SUM(ldl_p(&fib.data));
+ pbdev->noi = FIB_DATA_NOI(ldl_be_p(&fib.data));
+ pbdev->sum = FIB_DATA_SUM(ldl_be_p(&fib.data));
trace_s390_pci_irqs("register", pbdev->routes.adapter.adapter_id);
return 0;
@@ -994,9 +994,9 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib,
uintptr_t ra)
{
S390PCIIOMMU *iommu = pbdev->iommu;
- uint64_t pba = ldq_p(&fib.pba);
- uint64_t pal = ldq_p(&fib.pal);
- uint64_t g_iota = ldq_p(&fib.iota);
+ uint64_t pba = ldq_be_p(&fib.pba);
+ uint64_t pal = ldq_be_p(&fib.pal);
+ uint64_t g_iota = ldq_be_p(&fib.iota);
uint8_t dt = (g_iota >> 2) & 0x7;
uint8_t t = (g_iota >> 11) & 0x1;
@@ -1289,7 +1289,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
}
break;
case ZPCI_MOD_FC_SET_MEASURE: {
- uint64_t fmb_addr = ldq_p(&fib.fmb_addr);
+ uint64_t fmb_addr = ldq_be_p(&fib.fmb_addr);
if (fmb_addr & FMBK_MASK) {
cc = ZPCI_PCI_LS_ERR;
@@ -1399,17 +1399,17 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
return 0;
}
- stq_p(&fib.pba, pbdev->iommu->pba);
- stq_p(&fib.pal, pbdev->iommu->pal);
- stq_p(&fib.iota, pbdev->iommu->g_iota);
- stq_p(&fib.aibv, pbdev->routes.adapter.ind_addr);
- stq_p(&fib.aisb, pbdev->routes.adapter.summary_addr);
- stq_p(&fib.fmb_addr, pbdev->fmb_addr);
+ stq_be_p(&fib.pba, pbdev->iommu->pba);
+ stq_be_p(&fib.pal, pbdev->iommu->pal);
+ stq_be_p(&fib.iota, pbdev->iommu->g_iota);
+ stq_be_p(&fib.aibv, pbdev->routes.adapter.ind_addr);
+ stq_be_p(&fib.aisb, pbdev->routes.adapter.summary_addr);
+ stq_be_p(&fib.fmb_addr, pbdev->fmb_addr);
data = ((uint32_t)pbdev->isc << 28) | ((uint32_t)pbdev->noi << 16) |
((uint32_t)pbdev->routes.adapter.ind_offset << 8) |
((uint32_t)pbdev->sum << 7) | pbdev->routes.adapter.summary_offset;
- stl_p(&fib.data, data);
+ stl_be_p(&fib.data, data);
out:
if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) {
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 22/25] hw/s390x: Use explicit big-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 22/25] hw/s390x: " Philippe Mathieu-Daudé
@ 2024-10-07 5:54 ` Thomas Huth
0 siblings, 0 replies; 49+ messages in thread
From: Thomas Huth @ 2024-10-07 5:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Richard Henderson, Pierrick Bouvier,
qemu-ppc
On 04/10/2024 18.30, Philippe Mathieu-Daudé wrote:
> The S390X 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' hw/s390x/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/s390x/ipl.c | 4 +-
> hw/s390x/s390-pci-inst.c | 166 +++++++++++++++++++--------------------
> 2 files changed, 85 insertions(+), 85 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 23/25] target/s390x: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (21 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 22/25] hw/s390x: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-07 5:57 ` Thomas Huth
2024-10-04 16:30 ` [PATCH v2 24/25] target/openrisc: " Philippe Mathieu-Daudé
` (3 subsequent siblings)
26 siblings, 1 reply; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The S390X 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/s390x/); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/s390x/gdbstub.c | 34 +++++++++++++++++-----------------
target/s390x/ioinst.c | 2 +-
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c
index 9ffec0bccbc..63373f02cef 100644
--- a/target/s390x/gdbstub.c
+++ b/target/s390x/gdbstub.c
@@ -46,7 +46,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
CPUS390XState *env = cpu_env(cs);
- target_ulong tmpl = ldq_p(mem_buf);
+ target_ulong tmpl = ldq_be_p(mem_buf);
switch (n) {
case S390_PSWM_REGNUM:
@@ -88,7 +88,7 @@ static int cpu_write_ac_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_A0_REGNUM ... S390_A15_REGNUM:
- env->aregs[n] = ldl_p(mem_buf);
+ env->aregs[n] = ldl_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 4;
default:
@@ -123,10 +123,10 @@ static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_FPC_REGNUM:
- env->fpc = ldl_p(mem_buf);
+ env->fpc = ldl_be_p(mem_buf);
return 4;
case S390_F0_REGNUM ... S390_F15_REGNUM:
- *get_freg(env, n - S390_F0_REGNUM) = ldq_p(mem_buf);
+ *get_freg(env, n - S390_F0_REGNUM) = ldq_be_p(mem_buf);
return 8;
default:
return 0;
@@ -167,11 +167,11 @@ static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_V0L_REGNUM ... S390_V15L_REGNUM:
- env->vregs[n][1] = ldq_p(mem_buf + 8);
+ env->vregs[n][1] = ldq_be_p(mem_buf + 8);
return 8;
case S390_V16_REGNUM ... S390_V31_REGNUM:
- env->vregs[n][0] = ldq_p(mem_buf);
- env->vregs[n][1] = ldq_p(mem_buf + 8);
+ env->vregs[n][0] = ldq_be_p(mem_buf);
+ env->vregs[n][1] = ldq_be_p(mem_buf + 8);
return 16;
default:
return 0;
@@ -203,7 +203,7 @@ static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_C0_REGNUM ... S390_C15_REGNUM:
- env->cregs[n] = ldq_p(mem_buf);
+ env->cregs[n] = ldq_be_p(mem_buf);
if (tcg_enabled()) {
tlb_flush(env_cpu(env));
}
@@ -246,19 +246,19 @@ static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_VIRT_CKC_REGNUM:
- env->ckc = ldq_p(mem_buf);
+ env->ckc = ldq_be_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_CPUTM_REGNUM:
- env->cputm = ldq_p(mem_buf);
+ env->cputm = ldq_be_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_BEA_REGNUM:
- env->gbea = ldq_p(mem_buf);
+ env->gbea = ldq_be_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
case S390_VIRT_PREFIX_REGNUM:
- env->psa = ldq_p(mem_buf);
+ env->psa = ldq_be_p(mem_buf);
cpu_synchronize_post_init(cs);
return 8;
default:
@@ -298,19 +298,19 @@ static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n)
switch (n) {
case S390_VIRT_KVM_PP_REGNUM:
- env->pp = ldq_p(mem_buf);
+ env->pp = ldq_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFT_REGNUM:
- env->pfault_token = ldq_p(mem_buf);
+ env->pfault_token = ldq_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFS_REGNUM:
- env->pfault_select = ldq_p(mem_buf);
+ env->pfault_select = ldq_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
case S390_VIRT_KVM_PFC_REGNUM:
- env->pfault_compare = ldq_p(mem_buf);
+ env->pfault_compare = ldq_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
default:
@@ -338,7 +338,7 @@ static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n)
S390CPU *cpu = S390_CPU(cs);
CPUS390XState *env = &cpu->env;
- env->gscb[n] = ldq_p(mem_buf);
+ env->gscb[n] = ldq_be_p(mem_buf);
cpu_synchronize_post_init(env_cpu(env));
return 8;
}
diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
index bbe45a497a8..a944f16c254 100644
--- a/target/s390x/ioinst.c
+++ b/target/s390x/ioinst.c
@@ -603,7 +603,7 @@ static int chsc_sei_nt2_have_event(void)
#define CHSC_SEI_NT2 (1ULL << 61)
static void ioinst_handle_chsc_sei(ChscReq *req, ChscResp *res)
{
- uint64_t selection_mask = ldq_p(&req->param1);
+ uint64_t selection_mask = ldq_be_p(&req->param1);
uint8_t *res_flags = (uint8_t *)res->data;
int have_event = 0;
int have_more = 0;
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 23/25] target/s390x: Use explicit big-endian LD/ST API
2024-10-04 16:30 ` [PATCH v2 23/25] target/s390x: " Philippe Mathieu-Daudé
@ 2024-10-07 5:57 ` Thomas Huth
0 siblings, 0 replies; 49+ messages in thread
From: Thomas Huth @ 2024-10-07 5:57 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Richard Henderson, Pierrick Bouvier,
qemu-ppc
On 04/10/2024 18.30, Philippe Mathieu-Daudé wrote:
> The S390X 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/s390x/); \
> done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/s390x/gdbstub.c | 34 +++++++++++++++++-----------------
> target/s390x/ioinst.c | 2 +-
> 2 files changed, 18 insertions(+), 18 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH v2 24/25] target/openrisc: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (22 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 23/25] target/s390x: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:30 ` [PATCH v2 25/25] hw/ppc/e500: " Philippe Mathieu-Daudé
` (2 subsequent siblings)
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The OpenRISC 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/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 c2a77d5d4d5..11f5c50423b 100644
--- a/target/openrisc/gdbstub.c
+++ b/target/openrisc/gdbstub.c
@@ -55,7 +55,7 @@ int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
return 0;
}
- tmp = ldl_p(mem_buf);
+ tmp = ldl_be_p(mem_buf);
if (n < 32) {
cpu_set_gpr(env, n, tmp);
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 25/25] hw/ppc/e500: Use explicit big-endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (23 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 24/25] target/openrisc: " Philippe Mathieu-Daudé
@ 2024-10-04 16:30 ` Philippe Mathieu-Daudé
2024-10-04 16:39 ` [PATCH v2 00/25] misc: Use explicit endian " Philippe Mathieu-Daudé
2024-10-05 1:39 ` Richard Henderson
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:30 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc, Philippe Mathieu-Daudé
The 32-bit PPC architecture uses big endianness. Directly use
the big-endian LD/ST API for the E500 hardware.
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' hw/*/*e500*); \
done
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/ppce500_spin.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c
index e08739a443d..8e0ef9467e4 100644
--- a/hw/ppc/ppce500_spin.c
+++ b/hw/ppc/ppce500_spin.c
@@ -64,9 +64,9 @@ static void spin_reset(DeviceState *dev)
for (i = 0; i < MAX_CPUS; i++) {
SpinInfo *info = &s->spin[i];
- stl_p(&info->pir, i);
- stq_p(&info->r3, i);
- stq_p(&info->addr, 1);
+ stl_be_p(&info->pir, i);
+ stq_be_p(&info->r3, i);
+ stq_be_p(&info->addr, 1);
}
}
@@ -96,9 +96,9 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data)
hwaddr map_start;
cpu_synchronize_state(cs);
- stl_p(&curspin->pir, env->spr[SPR_BOOKE_PIR]);
- env->nip = ldq_p(&curspin->addr) & (map_size - 1);
- env->gpr[3] = ldq_p(&curspin->r3);
+ stl_be_p(&curspin->pir, env->spr[SPR_BOOKE_PIR]);
+ env->nip = ldq_be_p(&curspin->addr) & (map_size - 1);
+ env->gpr[3] = ldq_be_p(&curspin->r3);
env->gpr[4] = 0;
env->gpr[5] = 0;
env->gpr[6] = 0;
@@ -106,7 +106,7 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data)
env->gpr[8] = 0;
env->gpr[9] = 0;
- map_start = ldq_p(&curspin->addr) & ~(map_size - 1);
+ map_start = ldq_be_p(&curspin->addr) & ~(map_size - 1);
mmubooke_create_initial_mapping(env, 0, map_start, map_size);
cs->halted = 0;
@@ -141,14 +141,14 @@ static void spin_write(void *opaque, hwaddr addr, uint64_t value,
stb_p(curspin_p, value);
break;
case 2:
- stw_p(curspin_p, value);
+ stw_be_p(curspin_p, value);
break;
case 4:
- stl_p(curspin_p, value);
+ stl_be_p(curspin_p, value);
break;
}
- if (!(ldq_p(&curspin->addr) & 1)) {
+ if (!(ldq_be_p(&curspin->addr) & 1)) {
/* run CPU */
run_on_cpu(cpu, spin_kick, RUN_ON_CPU_HOST_PTR(curspin));
}
@@ -163,9 +163,9 @@ static uint64_t spin_read(void *opaque, hwaddr addr, unsigned len)
case 1:
return ldub_p(spin_p);
case 2:
- return lduw_p(spin_p);
+ return lduw_be_p(spin_p);
case 4:
- return ldl_p(spin_p);
+ return ldl_be_p(spin_p);
default:
hw_error("ppce500: unexpected %s with len = %u", __func__, len);
}
--
2.45.2
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 00/25] misc: Use explicit endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (24 preceding siblings ...)
2024-10-04 16:30 ` [PATCH v2 25/25] hw/ppc/e500: " Philippe Mathieu-Daudé
@ 2024-10-04 16:39 ` Philippe Mathieu-Daudé
2024-10-05 1:39 ` Richard Henderson
26 siblings, 0 replies; 49+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-10-04 16:39 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Richard Henderson,
Pierrick Bouvier, qemu-ppc
On 4/10/24 18:30, Philippe Mathieu-Daudé wrote:
> For targets (or HW) which are only built for a particular
> endianness, the generic LD/ST helpers are defined as the
> target endianness variant. For example, on big-endian
> targets, stl_p() is equivalent of stl_be_p().
>
> This series replaces in bulk these LD/ST calls.
This is the first part where we only convert the targets
built for a single endianness.
The rest (MIPS, ARM, PPC, MicroBlaze and Xtensa) will be
handled in different series.
I'm keeping hw/virtio/virtio-config-io.c last. Possibly
current API will then be restricted to user-emu & system/
to avoid further uses.
$ git grep -wlE '(ld|st)t?u?[wlq]_p'
hw/mips/bootloader.c
hw/mips/fuloong2e.c
hw/mips/malta.c
hw/ppc/spapr.c
hw/ppc/spapr_vhyp_mmu.c
target/arm/cpu.c
target/arm/gdbstub.c
target/arm/gdbstub64.c
target/microblaze/gdbstub.c
target/mips/gdbstub.c
target/ppc/gdbstub.c
target/ppc/mmu-hash64.h
target/xtensa/gdbstub.c
accel/tcg/user-exec.c
hw/virtio/virtio-config-io.c
include/exec/cpu-all.h
include/gdbstub/helpers.h
monitor/hmp-cmds-target.c
system/ioport.c
system/memory_ldst.c.inc
> This is helpful for the single binary project where we
> want to build a single binary for multiple targets of
> different endianness.
>
> Philippe Mathieu-Daudé (25):
> gdbstub/helpers: Have ldtul_p() definition use ldn_p()
> target/hexagon: Replace ldtul_p() -> ldl_p()
> target/alpha: Replace ldtul_p() -> ldq_p()
> target/s390x: Replace ldtul_p() -> ldq_p()
> gdbstub/helpers: Introduce ldtul_$endian_p() helpers
> target/alpha: Use explicit little-endian LD/ST API
> target/hexagon: Use explicit little-endian LD/ST API
> hw/i386: Use explicit little-endian LD/ST API
> target/i386: Use explicit little-endian LD/ST API
> target/avr: Use explicit little-endian LD/ST API
> linux-user/i386: Use explicit little-endian LD/ST API
> target/loongarch: Use explicit little-endian LD/ST API
> target/sh4: Use explicit little-endian LD/ST API
> target/tricore: Use explicit little-endian LD/ST API
> target/rx: Use explicit little-endian LD/ST API
> target/riscv: Use explicit little-endian LD/ST API
> hw/m68k: Use explicit big-endian LD/ST API
> target/m68k: Use explicit big-endian LD/ST API
> hw/sparc: Use explicit big-endian LD/ST API
> target/sparc: Use explicit big-endian LD/ST API
> target/hppa: Use explicit big-endian LD/ST API
> hw/s390x: Use explicit big-endian LD/ST API
> target/s390x: Use explicit big-endian LD/ST API
> target/openrisc: Use explicit big-endian LD/ST API
> hw/ppc/e500: Use explicit big-endian LD/ST API
>
> hw/m68k/bootinfo.h | 28 ++---
> include/gdbstub/helpers.h | 6 +-
> hw/i386/multiboot.c | 36 +++---
> hw/i386/x86-common.c | 26 ++---
> hw/m68k/mcf5208.c | 2 +-
> hw/m68k/next-cube.c | 2 +-
> hw/m68k/q800.c | 4 +-
> hw/ppc/ppce500_spin.c | 24 ++--
> hw/s390x/ipl.c | 4 +-
> hw/s390x/s390-pci-inst.c | 166 +++++++++++++--------------
> hw/sparc/leon3.c | 42 +++----
> hw/sparc/sun4m.c | 6 +-
> hw/sparc64/sun4u.c | 6 +-
> linux-user/i386/signal.c | 4 +-
> target/alpha/gdbstub.c | 2 +-
> target/avr/gdbstub.c | 4 +-
> target/hexagon/gdbstub.c | 10 +-
> target/hppa/gdbstub.c | 2 +-
> target/i386/gdbstub.c | 30 ++---
> target/i386/tcg/sysemu/excp_helper.c | 4 +-
> target/i386/xsave_helper.c | 32 +++---
> target/loongarch/gdbstub.c | 8 +-
> target/m68k/gdbstub.c | 2 +-
> target/m68k/helper.c | 10 +-
> target/openrisc/gdbstub.c | 2 +-
> target/riscv/gdbstub.c | 14 +--
> target/rx/cpu.c | 2 +-
> target/rx/gdbstub.c | 24 ++--
> target/s390x/gdbstub.c | 34 +++---
> target/s390x/ioinst.c | 2 +-
> target/sh4/gdbstub.c | 36 +++---
> target/sparc/gdbstub.c | 6 +-
> target/tricore/gdbstub.c | 2 +-
> 33 files changed, 292 insertions(+), 290 deletions(-)
>
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 00/25] misc: Use explicit endian LD/ST API
2024-10-04 16:30 [PATCH v2 00/25] misc: Use explicit endian LD/ST API Philippe Mathieu-Daudé
` (25 preceding siblings ...)
2024-10-04 16:39 ` [PATCH v2 00/25] misc: Use explicit endian " Philippe Mathieu-Daudé
@ 2024-10-05 1:39 ` Richard Henderson
2024-10-07 7:52 ` Pierre Muller
26 siblings, 1 reply; 49+ messages in thread
From: Richard Henderson @ 2024-10-05 1:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-riscv, qemu-s390x, Thomas Huth, Pierrick Bouvier, qemu-ppc,
Alistair Francis
On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (25):
> gdbstub/helpers: Have ldtul_p() definition use ldn_p()
> target/hexagon: Replace ldtul_p() -> ldl_p()
> target/alpha: Replace ldtul_p() -> ldq_p()
> target/s390x: Replace ldtul_p() -> ldq_p()
> gdbstub/helpers: Introduce ldtul_$endian_p() helpers
> target/alpha: Use explicit little-endian LD/ST API
> target/hexagon: Use explicit little-endian LD/ST API
> hw/i386: Use explicit little-endian LD/ST API
> target/i386: Use explicit little-endian LD/ST API
> target/avr: Use explicit little-endian LD/ST API
> linux-user/i386: Use explicit little-endian LD/ST API
> target/loongarch: Use explicit little-endian LD/ST API
> target/sh4: Use explicit little-endian LD/ST API
> target/tricore: Use explicit little-endian LD/ST API
> target/rx: Use explicit little-endian LD/ST API
> target/riscv: Use explicit little-endian LD/ST API
> hw/m68k: Use explicit big-endian LD/ST API
> target/m68k: Use explicit big-endian LD/ST API
> hw/sparc: Use explicit big-endian LD/ST API
> target/sparc: Use explicit big-endian LD/ST API
> target/hppa: Use explicit big-endian LD/ST API
> hw/s390x: Use explicit big-endian LD/ST API
> target/s390x: Use explicit big-endian LD/ST API
> target/openrisc: Use explicit big-endian LD/ST API
> hw/ppc/e500: Use explicit big-endian LD/ST API
The sh4, rx, and riscv targets *can* support multiple endianness.
While we removed sh4eb for system mode, we still support sh4eb-linux-user, and therefore
the target/sh4 patch affecting gdbstub is wrong.
RX sets endianness via a pin sampled at reset; if we ever implement this, it would be via
a property on the cpu. RISCV sets endianness via a couple of bits in MSTATUS; system mode
would always use little-endian, but riscv64eb-user isn't out of the question.
While we have never supported rx or riscv in big-endian, but there's no reason that we
can't, and those target/ patches make things harder. Since target/ will *always* have
TARGET_BIG_ENDIAN available, I don't see that we're saving anything there.
r~
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 00/25] misc: Use explicit endian LD/ST API
2024-10-05 1:39 ` Richard Henderson
@ 2024-10-07 7:52 ` Pierre Muller
2024-10-07 14:40 ` Richard Henderson
0 siblings, 1 reply; 49+ messages in thread
From: Pierre Muller @ 2024-10-07 7:52 UTC (permalink / raw)
To: qemu-devel
Le 05/10/2024 à 03:39, Richard Henderson a écrit :
> On 10/4/24 09:30, Philippe Mathieu-Daudé wrote:
>> Philippe Mathieu-Daudé (25):
>> gdbstub/helpers: Have ldtul_p() definition use ldn_p()
>> target/hexagon: Replace ldtul_p() -> ldl_p()
>> target/alpha: Replace ldtul_p() -> ldq_p()
>> target/s390x: Replace ldtul_p() -> ldq_p()
>> gdbstub/helpers: Introduce ldtul_$endian_p() helpers
>> target/alpha: Use explicit little-endian LD/ST API
>> target/hexagon: Use explicit little-endian LD/ST API
>> hw/i386: Use explicit little-endian LD/ST API
>> target/i386: Use explicit little-endian LD/ST API
>> target/avr: Use explicit little-endian LD/ST API
>> linux-user/i386: Use explicit little-endian LD/ST API
>> target/loongarch: Use explicit little-endian LD/ST API
>> target/sh4: Use explicit little-endian LD/ST API
>> target/tricore: Use explicit little-endian LD/ST API
>> target/rx: Use explicit little-endian LD/ST API
>> target/riscv: Use explicit little-endian LD/ST API
>> hw/m68k: Use explicit big-endian LD/ST API
>> target/m68k: Use explicit big-endian LD/ST API
>> hw/sparc: Use explicit big-endian LD/ST API
>> target/sparc: Use explicit big-endian LD/ST API
>> target/hppa: Use explicit big-endian LD/ST API
>> hw/s390x: Use explicit big-endian LD/ST API
>> target/s390x: Use explicit big-endian LD/ST API
>> target/openrisc: Use explicit big-endian LD/ST API
>> hw/ppc/e500: Use explicit big-endian LD/ST API
>
> The sh4, rx, and riscv targets *can* support multiple endianness.
>
> While we removed sh4eb for system mode, we still support sh4eb-linux-user, and therefore
> the target/sh4 patch affecting gdbstub is wrong.
>
> RX sets endianness via a pin sampled at reset; if we ever implement this, it would be via
> a property on the cpu. RISCV sets endianness via a couple of bits in MSTATUS; system mode
> would always use little-endian, but riscv64eb-user isn't out of the question.
>
> While we have never supported rx or riscv in big-endian, but there's no reason that we
> can't, and those target/ patches make things harder. Since target/ will *always* have
> TARGET_BIG_ENDIAN available, I don't see that we're saving anything there.
Isn't this also true for the sparc CPU?
At least llvm seems to think so:
$ ssh gcc421 /usr/bin/llvm-mc-18 --version
Debian LLVM version 18.1.8
Optimized build.
Registered Targets:
aarch64 - AArch64 (little endian)
....
sparc - Sparc
sparcel - Sparc LE
sparcv9 - Sparc V9
systemz - SystemZ
Pierre Muller
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH v2 00/25] misc: Use explicit endian LD/ST API
2024-10-07 7:52 ` Pierre Muller
@ 2024-10-07 14:40 ` Richard Henderson
0 siblings, 0 replies; 49+ messages in thread
From: Richard Henderson @ 2024-10-07 14:40 UTC (permalink / raw)
To: Pierre Muller, qemu-devel
On 10/7/24 00:52, Pierre Muller wrote:
>> While we have never supported rx or riscv in big-endian, but there's no reason that we
>> can't, and those target/ patches make things harder. Since target/ will *always* have
>> TARGET_BIG_ENDIAN available, I don't see that we're saving anything there.
>
> Isn't this also true for the sparc CPU?
Yes, I'd forgotten about that. Indeed, Sparc v9 has a couple of PSTATE bits that set the
endianness, exactly like Arm and Power, which qemu has not implemented for system mode.
r~
^ permalink raw reply [flat|nested] 49+ messages in thread