From patchwork Thu Apr 15 17:48:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 50280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5D24EB7CFA for ; Fri, 16 Apr 2010 03:51:40 +1000 (EST) Received: from localhost ([127.0.0.1]:43699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2TDP-00073x-4Y for incoming@patchwork.ozlabs.org; Thu, 15 Apr 2010 13:50:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2TBp-00070e-Te for qemu-devel@nongnu.org; Thu, 15 Apr 2010 13:49:21 -0400 Received: from [140.186.70.92] (port=60200 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2TBg-0006kH-7e for qemu-devel@nongnu.org; Thu, 15 Apr 2010 13:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2TBW-0008Rq-97 for qemu-devel@nongnu.org; Thu, 15 Apr 2010 13:49:12 -0400 Received: from mail-pz0-f204.google.com ([209.85.222.204]:52844) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2TBW-0008Rg-2v for qemu-devel@nongnu.org; Thu, 15 Apr 2010 13:49:02 -0400 Received: by pzk42 with SMTP id 42so1322292pzk.4 for ; Thu, 15 Apr 2010 10:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=iNklhDMNgronRNnQYTbhxsd9ot8BSXoxuJtIcAkBEbg=; b=kwgICYIO+4pejGD0yjr8uvKO65vTaEyfJSLSFdFMaSfQy/Rb2i5wZzONY/dBQd3dJR q5H/m8ZY2A23MRCM3IQiG4d2pkLm+2P2nl6qNy/zRA3HFnIiqhKK02YMY03gIAVryhDz lP+sSUlnvkTkV4gMaIuaGS2W4jlUkNCyB8fmw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=I/5VcbeTOCjJxRtM3RAvz2jr2miGjxvstXpjQBlHOJi80DPJTFTs9IyH30HwvZm1Hs O4ek50zCHPKN3pdY46nhwm10TDzTloZju29zQJHmXFYBuKeTzCwfZTz6a2Jm5JQSjqZB 9GKrHKVRCVeHDPjP1EkZYt85rRvaFn6mWKyzs= MIME-Version: 1.0 Received: by 10.141.32.16 with HTTP; Thu, 15 Apr 2010 10:48:59 -0700 (PDT) In-Reply-To: References: Date: Thu, 15 Apr 2010 20:48:59 +0300 Received: by 10.141.91.17 with SMTP id t17mr696287rvl.256.1271353740131; Thu, 15 Apr 2010 10:49:00 -0700 (PDT) Message-ID: From: Blue Swirl To: Artyom Tarasenko X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel Subject: [Qemu-devel] Re: sparc32 FPU SP Invalid CEXC Test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 4/15/10, Artyom Tarasenko wrote: > 2010/4/15 Artyom Tarasenko : > > > One of LX's tests crashes pretty hard, causing qemu abort. > > I've tried to look how does the execution flow works with -d in_asm. > > Does the address in the log show the guest's PC register? > > > It's probably sort of a "timing" issue. > > Can we check exceptions not just on jumps, but also on floating poit > operations which may cause a trap? > These traps are supposed to be syncronous. Yes, the bug is that PC and NPC are not saved before executing FPU instructions. Please try this patch. From 6c7d08b06214337f2b95d865b33c7ca188899fa4 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Thu, 15 Apr 2010 17:14:28 +0000 Subject: [PATCH] Sparc: fix PC/NPC during FPU traps All FPU instructions can trap, so save PC/NPC state before executing them. Signed-off-by: Blue Swirl --- target-sparc/translate.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 2c07385..addb1e1 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -2155,6 +2155,7 @@ static void disas_sparc_insn(DisasContext * dc) rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); + save_state(dc, cpu_cond); switch (xop) { case 0x1: /* fmovs */ tcg_gen_mov_i32(cpu_fpr[rd], cpu_fpr[rs2]); @@ -2468,6 +2469,7 @@ static void disas_sparc_insn(DisasContext * dc) rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); + save_state(dc, cpu_cond); #ifdef TARGET_SPARC64 if ((xop & 0x11f) == 0x005) { // V9 fmovsr int l1; -- 1.5.6.5