* [Qemu-devel] [PATCH] target-mips: fix user-mode emulation startup
@ 2009-12-11 17:29 Nathan Froyd
0 siblings, 0 replies; only message in thread
From: Nathan Froyd @ 2009-12-11 17:29 UTC (permalink / raw)
To: qemu-devel
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>
---
target-mips/translate.c | 8 ++++++++
target-mips/translate_init.c | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 9d62b64..f756ab9 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -8652,6 +8652,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,
diff --git a/target-mips/translate_init.c b/target-mips/translate_init.c
index c950eab..3978908 100644
--- a/target-mips/translate_init.c
+++ b/target-mips/translate_init.c
@@ -524,14 +524,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)
--
1.6.3.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-12-11 17:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 17:29 [Qemu-devel] [PATCH] target-mips: fix user-mode emulation startup Nathan Froyd
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).