Commit 14cc46b19ae9101d6742876c17c4ee040e22acad
1 parent
0e62fd79
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
Showing
1 changed file
with
4 additions
and
0 deletions
cpu-all.h
... | ... | @@ -638,6 +638,10 @@ static inline void stfq_be_p(void *ptr, float64 v) |
638 | 638 | assert(__ret == (abi_ulong)__ret); \ |
639 | 639 | (abi_ulong)__ret; \ |
640 | 640 | }) |
641 | +#define h2g_valid(x) ({ \ | |
642 | + unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \ | |
643 | + (__guest == (abi_ulong)__guest); \ | |
644 | +}) | |
641 | 645 | |
642 | 646 | #define saddr(x) g2h(x) |
643 | 647 | #define laddr(x) g2h(x) | ... | ... |