aboutsummaryrefslogtreecommitdiff
path: root/bsd-user
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2022-01-31 16:06:46 -0700
committerWarner Losh <imp@bsdimp.com>2022-02-26 21:05:21 -0700
commit0ff0508286106c2b71cdc8e83e5ad93003b91be4 (patch)
treeb74f435e634a355ca31e41be8aba66eeba655576 /bsd-user
parent647afdf1836548146b77c6ca68e93c7acfe35738 (diff)
downloadqemu-0ff0508286106c2b71cdc8e83e5ad93003b91be4.zip
qemu-0ff0508286106c2b71cdc8e83e5ad93003b91be4.tar.gz
qemu-0ff0508286106c2b71cdc8e83e5ad93003b91be4.tar.bz2
bsd-user: Define target_arg64
target_arg64 is a generic way to extract 64-bits from a pair of arguments. On 32-bit platforms, it returns them joined together as appropriate. On 64-bit platforms, it returns the first arg because it's already 64-bits. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Kyle Evans <kevans@FreeBSD.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'bsd-user')
-rw-r--r--bsd-user/qemu.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index a9efa80..af272c2 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -462,6 +462,19 @@ static inline void *lock_user_string(abi_ulong guest_addr)
#define unlock_user_struct(host_ptr, guest_addr, copy) \
unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
+static inline uint64_t target_arg64(uint32_t word0, uint32_t word1)
+{
+#if TARGET_ABI_BITS == 32
+#ifdef TARGET_WORDS_BIGENDIAN
+ return ((uint64_t)word0 << 32) | word1;
+#else
+ return ((uint64_t)word1 << 32) | word0;
+#endif
+#else /* TARGET_ABI_BITS != 32 */
+ return word0;
+#endif /* TARGET_ABI_BITS != 32 */
+}
+
#include <pthread.h>
#include "user/safe-syscall.h"