From 1004d947d50e14b599b275db6ab2de5450bf554b Mon Sep 17 00:00:00 2001 From: SarahW Date: Sat, 10 Sep 2016 18:41:58 +0100 Subject: [PATCH] Fixed bug with FRSTOR which broke FPU copy. --- src/x87_ops.h | 9 +++------ src/x87_ops_misc.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/x87_ops.h b/src/x87_ops.h index ded70e8..97f064c 100644 --- a/src/x87_ops.h +++ b/src/x87_ops.h @@ -177,17 +177,14 @@ static inline void x87_st_fsave(int reg) static inline void x87_ld_frstor(int reg) { - uint16_t temp; - reg = (cpu_state.TOP + reg) & 7; - temp = readmemw(easeg, cpu_state.eaaddr + 8); + cpu_state.MM[reg].q = readmemq(easeg, cpu_state.eaaddr); + cpu_state.MM_w4[reg] = readmemw(easeg, cpu_state.eaaddr + 8); - if (temp == 0x5555 && cpu_state.tag[reg] == 2) + if (cpu_state.MM_w4[reg] == 0x5555 && cpu_state.tag[reg] == 2) { cpu_state.tag[reg] = TAG_UINT64; - cpu_state.MM[reg].q = readmeml(easeg, cpu_state.eaaddr); - cpu_state.MM[reg].q |= ((uint64_t)readmeml(easeg, cpu_state.eaaddr + 4) << 32); cpu_state.ST[reg] = (double)cpu_state.MM[reg].q; } else diff --git a/src/x87_ops_misc.h b/src/x87_ops_misc.h index 9f722eb..afdf136 100644 --- a/src/x87_ops_misc.h +++ b/src/x87_ops_misc.h @@ -99,14 +99,14 @@ static int FSTOR() cpu_state.eaaddr += 28; break; } - x87_ldmmx(&cpu_state.MM[0], &cpu_state.MM_w4[0]); x87_ld_frstor(0); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[1], &cpu_state.MM_w4[1]); x87_ld_frstor(1); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[2], &cpu_state.MM_w4[2]); x87_ld_frstor(2); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[3], &cpu_state.MM_w4[3]); x87_ld_frstor(3); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[4], &cpu_state.MM_w4[4]); x87_ld_frstor(4); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[5], &cpu_state.MM_w4[5]); x87_ld_frstor(5); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[6], &cpu_state.MM_w4[6]); x87_ld_frstor(6); cpu_state.eaaddr += 10; - x87_ldmmx(&cpu_state.MM[7], &cpu_state.MM_w4[7]); x87_ld_frstor(7); + x87_ld_frstor(0); cpu_state.eaaddr += 10; + x87_ld_frstor(1); cpu_state.eaaddr += 10; + x87_ld_frstor(2); cpu_state.eaaddr += 10; + x87_ld_frstor(3); cpu_state.eaaddr += 10; + x87_ld_frstor(4); cpu_state.eaaddr += 10; + x87_ld_frstor(5); cpu_state.eaaddr += 10; + x87_ld_frstor(6); cpu_state.eaaddr += 10; + x87_ld_frstor(7); cpu_state.ismmx = 0; /*Horrible hack, but as PCem doesn't keep the FPU stack in 80-bit precision at all times