From 91a759352623e4a3da969fa66626cc99241e9da2 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 11 Dec 2009 09:29:20 -0800 Subject: target-mips: fix user-mode emulation startup 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 Signed-off-by: Aurelien Jarno --- target-mips/translate.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'target-mips/translate.c') diff --git a/target-mips/translate.c b/target-mips/translate.c index ff0e590d28..dfea6f6e34 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -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, -- cgit v1.2.3-70-g09d2