From patchwork Sat Oct 20 14:48:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 192920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 607202C008F for ; Sun, 21 Oct 2012 01:48:49 +1100 (EST) Received: from localhost ([::1]:59508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPaM3-0008N4-AB for incoming@patchwork.ozlabs.org; Sat, 20 Oct 2012 10:48:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPaLw-0008Mz-L9 for qemu-devel@nongnu.org; Sat, 20 Oct 2012 10:48:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPaLv-0006Yo-6P for qemu-devel@nongnu.org; Sat, 20 Oct 2012 10:48:40 -0400 Received: from hall.aurel32.net ([88.191.126.93]:45103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPaLu-0006Yi-TZ for qemu-devel@nongnu.org; Sat, 20 Oct 2012 10:48:39 -0400 Received: from [2001:470:d4ed:0:ea11:32ff:fea1:831a] (helo=ohm.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TPaLq-00031a-Sf; Sat, 20 Oct 2012 16:48:34 +0200 Received: from aurel32 by ohm.aurel32.net with local (Exim 4.80) (envelope-from ) id 1TPaLp-0001qW-RK; Sat, 20 Oct 2012 16:48:33 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sat, 20 Oct 2012 16:48:28 +0200 Message-Id: <1350744508-7066-1-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: Blue Swirl , Aurelien Jarno , Richard Henderson Subject: [Qemu-devel] [PATCH] Revert "target-sparc: Make cpu_dst local to OP=2 insns" 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 Commit 5793f2a47e201d251856c7956d6f7907ec0d9f1f causes data corruption in system mode: | [....] Synthesizing the initial hotplug events...udevd[291]: timeout: killing 'net.agent' [302] | udevd[291]: 'net.agent' [302] terminated by signal 9 (Killed) | udevd[299]: timeout: killing '/sbin/modprobe -b of:NpackagesT' [313] | udevd[301]: timeout: killing '/sbin/modprobe -b of:Nvirtual-memoryT' [314] | udevd[300]: timeout: killing '/sbin/modprobe -b of:NmemoryTmemory' [315] | udevd[299]: '/sbin/modprobe -b of:NpackagesT' [313] terminated by signal 9 (Killed) | udevd[301]: '/sbin/modprobe -b of:Nvirtual-memoryT' [314] terminated by signal 9 (Killed) | udevd[300]: '/sbin/modprobe -b of:NmemoryTmemory' [315] terminated by signal 9 (Killed) | udevd[290]: timeout '/sbin/blkid -o udev -p /dev/vda1' | done. | [ ok ] Waiting for /dev to be fully populated...done. | [....] Activating swap...[ 44.814485] Adding 1048568k swap on /dev/vda2. Priority:-1 extents:1 across:1048568k | done. | [ 46.619096] EXT4-fs (vda4): re-mounted. Opts: (null) | [....] Checking root file system...fsck from util-linux 2.20.1 | e2fsck 1.42.5 (29-Jul-2012) | ext2fs_open2: The ext2 superblock is corrupt | fsck.ext4: Superblock invalid, trying backup blocks... | fsck.ext4: The ext2 superblock is corrupt while trying to open /dev/vda4 | | The superblock could not be read or does not describe a correct ext2 | filesystem. If the device is valid and it really contains an ext2 | filesystem (and not swap or ufs or something else), then the superblock | is corrupt, and you might try running e2fsck with an alternate superblock: | e2fsck -b 8193 | | fsck died with exit status 8 | udevd[332]: timeout '/sbin/blkid -o udev -p /dev/vda4' I am not sure it is the real problem, but at least the optimization of using the destination register as a temporary is wrong when the instruction might trigger an exception. In that case the result is written to the destination register while it should have not. This reverts commit 5793f2a47e201d251856c7956d6f7907ec0d9f1f. Cc: Blue Swirl Cc: Richard Henderson Signed-off-by: Aurelien Jarno --- target-sparc/translate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 4321393..04f3ac4 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -48,7 +48,7 @@ static TCGv cpu_y; #ifndef CONFIG_USER_ONLY static TCGv cpu_tbr; #endif -static TCGv cpu_cond; +static TCGv cpu_cond, cpu_dst; #ifdef TARGET_SPARC64 static TCGv_i32 cpu_xcc, cpu_asi, cpu_fprs; static TCGv cpu_gsr; @@ -2525,6 +2525,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) } opc = GET_FIELD(insn, 0, 1); + rd = GET_FIELD(insn, 2, 6); switch (opc) { @@ -2633,7 +2634,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) case 2: /* FPU & Logical Operations */ { unsigned int xop = GET_FIELD(insn, 7, 12); - TCGv cpu_dst = gen_dest_gpr(dc, rd); TCGv cpu_tmp0; if (xop == 0x3a) { /* generate trap */ @@ -5295,9 +5295,13 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb, last_pc = dc->pc; insn = cpu_ldl_code(env, dc->pc); + cpu_dst = tcg_temp_new(); + disas_sparc_insn(dc, insn); num_insns++; + tcg_temp_free(cpu_dst); + if (dc->is_br) break; /* if the next PC is different, we abort now */