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>
This commit is contained in:
Laurent Vivier 2017-06-20 22:51:17 +02:00
parent 860b9ac779
commit f4a6ce5155

View File

@ -49,6 +49,8 @@ static void m68k_cpu_reset(CPUState *s)
M68kCPU *cpu = M68K_CPU(s); M68kCPU *cpu = M68K_CPU(s);
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu); M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
CPUM68KState *env = &cpu->env; CPUM68KState *env = &cpu->env;
float64 nan = float64_default_nan(NULL);
int i;
mcc->parent_reset(s); mcc->parent_reset(s);
@ -57,7 +59,12 @@ static void m68k_cpu_reset(CPUState *s)
env->sr = 0x2700; env->sr = 0x2700;
#endif #endif
m68k_switch_sp(env); 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); cpu_m68k_set_ccr(env, 0);
/* TODO: We should set PC from the interrupt vector. */ /* TODO: We should set PC from the interrupt vector. */
env->pc = 0; env->pc = 0;