[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/60] semihosting: Use struct gdb_stat in common_semi_flen_cb
From: |
Richard Henderson |
Subject: |
[PULL 20/60] semihosting: Use struct gdb_stat in common_semi_flen_cb |
Date: |
Tue, 28 Jun 2022 10:23:23 +0530 |
Load the entire 64-bit size value. While we're at it,
use offsetof instead of an integer constant.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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 abf543ce91..a9e488886a 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
- [PULL 11/60] semihosting: Clean up common_semi_flen_cb, (continued)
- [PULL 11/60] semihosting: Clean up common_semi_flen_cb, Richard Henderson, 2022/06/28
- [PULL 12/60] semihosting: Clean up common_semi_open_cb, Richard Henderson, 2022/06/28
- [PULL 13/60] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/06/28
- [PULL 14/60] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/06/28
- [PULL 15/60] semihosting: Remove GDB_O_BINARY, Richard Henderson, 2022/06/28
- [PULL 16/60] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/06/28
- [PULL 17/60] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/06/28
- [PULL 19/60] gdbstub: Convert GDB error numbers to host error numbers, Richard Henderson, 2022/06/28
- [PULL 22/60] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/06/28
- [PULL 18/60] include/exec: Define errno values in gdbstub.h, Richard Henderson, 2022/06/28
- [PULL 20/60] semihosting: Use struct gdb_stat in common_semi_flen_cb,
Richard Henderson <=
- [PULL 24/60] semihosting: Split out common-semi-target.h, Richard Henderson, 2022/06/28
- [PULL 26/60] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/06/28
- [PULL 25/60] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/06/28
- [PULL 29/60] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/06/28
- [PULL 21/60] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/06/28
- [PULL 32/60] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/06/28
- [PULL 33/60] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/06/28
- [PULL 28/60] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/06/28
- [PULL 23/60] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/06/28
- [PULL 30/60] semihosting: Split out semihost_sys_write, Richard Henderson, 2022/06/28