From patchwork Mon Nov 20 21:21:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 10067319 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 807C16038F for ; Mon, 20 Nov 2017 21:26:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 730F328BF2 for ; Mon, 20 Nov 2017 21:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66660292DF; Mon, 20 Nov 2017 21:26:25 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 4294628BF2 for ; Mon, 20 Nov 2017 21:26:24 +0000 (UTC) Received: from localhost ([::1]:59814 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtaB-00075k-Du for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Nov 2017 16:26:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtW1-0004nM-Nx for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGtW0-000827-Tn for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:05 -0500 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:37686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGtW0-0007yn-Mk for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:04 -0500 Received: by mail-lf0-x244.google.com with SMTP id y2so10781007lfj.4 for ; Mon, 20 Nov 2017 13:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SwkXu0fPmqui88eJDIiUHicKxDg2XKWY1onT5RhrQxA=; b=BCxcSyA4tyRc6BZgom6ZVxXfRmuZPk7Qc2k3RE+I18+W/GQwdqIXA3QSriCMBgrddi PYFJnGADElFOj/DHLBuCI3cTjVaBwt7jvhQCHWYJkVFbU66SlWLFAAcHRnm/XWlM+5/6 fPUzxNcYyiTvup1WbTgBXMKDKoql6+eApTx+g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SwkXu0fPmqui88eJDIiUHicKxDg2XKWY1onT5RhrQxA=; b=mhrCRqXi7Cb03eqN1bI9UALIG7EsNdN+lLszQno2+nq1IP2DXJqciCbAVp+1juWIM3 MPpXcA+M8kANhHHntw/aWY9Q4txANk9kF3XZ7/ltJKSNLcYwXaxbGLlXZ797WZp4ap1s iZ8xjHVLvhp2nRriSAaGm1L83hT6t6SeiQVLfg0Tjt02ega99t1BA31SJIsOufw531Pl 6/TKRvfcSKWDx7g2HIMBWLSFr8vgGrzvowY1pFtYZbR53JnmXUfxYQqbRfXI2TeUcMko vgd2szNN+Hd9anEzgaxEjOaV295Wx/w2vo4ZmZa/hYMESVbkYCZVN9XqwvMCPkx+cvMg gD2w== X-Gm-Message-State: AJaThX7uhrm28FIKIAhkJj1n5jSik2Q9g2zur8yGkxx83SJk01LrGP1O SORH41lO5EHY/yNzICL7dYMn4kH3TyI= X-Google-Smtp-Source: AGs4zMaUVodPvFvURQ+RL6VaolmS0GL5bAdH7ZXM5kHP5hMQoj1ROOqy+AsXj1hg7lKw8kMcsKshLw== X-Received: by 10.25.203.2 with SMTP id b2mr3190785lfg.94.1511212923281; Mon, 20 Nov 2017 13:22:03 -0800 (PST) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id v63sm1645409lje.39.2017.11.20.13.22.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 13:22:02 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 20 Nov 2017 23:21:40 +0200 Message-Id: <15e692a6fc716f32976eea47946a4892e8ad7a3f.1511212753.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PULL 12/15] linux-user/ppc: Report correct fault address for data faults 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: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell For faults on loads and stores, ppc_cpu_handle_mmu_fault() in target/ppc/user_only_helper.c stores the offending address in env->spr[SPR_DAR]. Report this correctly to the guest in si_addr, rather than incorrectly using the address of the instruction that caused the fault. This fixes the test case in https://bugs.launchpad.net/qemu/+bug/1077116 for ppc, ppc64 and ppc64le. Reviewed-by: Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index b6dd9efd2d..6286661bd3 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1420,7 +1420,7 @@ void cpu_loop(CPUPPCState *env) info.si_code = TARGET_SEGV_MAPERR; break; } - info._sifields._sigfault._addr = env->nip; + info._sifields._sigfault._addr = env->spr[SPR_DAR]; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case POWERPC_EXCP_ISI: /* Instruction storage exception */