Fix x87 tag register when using MMX instructions. Fixes numerous issues when an MMX process is running at the same time as one or more other MMX/FPU processes (usually seen running 3dfx games with AudioPCI).

This commit is contained in:
SarahW 2019-05-11 18:41:31 +01:00
commit c682e070a6
3 changed files with 4 additions and 4 deletions

View file

@ -35,7 +35,7 @@ uint16_t x87_gettag()
ret |= X87_TAG_EMPTY << (c * 2);
else if (cpu_state.tag[c] & TAG_UINT64)
ret |= 2 << (c*2);
else if (cpu_state.ST[c] == 0.0)
else if (cpu_state.ST[c] == 0.0 && !cpu_state.ismmx)
ret |= X87_TAG_ZERO << (c * 2);
else
ret |= X87_TAG_VALID << (c * 2);

View file

@ -9,7 +9,7 @@ uint16_t x87_pc_seg,x87_op_seg;
static inline void x87_set_mmx()
{
cpu_state.TOP = 0;
*(uint64_t *)cpu_state.tag = 0;
*(uint64_t *)cpu_state.tag = 0x0101010101010101ull;
cpu_state.ismmx = 1;
}

View file

@ -117,8 +117,8 @@ static int FSTOR()
something like this is needed*/
if (cpu_state.MM_w4[0] == 0xffff && cpu_state.MM_w4[1] == 0xffff && cpu_state.MM_w4[2] == 0xffff && cpu_state.MM_w4[3] == 0xffff &&
cpu_state.MM_w4[4] == 0xffff && cpu_state.MM_w4[5] == 0xffff && cpu_state.MM_w4[6] == 0xffff && cpu_state.MM_w4[7] == 0xffff &&
!cpu_state.TOP && !(*(uint64_t *)cpu_state.tag))
cpu_state.ismmx = 1;
!cpu_state.TOP && (*(uint64_t *)cpu_state.tag == 0x0101010101010101ull))
cpu_state.ismmx = 1;
CLOCK_CYCLES((cr0 & 1) ? 34 : 44);
if (fplog) pclog("FRSTOR %08X:%08X %i %i %04X\n", easeg, cpu_state.eaaddr, cpu_state.ismmx, cpu_state.TOP, x87_gettag());