Fix masking of FPU top-of-stack in several places. Fixes DOS Quake.
This commit is contained in:
parent
305b6cc4fd
commit
d9e38fe37c
3 changed files with 5 additions and 5 deletions
|
|
@ -663,7 +663,7 @@ void exec386_dynarec(int cycs)
|
||||||
valid_block = 0;
|
valid_block = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (valid_block && block->was_recompiled && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != cpu_state.TOP)
|
if (valid_block && block->was_recompiled && (block->flags & CODEBLOCK_STATIC_TOP) && block->TOP != (cpu_state.TOP & 7))
|
||||||
{
|
{
|
||||||
/*FPU top-of-stack does not match the value this block was compiled
|
/*FPU top-of-stack does not match the value this block was compiled
|
||||||
with, re-compile using dynamic top-of-stack*/
|
with, re-compile using dynamic top-of-stack*/
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ void codegen_block_start_recompile(codeblock_t *block)
|
||||||
|
|
||||||
cpu_state.seg_ds.checked = cpu_state.seg_es.checked = cpu_state.seg_fs.checked = cpu_state.seg_gs.checked = (cr0 & 1) ? 0 : 1;
|
cpu_state.seg_ds.checked = cpu_state.seg_es.checked = cpu_state.seg_fs.checked = cpu_state.seg_gs.checked = (cr0 & 1) ? 0 : 1;
|
||||||
|
|
||||||
block->TOP = cpu_state.TOP;
|
block->TOP = cpu_state.TOP & 7;
|
||||||
block->was_recompiled = 1;
|
block->was_recompiled = 1;
|
||||||
|
|
||||||
codegen_flat_ds = !(cpu_cur_status & CPU_STATUS_NOTFLATDS);
|
codegen_flat_ds = !(cpu_cur_status & CPU_STATUS_NOTFLATDS);
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ static int FSAVE()
|
||||||
{
|
{
|
||||||
FP_ENTER();
|
FP_ENTER();
|
||||||
if (fplog) pclog("FSAVE %08X:%08X %i\n", easeg, cpu_state.eaaddr, cpu_state.ismmx);
|
if (fplog) pclog("FSAVE %08X:%08X %i\n", easeg, cpu_state.eaaddr, cpu_state.ismmx);
|
||||||
cpu_state.npxs = (cpu_state.npxs & ~(7 << 11)) | (cpu_state.TOP << 11);
|
cpu_state.npxs = (cpu_state.npxs & ~(7 << 11)) | ((cpu_state.TOP & 7) << 11);
|
||||||
|
|
||||||
switch ((cr0 & 1) | (cpu_state.op32 & 0x100))
|
switch ((cr0 & 1) | (cpu_state.op32 & 0x100))
|
||||||
{
|
{
|
||||||
|
|
@ -308,7 +308,7 @@ static int opFSTSW_a16(uint32_t fetchdat)
|
||||||
fetch_ea_16(fetchdat);
|
fetch_ea_16(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
if (fplog) pclog("FSTSW %08X:%08X\n", easeg, cpu_state.eaaddr);
|
if (fplog) pclog("FSTSW %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||||
seteaw((cpu_state.npxs & 0xC7FF) | (cpu_state.TOP << 11));
|
seteaw((cpu_state.npxs & 0xC7FF) | ((cpu_state.TOP & 7) << 11));
|
||||||
CLOCK_CYCLES(3);
|
CLOCK_CYCLES(3);
|
||||||
return cpu_state.abrt;
|
return cpu_state.abrt;
|
||||||
}
|
}
|
||||||
|
|
@ -318,7 +318,7 @@ static int opFSTSW_a32(uint32_t fetchdat)
|
||||||
fetch_ea_32(fetchdat);
|
fetch_ea_32(fetchdat);
|
||||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||||
if (fplog) pclog("FSTSW %08X:%08X\n", easeg, cpu_state.eaaddr);
|
if (fplog) pclog("FSTSW %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||||
seteaw((cpu_state.npxs & 0xC7FF) | (cpu_state.TOP << 11));
|
seteaw((cpu_state.npxs & 0xC7FF) | ((cpu_state.TOP & 7) << 11));
|
||||||
CLOCK_CYCLES(3);
|
CLOCK_CYCLES(3);
|
||||||
return cpu_state.abrt;
|
return cpu_state.abrt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue