[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/25] target/riscv: Use explicit little-endian LD/ST API
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 16/25] target/riscv: Use explicit little-endian LD/ST API |
Date: |
Fri, 4 Oct 2024 13:30:32 -0300 |
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
- Re: [PATCH v2 10/25] target/avr: Use explicit little-endian LD/ST API, (continued)
- [PATCH v2 11/25] linux-user/i386: Use explicit little-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 12/25] target/loongarch: Use explicit little-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 13/25] target/sh4: Use explicit little-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 14/25] target/tricore: Use explicit little-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 15/25] target/rx: Use explicit little-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 16/25] target/riscv: Use explicit little-endian LD/ST API,
Philippe Mathieu-Daudé <=
- [PATCH v2 17/25] hw/m68k: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 18/25] target/m68k: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 20/25] target/sparc: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 19/25] hw/sparc: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 22/25] hw/s390x: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04
- [PATCH v2 23/25] target/s390x: Use explicit big-endian LD/ST API, Philippe Mathieu-Daudé, 2024/10/04