[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/45] linux-user: Do not use guest_addr_valid for h2g_valid
From: |
Peter Maydell |
Subject: |
[PULL 18/45] linux-user: Do not use guest_addr_valid for h2g_valid |
Date: |
Thu, 11 Feb 2021 12:58:33 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
This is the only use of guest_addr_valid that does not begin
with a guest address, but a host address being transformed to
a guest address.
We will shortly adjust guest_addr_valid to handle guest memory
tags, and the host address should not be subjected to that.
Move h2g_valid adjacent to the other h2g macros.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210210000223.884088-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/exec/cpu_ldst.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 5e8878ee9b1..4e6ef3d5429 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -77,13 +77,16 @@ typedef uint64_t abi_ptr;
#else
#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX)
#endif
-#define h2g_valid(x) guest_addr_valid((uintptr_t)(x) - guest_base)
static inline bool guest_range_valid(abi_ulong start, abi_ulong len)
{
return len - 1 <= GUEST_ADDR_MAX && start <= GUEST_ADDR_MAX - len + 1;
}
+#define h2g_valid(x) \
+ (HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS || \
+ (uintptr_t)(x) - guest_base <= GUEST_ADDR_MAX)
+
#define h2g_nocheck(x) ({ \
uintptr_t __ret = (uintptr_t)(x) - guest_base; \
(abi_ptr)__ret; \
--
2.20.1
- [PULL 09/45] accel/tcg: Add URL of clang bug to comment about our workaround, (continued)
- [PULL 09/45] accel/tcg: Add URL of clang bug to comment about our workaround, Peter Maydell, 2021/02/11
- [PULL 10/45] tcg: Introduce target-specific page data for user-only, Peter Maydell, 2021/02/11
- [PULL 11/45] linux-user: Introduce PAGE_ANON, Peter Maydell, 2021/02/11
- [PULL 12/45] exec: Use uintptr_t for guest_base, Peter Maydell, 2021/02/11
- [PULL 13/45] exec: Use uintptr_t in cpu_ldst.h, Peter Maydell, 2021/02/11
- [PULL 16/45] linux-user: Tidy VERIFY_READ/VERIFY_WRITE, Peter Maydell, 2021/02/11
- [PULL 17/45] bsd-user: Tidy VERIFY_READ/VERIFY_WRITE, Peter Maydell, 2021/02/11
- [PULL 15/45] linux-user: Check for overflow in access_ok, Peter Maydell, 2021/02/11
- [PULL 14/45] exec: Improve types for guest_addr_valid, Peter Maydell, 2021/02/11
- [PULL 20/45] exec: Introduce cpu_untagged_addr, Peter Maydell, 2021/02/11
- [PULL 18/45] linux-user: Do not use guest_addr_valid for h2g_valid,
Peter Maydell <=
- [PULL 19/45] linux-user: Fix guest_addr_valid vs reserved_va, Peter Maydell, 2021/02/11
- [PULL 23/45] linux-user: Use guest_range_valid in access_ok, Peter Maydell, 2021/02/11
- [PULL 21/45] exec: Use cpu_untagged_addr in g2h; split out g2h_untagged, Peter Maydell, 2021/02/11
- [PULL 25/45] linux-user: Use cpu_untagged_addr in access_ok; split out *_untagged, Peter Maydell, 2021/02/11
- [PULL 24/45] exec: Rename guest_{addr,range}_valid to *_untagged, Peter Maydell, 2021/02/11
- [PULL 29/45] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE, Peter Maydell, 2021/02/11
- [PULL 35/45] linux-user/aarch64: Pass syndrome to EXC_*_ABORT, Peter Maydell, 2021/02/11
- [PULL 31/45] target/arm: Use the proper TBI settings for linux-user, Peter Maydell, 2021/02/11
- [PULL 39/45] target/arm: Enable MTE for user-only, Peter Maydell, 2021/02/11
- [PULL 22/45] linux-user: Explicitly untag memory management syscalls, Peter Maydell, 2021/02/11