]> git.proxmox.com Git - qemu.git/commitdiff
target-mips: fix user-mode emulation startup
authorNathan Froyd <froydnj@codesourcery.com>
Fri, 11 Dec 2009 17:29:20 +0000 (09:29 -0800)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 13 Dec 2009 20:01:33 +0000 (21:01 +0100)
Running programs with the MIPS user-mode emulator fails during dynamic
loading, as floating-point instructions are not enabled in in
env->hflags.  Move the code for doing so from fpu_init to cpu_reset so
the MIPS_HFLAG_{FPU,F64} setting doesn't get clobbered by cpu_reset
setting env->hflags to MIPS_HFLAG_UM.

The same end can be achieved by swapping the ordering of fpu_init and
cpu_reset in cpu_mips_init, but it seemed better to consolidate the
CONFIG_USER_ONLY code into a single location.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-mips/translate.c
target-mips/translate_init.c

index ff0e590d28b0e3c3d0bc9e27f8384221aa74bf8f..dfea6f6e3490cb4063beee72445524c3bab54f40 100644 (file)
@@ -9845,6 +9845,14 @@ void cpu_reset (CPUMIPSState *env)
     env->hflags = MIPS_HFLAG_UM;
     /* Enable access to the SYNCI_Step register.  */
     env->CP0_HWREna |= (1 << 1);
+    if (env->CP0_Config1 & (1 << CP0C1_FP)) {
+        env->hflags |= MIPS_HFLAG_FPU;
+    }
+#ifdef TARGET_MIPS64
+    if (env->active_fpu.fcr0 & (1 << FCR0_F64)) {
+        env->hflags |= MIPS_HFLAG_F64;
+    }
+#endif
 #else
     if (env->hflags & MIPS_HFLAG_BMASK) {
         /* If the exception was raised from a delay slot,
index 6f50555e2d5216789a82a840b37f44ed4f5766b0..11bc47c0a35c620bd03070f338df981445b0d49c 100644 (file)
@@ -533,14 +533,6 @@ static void fpu_init (CPUMIPSState *env, const mips_def_t *def)
         env->fpus[i].fcr0 = def->CP1_fcr0;
 
     memcpy(&env->active_fpu, &env->fpus[0], sizeof(env->active_fpu));
-#if defined(CONFIG_USER_ONLY)
-    if (env->CP0_Config1 & (1 << CP0C1_FP))
-        env->hflags |= MIPS_HFLAG_FPU;
-#ifdef TARGET_MIPS64
-    if (env->active_fpu.fcr0 & (1 << FCR0_F64))
-        env->hflags |= MIPS_HFLAG_F64;
-#endif
-#endif
 }
 
 static void mvp_init (CPUMIPSState *env, const mips_def_t *def)