[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/16] bsd-user: Define target_arg64
From: |
Warner Losh |
Subject: |
[PULL 15/16] bsd-user: Define target_arg64 |
Date: |
Mon, 28 Feb 2022 11:12:13 -0700 |
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>
---
bsd-user/qemu.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index a9efa807b78..af272c2a802 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"
--
2.33.1
- [PULL 06/16] bsd-user/arm/target_arch_thread.h: Assume a FreeBSD target, (continued)
- [PULL 06/16] bsd-user/arm/target_arch_thread.h: Assume a FreeBSD target, Warner Losh, 2022/02/28
- [PULL 05/16] bsd-user/arm/target_arch_cpu.h: Only support FreeBSD sys calls, Warner Losh, 2022/02/28
- [PULL 04/16] bsd-user/i386/target_arch_cpu.h: Remove openbsd syscall, Warner Losh, 2022/02/28
- [PULL 07/16] bsd-user/x86_64/target_arch_thread.h: Assume a FreeBSD target, Warner Losh, 2022/02/28
- [PULL 08/16] bsd-user: Remove bsd_type, Warner Losh, 2022/02/28
- [PULL 09/16] bsd-user/freebsd/os-syscall.c: Move syscall processing here, Warner Losh, 2022/02/28
- [PULL 10/16] bsd-user: Move system call building to os-syscall.c, Warner Losh, 2022/02/28
- [PULL 11/16] bsd-user/sycall.c: Now obsolete, remove, Warner Losh, 2022/02/28
- [PULL 13/16] bsd-user/bsd-file.h: Implementation details for the filesystem calls, Warner Losh, 2022/02/28
- [PULL 12/16] bsd-user/freebsd/os-syscall.c: Add get_errno and host_to_target_errno, Warner Losh, 2022/02/28
- [PULL 15/16] bsd-user: Define target_arg64,
Warner Losh <=
- [PULL 16/16] bsd-user: Add safe system call macros, Warner Losh, 2022/02/28
- [PULL 14/16] bsd-user: introduce target.h, Warner Losh, 2022/02/28