qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit hosts
@ 2016-08-03  3:15 Benjamin Herrenschmidt
  2016-08-03  8:40 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2016-08-03  3:15 UTC (permalink / raw)
  To: qemu-devel

The current constructs ends up cropping the host address to 32-bit
which crashes for me running 32-bit ppc programs on an x86_64.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Not sure who to CC for this...

 include/exec/cpu_ldst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 6eb5fe8..0164535 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -49,7 +49,7 @@
 
 #if defined(CONFIG_USER_ONLY)
 /* 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))
+#define g2h(x) ((void *)(guest_base + (unsigned long)(target_ulong)(x)))
 
 #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
 #define h2g_valid(x) 1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-03 10:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03  3:15 [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit hosts Benjamin Herrenschmidt
2016-08-03  8:40 ` Peter Maydell
2016-08-03  9:50   ` Benjamin Herrenschmidt
2016-08-03 10:18     ` Benjamin Herrenschmidt
2016-08-03 10:48       ` Peter Maydell
2016-08-03 10:51         ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).