qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 02/60] semihosting: Return failure from softmmu-uaccess.h func


From: Philippe Mathieu-Daudé
Subject: Re: [PULL 02/60] semihosting: Return failure from softmmu-uaccess.h functions
Date: Mon, 29 Jan 2024 10:49:57 +0100
User-agent: Mozilla Thunderbird

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.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@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);
-}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]