On 28/6/22 06:53, Richard Henderson wrote:
We were reporting unconditional success for these functions;
pass on any failure from cpu_memory_rw_debug.
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
include/semihosting/softmmu-uaccess.h | 91 ++++++++++++---------------
1 file changed, 39 insertions(+), 52 deletions(-)
diff --git a/include/semihosting/softmmu-uaccess.h
b/include/semihosting/softmmu-uaccess.h
index e69e3c8548..5246a91570 100644
--- a/include/semihosting/softmmu-uaccess.h
+++ b/include/semihosting/softmmu-uaccess.h
@@ -12,82 +12,69 @@
#include "cpu.h"
-static inline uint64_t softmmu_tget64(CPUArchState *env, target_ulong addr)
-{
- uint64_t val;
+#define get_user_u64(val, addr) \
These macros match their user emulation equivalent, at the price
of loosing the 'env' argument, still used. This confuses meta
transformation tools such Coccinelle spatch. Not a big deal, just FTR.
+ ({ uint64_t val_ = 0; \
+ int ret_ = cpu_memory_rw_debug(env_cpu(env), (addr), \
^^^
+ &val_, sizeof(val_), 0); \
+ (val) = tswap64(val_); ret_; })
- cpu_memory_rw_debug(env_cpu(env), addr, (uint8_t *)&val, 8, 0);
- return tswap64(val);
-}