From patchwork Wed Aug 3 03:15:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 655240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s3ywz5xQdz9s9k for ; Wed, 3 Aug 2016 13:19:47 +1000 (AEST) Received: from localhost ([::1]:59953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUmif-0004o5-TK for incoming@patchwork.ozlabs.org; Tue, 02 Aug 2016 23:19:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUmeV-0001em-8Q for qemu-devel@nongnu.org; Tue, 02 Aug 2016 23:15:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUmeR-0007TC-2A for qemu-devel@nongnu.org; Tue, 02 Aug 2016 23:15:26 -0400 Received: from gate.crashing.org ([63.228.1.57]:51502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUmeQ-0007T8-Mw for qemu-devel@nongnu.org; Tue, 02 Aug 2016 23:15:22 -0400 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u733FKCW020149 for ; Tue, 2 Aug 2016 22:15:21 -0500 Message-ID: <1470194119.12584.43.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: qemu-devel@nongnu.org Date: Wed, 03 Aug 2016 13:15:19 +1000 X-Mailer: Evolution 3.20.4 (3.20.4-1.fc24) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 63.228.1.57 Subject: [Qemu-devel] [PATCH 2/2] Fix g2h() for 32-bit targets on 64-bit hosts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "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 --- 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