[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/74] semihosting: Use struct gdb_stat in common_semi_flen_cb
From: |
Richard Henderson |
Subject: |
[PATCH v2 15/74] semihosting: Use struct gdb_stat in common_semi_flen_cb |
Date: |
Tue, 3 May 2022 12:47:44 -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 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index a1fc4ea039..a6c6e5baf6 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -324,12 +324,12 @@ static target_ulong common_semi_flen_buf(CPUState *cs)
static void
common_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong 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);
- size = 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);
+ size = be64_to_cpu(size);
common_semi_cb(cs, -1, err);
common_semi_set_ret(cs, size);
}
--
2.34.1
- Re: [PATCH v2 07/74] semihosting: Split out guestfd.c, (continued)
- [PATCH v2 08/74] semihosting: Generalize GuestFDFeatureFile, Richard Henderson, 2022/05/03
- [PATCH v2 09/74] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 13/74] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 10/74] semihosting: Adjust error checking in common_semi_cb, Richard Henderson, 2022/05/03
- [PATCH v2 12/74] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 14/74] include/exec: Define errno values in gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 15/74] semihosting: Use struct gdb_stat in common_semi_flen_cb,
Richard Henderson <=
- [PATCH v2 17/74] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/05/03
- [PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/05/03
- [PATCH v2 19/74] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 22/74] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/05/03
- [PATCH v2 21/74] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/05/03
- [PATCH v2 20/74] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/05/03
- [PATCH v2 23/74] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/05/03
- [PATCH v2 27/74] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/05/03