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
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)