From e5da3227d95d43c4b0716b410cb0691a15cde567 Mon Sep 17 00:00:00 2001 From: tevorbl <38593695+tevorbl@users.noreply.github.com> Date: Sat, 30 May 2020 13:37:04 +0100 Subject: [PATCH] fpu bug fix for fgetmant op - inserted missing break - use temp variable instead of manipulating dest register fgetexp changed to directly convert int to floatx80 --- plat/linux68k/emu/musashi/m68kfpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plat/linux68k/emu/musashi/m68kfpu.c b/plat/linux68k/emu/musashi/m68kfpu.c index 46070f56c..8d46acb2d 100644 --- a/plat/linux68k/emu/musashi/m68kfpu.c +++ b/plat/linux68k/emu/musashi/m68kfpu.c @@ -1259,27 +1259,30 @@ static void fpgen_rm_reg(uint16 w2) REG_FP[dst].high ^= 0x8000; SET_CONDITION_CODES(REG_FP[dst]); USE_CYCLES(3); - break; - } + break; + } case 0x1e: // FGETEXP { sint16 temp; temp = source.high; // get the exponent temp -= 0x3fff; // take off the bias - REG_FP[dst] = double_to_fx80((double)temp); + REG_FP[dst] = int32_to_floatx80((int32)temp); SET_CONDITION_CODES(REG_FP[dst]); USE_CYCLES(6); - } + break; + } case 0x1f: // FGETMANT (TBB) { - REG_FP[dst] = source; - REG_FP[dst].high &= ~0x7fff; // clear the bias, keep sign - REG_FP[dst].high |= 0x3fff; // set new bias, 1.0 <= result < 2.0 + floatx80 temp = source; + temp.high &= ~0x7fff; // clear the bias, keep sign + temp.high |= 0x3fff; // set new bias, 1.0 <= result < 2.0 + REG_FP[dst] = temp; SET_CONDITION_CODES(REG_FP[dst]); - //USE_CYCLES(6); + USE_CYCLES(6); + break; } @@ -1611,8 +1614,8 @@ void m68040_fpu_op0() { case 0x0: // FPU ALU FP, FP case 0x2: // FPU ALU ea, FP - { - fpgen_rm_reg(w2); + { + fpgen_rm_reg(w2); break; }