[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 20/53] semihosting: Use struct gdb_stat in common_semi_flen_cb
From: |
Richard Henderson |
Subject: |
[PATCH v4 20/53] semihosting: Use struct gdb_stat in common_semi_flen_cb |
Date: |
Tue, 7 Jun 2022 13:45:24 -0700 |
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
- Re: [PATCH v4 31/53] semihosting: Bound length for semihost_sys_{read, write}, (continued)
- [PATCH v4 35/53] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/06/07
- [PATCH v4 37/53] semihosting: Split out semihost_sys_system, Richard Henderson, 2022/06/07
- [PATCH v4 38/53] semihosting: Create semihost_sys_{stat,fstat}, Richard Henderson, 2022/06/07
- [PATCH v4 19/53] gdbstub: Convert GDB error numbers to host error numbers, Richard Henderson, 2022/06/07
- [PATCH v4 20/53] semihosting: Use struct gdb_stat in common_semi_flen_cb,
Richard Henderson <=
- [PATCH v4 21/53] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/06/07
- [PATCH v4 22/53] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/06/07
- [PATCH v4 24/53] semihosting: Split out common-semi-target.h, Richard Henderson, 2022/06/07
- [PATCH v4 28/53] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/06/07
- [PATCH v4 26/53] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/06/07
- [PATCH v4 29/53] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/06/07