From f83311e4764f1f25a8abdec2b32c64483be1759b Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 20 Jun 2017 22:51:18 +0200 Subject: target-m68k: use floatx80 internally Coldfire uses float64, but 680x0 use floatx80. This patch introduces the use of floatx80 internally and enables 680x0 80bits FPU. Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20170620205121.26515-4-laurent@vivier.eu> --- target/m68k/helper.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'target/m68k/helper.c') diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 5ca9911..8bfc881 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -73,10 +73,11 @@ void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf) g_slist_free(list); } -static int fpu_gdb_get_reg(CPUM68KState *env, uint8_t *mem_buf, int n) +static int cf_fpu_gdb_get_reg(CPUM68KState *env, uint8_t *mem_buf, int n) { if (n < 8) { - stfq_p(mem_buf, env->fregs[n]); + float_status s; + stfq_p(mem_buf, floatx80_to_float64(env->fregs[n].d, &s)); return 8; } if (n < 11) { @@ -87,10 +88,11 @@ static int fpu_gdb_get_reg(CPUM68KState *env, uint8_t *mem_buf, int n) return 0; } -static int fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n) +static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n) { if (n < 8) { - env->fregs[n] = ldfq_p(mem_buf); + float_status s; + env->fregs[n].d = float64_to_floatx80(ldfq_p(mem_buf), &s); return 8; } if (n < 11) { @@ -126,7 +128,7 @@ void m68k_cpu_init_gdb(M68kCPU *cpu) CPUM68KState *env = &cpu->env; if (m68k_feature(env, M68K_FEATURE_CF_FPU)) { - gdb_register_coprocessor(cs, fpu_gdb_get_reg, fpu_gdb_set_reg, + gdb_register_coprocessor(cs, cf_fpu_gdb_get_reg, cf_fpu_gdb_set_reg, 11, "cf-fp.xml", 18); } /* TODO: Add [E]MAC registers. */ -- cgit v1.1