From patchwork Wed Jul 9 16:20:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 368303 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 768AF1400AF for ; Thu, 10 Jul 2014 04:46:59 +1000 (EST) Received: from localhost ([::1]:33233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4wtN-0007ZI-Nr for incoming@patchwork.ozlabs.org; Wed, 09 Jul 2014 14:46:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4uby-0003IN-Di for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4ubq-0005FB-2F for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:20:50 -0400 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]:52335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4ubp-0005F7-Ro for qemu-devel@nongnu.org; Wed, 09 Jul 2014 12:20:41 -0400 Received: by mail-pd0-f172.google.com with SMTP id w10so9297962pde.31 for ; Wed, 09 Jul 2014 09:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dJo2/jfwyFBDVrFuaziA8D6Zk9b2Z7Av4mPKS28EoKc=; b=iVQcEY3PR8FhyjwINYb1DyJhO1ndrFaMbnhg0FUVX2CqeojkRFekBQC33EAo37bmeO Hg595OfL2wiVtWoQ6bEAbGukN3aNrsM8eKeqZ2j8/8e7ps8ED918rvF5ErZmuVoP6yRI domVdedjMw5121X+ntxA0LIq6+vIJzlOEfi+wKM6s7bT0/GS/wc80EYZjsKpjnzD8y6A drVH61DwZe0XhQqjOZD1n0wkgyOO2IIKEPDMp+FvRIj/t6zp3/Ad1Ep7XGFjls0IvgvC oCMxrB47Cq8HyWMgkernWjlrmDV6lardkXY5Kp5OlYqWfnot5EorO/yWOKaIG/O6qAwD I8yw== X-Received: by 10.69.11.35 with SMTP id ef3mr31713257pbd.83.1404922841035; Wed, 09 Jul 2014 09:20:41 -0700 (PDT) Received: from pike.twiddle.home (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id r4sm25366596pdh.28.2014.07.09.09.20.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jul 2014 09:20:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 Jul 2014 09:20:18 -0700 Message-Id: <1404922834-28169-3-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404922834-28169-1-git-send-email-rth@twiddle.net> References: <1404922834-28169-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::22c Cc: peter.maydell@linaro.org, viro@ZenIV.linux.org.uk Subject: [Qemu-devel] [PULL 02/18] target-alpha: Set PC correctly for floating-point exceptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org PC should be one past the faulting insn. Add better commentary for the machine-check exception path. Reported-by: Al Viro Signed-off-by: Richard Henderson --- target-alpha/helper.c | 2 ++ target-alpha/mem_helper.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target-alpha/helper.c b/target-alpha/helper.c index 7c053a3..8d1df2d 100644 --- a/target-alpha/helper.c +++ b/target-alpha/helper.c @@ -527,6 +527,8 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, env->error_code = error; if (retaddr) { cpu_restore_state(cs, retaddr); + /* Floating-point exceptions (our only users) point to the next PC. */ + env->pc += 4; } cpu_loop_exit(cs); } diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c index fc4f57a..7b5e30d 100644 --- a/target-alpha/mem_helper.c +++ b/target-alpha/mem_helper.c @@ -128,7 +128,14 @@ void alpha_cpu_unassigned_access(CPUState *cs, hwaddr addr, env->trap_arg0 = addr; env->trap_arg1 = is_write ? 1 : 0; - dynamic_excp(env, 0, EXCP_MCHK, 0); + cs->exception_index = EXCP_MCHK; + env->error_code = 0; + + /* ??? We should cpu_restore_state to the faulting insn, but this hook + does not have access to the retaddr value from the orignal helper. + It's all moot until the QEMU PALcode grows an MCHK handler. */ + + cpu_loop_exit(cs); } /* try to fill the TLB and return an exception if error. If retaddr is