[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 17/49] semihosting: Use struct gdb_stat in common_semi_flen_cb
From: |
Richard Henderson |
Subject: |
[PATCH v3 17/49] semihosting: Use struct gdb_stat in common_semi_flen_cb |
Date: |
Fri, 20 May 2022 17:03:28 -0700 |
Use offsetof instead of an integer constant.
Load the entire 64-bit size while we're at it.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
semihosting/arm-compat-semi.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 2e0e7febb1..7becc14a81 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -325,14 +325,12 @@ static void
common_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)
{
if (!err) {
- /*
- * The size is always stored in big-endian order, extract
- * the value. We assume the size always fit in 32 bits.
- */
- uint32_t size;
- cpu_memory_rw_debug(cs, common_semi_flen_buf(cs) + 32,
- (uint8_t *)&size, 4, 0);
- ret = be32_to_cpu(size);
+ /* The size is always stored in big-endian order, extract the value. */
+ uint64_t size;
+ cpu_memory_rw_debug(cs, common_semi_flen_buf(cs) +
+ offsetof(struct gdb_stat, gdb_st_size),
+ &size, 8, 0);
+ ret = be64_to_cpu(size);
}
common_semi_cb(cs, ret, err);
}
--
2.34.1
- [PATCH v3 32/49] semihosting: Split out semihost_sys_rename, (continued)
- [PATCH v3 32/49] semihosting: Split out semihost_sys_rename, Richard Henderson, 2022/05/20
- [PATCH v3 22/49] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/05/20
- [PATCH v3 30/49] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/05/20
- [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/20
- [PATCH v3 37/49] semihosting: Fix docs comment for qemu_semihosting_console_inc, Richard Henderson, 2022/05/20
- [PATCH v3 29/49] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/05/20
- [PATCH v3 31/49] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/05/20
- [PATCH v3 17/49] semihosting: Use struct gdb_stat in common_semi_flen_cb,
Richard Henderson <=
- [PATCH v3 21/49] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/05/20
- [PATCH v3 28/49] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/05/20
- [PATCH v3 34/49] semihosting: Create semihost_sys_{stat,fstat}, Richard Henderson, 2022/05/20
- [PATCH v3 35/49] semihosting: Create semihost_sys_gettimeofday, Richard Henderson, 2022/05/20
- [PATCH v3 14/49] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/05/20
- [PATCH v3 20/49] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/05/20