From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Qbg-0002XN-R3 for qemu-devel@nongnu.org; Tue, 08 Jul 2014 04:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4QbY-0000yR-Et for qemu-devel@nongnu.org; Tue, 08 Jul 2014 04:18:32 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:5841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4QbY-0000yH-8I for qemu-devel@nongnu.org; Tue, 08 Jul 2014 04:18:24 -0400 Message-ID: <53BBA94E.3030800@imgtec.com> Date: Tue, 8 Jul 2014 09:18:22 +0100 From: Leon Alrae MIME-Version: 1.0 References: <1403189143-54609-1-git-send-email-leon.alrae@imgtec.com> <1403189143-54609-2-git-send-email-leon.alrae@imgtec.com> <20140620220223.GA14407@ohm.rr44.fr> In-Reply-To: <20140620220223.GA14407@ohm.rr44.fr> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/12] target-mips: add KScratch registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: yongbok.kim@imgtec.com, cristian.cuna@imgtec.com, qemu-devel@nongnu.org On 20/06/2014 23:02, Aurelien Jarno wrote: >> @@ -5198,6 +5199,12 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) >> gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_DESAVE)); >> rn = "DESAVE"; >> break; >> + case 2 ... 7: >> + tcg_gen_ld_tl(arg, cpu_env, >> + offsetof(CPUMIPSState, CP0_KScratch[sel-2])); >> + tcg_gen_ext32s_tl(arg, arg); >> + rn = "KScratch"; >> + break; > > This change the behaviour of existing CPU which don't implement scratch > registers. Before it would generate an RI exception, and after the > patch, it would simply leave the register unchanged. > > The architecture manuals says in that case the result is UNDEFINED, so > that might be fine, that said it also says this instruction could > generate an RI exception, and I wouldn't be surprised real silicon > actually generate such an exception. On the real HW - reads from an unimplemented cp0 register return 0xffffffff (in R6 it will be 0) and writes are just ignored, there is no RI exception. In v2 I updated the behaviour for the new registers only. I think the same changes will be needed for the existing registers, but this is out of the current patch series scope - I plan to do this later. Thanks, Leon