aboutsummaryrefslogtreecommitdiff
path: root/cpu-all.h
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-08 18:12:18 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-08 18:12:18 +0000
commit14cc46b19ae9101d6742876c17c4ee040e22acad (patch)
tree6e088b19a5b83b8e2ebf2507de4828aeea01f3cd /cpu-all.h
parent0e62fd795726640dfe89538a45a8bd18d149fa50 (diff)
linux-user: Introduce h2g_valid
Introduce h2g_valid to check if a given host address can be converted into a valid guest address. Based on a patch from Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5956 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-all.h')
-rw-r--r--cpu-all.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpu-all.h b/cpu-all.h
index 69b1f725c8..fadf89cfc1 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -638,6 +638,10 @@ static inline void stfq_be_p(void *ptr, float64 v)
assert(__ret == (abi_ulong)__ret); \
(abi_ulong)__ret; \
})
+#define h2g_valid(x) ({ \
+ unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
+ (__guest == (abi_ulong)__guest); \
+})
#define saddr(x) g2h(x)
#define laddr(x) g2h(x)