From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ndC-0006p3-49 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:29:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2nd7-0004yp-00 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:29:22 -0400 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:45714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2nd6-0004yk-RU for qemu-devel@nongnu.org; Thu, 03 Jul 2014 16:29:16 -0400 Received: by mail-qg0-f50.google.com with SMTP id j5so712694qga.9 for ; Thu, 03 Jul 2014 13:29:16 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 3 Jul 2014 13:29:00 -0700 Message-Id: <1404419347-18265-3-git-send-email-rth@twiddle.net> In-Reply-To: <1404419347-18265-1-git-send-email-rth@twiddle.net> References: <1404419347-18265-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v2 2/9] target-alpha: Set PC correctly for floating-point exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, viro@ZenIV.linux.org.uk 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 -- 1.9.3