summaryrefslogtreecommitdiffstats
path: root/include/exec/cpu_ldst.h
diff options
context:
space:
mode:
authorPeter Maydell2018-03-15 18:58:28 +0100
committerPeter Maydell2018-03-15 18:58:28 +0100
commit55901900ec69d6fd6f332003d8ab81b2f8a38529 (patch)
tree521ebc5c3532447b8669b7b673274ee2c0c9d425 /include/exec/cpu_ldst.h
parentMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream-sev' into sta... (diff)
parentlinux-user: init_guest_space: Add a comment about search strategy (diff)
downloadqemu-55901900ec69d6fd6f332003d8ab81b2f8a38529.tar.gz
qemu-55901900ec69d6fd6f332003d8ab81b2f8a38529.tar.xz
qemu-55901900ec69d6fd6f332003d8ab81b2f8a38529.zip
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request' into staging
# gpg: Signature made Tue 13 Mar 2018 17:33:03 GMT # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-2.12-pull-request: linux-user: init_guest_space: Add a comment about search strategy linux-user: init_guest_space: Don't try to align if we'll reject it linux-user: init_guest_space: Clean up control flow a bit linux-user: init_guest_commpage: Add a comment about size check linux-user: init_guest_space: Clarify page alignment logic linux-user: init_guest_space: Correctly handle guest_start in commpage initialization linux-user: init_guest_space: Clean up if we can't initialize the commpage linux-user: Rename validate_guest_space => init_guest_commpage linux-user: Use #if to only call validate_guest_space for 32-bit ARM target qemu-binfmt-conf.sh: add qemu-xtensa linux-user: drop unused target_msync function linux-user: fix target_mprotect/target_munmap error return values linux-user: fix assertion in shmdt linux-user: fix mmap/munmap/mprotect/mremap/shmat linux-user: Support f_flags in statfs when available. linux-user: allows to use "--systemd ALL" with qemu-binfmt-conf.sh linux-user: Remove the unused "not implemented" signal handling stubs linux-user: Drop unicore32 code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/exec/cpu_ldst.h')
-rw-r--r--include/exec/cpu_ldst.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 191f2e962a..5de8c8a5af 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -51,15 +51,13 @@
/* All direct uses of g2h and h2g need to go away for usermode softmmu. */
#define g2h(x) ((void *)((unsigned long)(target_ulong)(x) + guest_base))
-#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
-#define h2g_valid(x) 1
-#else
-#define h2g_valid(x) ({ \
- unsigned long __guest = (unsigned long)(x) - guest_base; \
- (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
- (!reserved_va || (__guest < reserved_va)); \
-})
-#endif
+#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX)
+#define h2g_valid(x) guest_addr_valid((unsigned long)(x) - guest_base)
+
+static inline int guest_range_valid(unsigned long start, unsigned long len)
+{
+ return len - 1 <= GUEST_ADDR_MAX && start <= GUEST_ADDR_MAX - len + 1;
+}
#define h2g_nocheck(x) ({ \
unsigned long __ret = (unsigned long)(x) - guest_base; \