aboutsummaryrefslogtreecommitdiff
path: root/semihosting
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-29 14:55:21 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-28 04:35:07 +0530
commitcd7f29e335a88c2803bfb42ee3cef60417c43274 (patch)
tree33a3e1053ec720b55a44194ff6138f540230c45f /semihosting
parentc805e118754a2c90c29219985ba389829d4a53a4 (diff)
downloadqemu-cd7f29e335a88c2803bfb42ee3cef60417c43274.zip
qemu-cd7f29e335a88c2803bfb42ee3cef60417c43274.tar.gz
qemu-cd7f29e335a88c2803bfb42ee3cef60417c43274.tar.bz2
semihosting: Use struct gdb_stat in common_semi_flen_cb
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>
Diffstat (limited to 'semihosting')
-rw-r--r--semihosting/arm-compat-semi.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index abf543c..a9e4888 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);
}