qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] MIPS: Correct FCR0 initialization
@ 2012-06-08  1:04 Maciej W. Rozycki
  2012-06-12 14:14 ` Richard Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Maciej W. Rozycki @ 2012-06-08  1:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Maciej W. Rozycki, Aurelien Jarno

From: Nathan Froyd <froydnj@codesourcery.com>

 This change addresses a problem where QEMU incorrectly traps on 
floating-point MADD group instructions with SIGILL, at least while 
emulating MIPS32r2 processors.  These instructions use the COP1X major 
opcode and include ones like:

	madd.d	$f2,$f4,$f2,$f6

 Here's Nathan's original analysis of the problem:

"QEMU essentially does:

  d = find_cpu (cpu_string)	// get CPU definition
  fpu_init (env, d)		// initialize fpu state (init FCR0, basically)
  cpu_reset (env)

...and the cpu_reset call clears all interesting state that fpu_init
setup, then proceeds to reinitialize all the CP0 registers...but not
FCR0."

 I have verified this change with system emulation running the GDB test 
suite for the mips-sde-elf target (o32, big endian, 24Kf CPU emulated), 
there were 55 progressions and no regressions.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
---

 Sent on behalf of Nathan, who's since left the company.  Please apply.

  Maciej

qemu-mips-fcr0.diff
Index: qemu-git-trunk/target-mips/translate.c
===================================================================
--- qemu-git-trunk.orig/target-mips/translate.c	2012-06-04 05:35:53.245610241 +0100
+++ qemu-git-trunk/target-mips/translate.c	2012-06-04 05:39:26.245563823 +0100
@@ -12776,6 +12776,7 @@ void cpu_state_reset(CPUMIPSState *env)
     env->CP0_SRSConf3 = env->cpu_model->CP0_SRSConf3;
     env->CP0_SRSConf4_rw_bitmask = env->cpu_model->CP0_SRSConf4_rw_bitmask;
     env->CP0_SRSConf4 = env->cpu_model->CP0_SRSConf4;
+    env->active_fpu.fcr0 = env->cpu_model->CP1_fcr0;
     env->insn_flags = env->cpu_model->insn_flags;
 
 #if defined(CONFIG_USER_ONLY)

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-08-10 23:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.186707.1339511294.854.qemu-devel@nongnu.org>
2012-08-06 18:21 ` [Qemu-devel] [PATCH] MIPS: Correct FCR0 initialization Phil Staub
2012-08-07 12:10   ` Peter Maydell
2012-08-07 14:56     ` Phil Staub
2012-08-09 19:57     ` Blue Swirl
2012-08-09 20:01       ` Phil Staub
2012-08-09 20:36         ` Peter Maydell
2012-08-09 21:17           ` Phil Staub
2012-08-09 22:09             ` Maciej W. Rozycki
2012-08-09 22:23               ` Phil Staub
2012-08-10  8:48           ` Andreas Färber
2012-08-10  9:00             ` Peter Maydell
2012-08-10  9:13               ` Andreas Färber
2012-08-10 13:15                 ` Maciej W. Rozycki
2012-08-10 14:30                   ` Andreas Färber
2012-08-10 21:51                     ` Meador Inge
2012-08-10 23:16                     ` Maciej W. Rozycki
2012-06-08  1:04 Maciej W. Rozycki
2012-06-12 14:14 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).