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: 9260725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81A5D60467 for ; Wed, 3 Aug 2016 03:19:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 748D92854A for ; Wed, 3 Aug 2016 03:19:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69AAB2854F; Wed, 3 Aug 2016 03:19:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 189922854A for ; Wed, 3 Aug 2016 03:19:09 +0000 (UTC) Received: from localhost ([::1]:59950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUmi4-000493-9s for patchwork-qemu-devel@patchwork.kernel.org; Tue, 02 Aug 2016 23:19:08 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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