aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2017-06-20 22:51:17 +0200
committerLaurent Vivier <laurent@vivier.eu>2017-06-21 22:09:45 +0200
commitf4a6ce5155aab2a7ed7b9032a72187b37b3bfffe (patch)
treee6be3041576a0c23bb28d87275040a1c67e5a85a
parent860b9ac779615fe9315cd58165652052ac165a92 (diff)
target-m68k: initialize FPU registers
on reset, set FP registers to NaN and control registers to 0 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <rth@twiddle.net> Message-Id: <20170620205121.26515-3-laurent@vivier.eu>
-rw-r--r--target/m68k/cpu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index f06892271f..f2e031fbe0 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -49,6 +49,8 @@ static void m68k_cpu_reset(CPUState *s)
M68kCPU *cpu = M68K_CPU(s);
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
CPUM68KState *env = &cpu->env;
+ float64 nan = float64_default_nan(NULL);
+ int i;
mcc->parent_reset(s);
@@ -57,7 +59,12 @@ static void m68k_cpu_reset(CPUState *s)
env->sr = 0x2700;
#endif
m68k_switch_sp(env);
- /* ??? FP regs should be initialized to NaN. */
+ for (i = 0; i < 8; i++) {
+ env->fregs[i] = nan;
+ }
+ env->fpcr = 0;
+ env->fpsr = 0;
+
cpu_m68k_set_ccr(env, 0);
/* TODO: We should set PC from the interrupt vector. */
env->pc = 0;