mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
c805e11875
commit
cd7f29e335
|
@ -325,14 +325,12 @@ static void
|
||||||
common_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)
|
common_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)
|
||||||
{
|
{
|
||||||
if (!err) {
|
if (!err) {
|
||||||
/*
|
/* The size is always stored in big-endian order, extract the value. */
|
||||||
* The size is always stored in big-endian order, extract
|
uint64_t size;
|
||||||
* the value. We assume the size always fit in 32 bits.
|
cpu_memory_rw_debug(cs, common_semi_flen_buf(cs) +
|
||||||
*/
|
offsetof(struct gdb_stat, gdb_st_size),
|
||||||
uint32_t size;
|
&size, 8, 0);
|
||||||
cpu_memory_rw_debug(cs, common_semi_flen_buf(cs) + 32,
|
ret = be64_to_cpu(size);
|
||||||
(uint8_t *)&size, 4, 0);
|
|
||||||
ret = be32_to_cpu(size);
|
|
||||||
}
|
}
|
||||||
common_semi_cb(cs, ret, err);
|
common_semi_cb(cs, ret, err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue