diff options
author | Alexander Graf <agraf@suse.de> | 2013-07-06 14:17:49 +0200 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2013-07-23 17:28:28 +0300 |
commit | 732f9e89a1c737f738c445ff24929a1bc137d1a9 (patch) | |
tree | 59c38eafdb70fd6f6eb444c775b842af8185ffdf /include/exec/cpu-all.h | |
parent | 82f05b69e6b701157b4a2e7d76ae6cf5542d66c9 (diff) |
linux-user: fix segmentation fault passing with h2g(x) != x
When forwarding a segmentation fault into the guest process, we were passing
the host's address directly into the guest process's signal descriptor.
That obviously confused the guest process, since it didn't know what to make
of the (usually 32-bit truncated) address. Passing in h2g(address) makes the
guest process a lot happier.
To make the code more obvious, introduce a h2g_nocheck() macro that does the
same as h2g(), but allows us to convert addresses that may be outside of guest
mapped range into the guest's view of address space.
This fixes java running in arm-linux-user for me.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'include/exec/cpu-all.h')
-rw-r--r-- | include/exec/cpu-all.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 5084202217..f1cde978ab 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -209,11 +209,15 @@ extern unsigned long reserved_va; }) #endif -#define h2g(x) ({ \ +#define h2g_nocheck(x) ({ \ unsigned long __ret = (unsigned long)(x) - GUEST_BASE; \ + (abi_ulong)__ret; \ +}) + +#define h2g(x) ({ \ /* Check if given address fits target address space */ \ assert(h2g_valid(x)); \ - (abi_ulong)__ret; \ + h2g_nocheck(x); \ }) #define saddr(x) g2h(x) |