Skip to content

Commit

Permalink
target-m68k: initialize FPU registers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vivier committed Jun 21, 2017
1 parent 860b9ac commit f4a6ce5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion target/m68k/cpu.c
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit f4a6ce5

Please sign in to comment.