i386 core improvements: [Barry Rodewald]

* Fixed EIP displacement when executing FPU instructions with no 80387 present
* Added 32-bit implementations of SLDT and STR


---------- Forwarded message ----------
From: Barry Rodewald <bsr@xnet.co.nz>
Date: Wed, Dec 9, 2009 at 2:02 AM
Subject: More i386 fixes
To: submit@mamedev.org


Hi,

Here's two more small fixes for the i386 core.

First, is FPU instructions used on 80386.  On a system without a
80387, FPU instructions should have no effect.  Part of the FM Towns
TBIOS (runs as an MS-DOS device driver, providing extra system
functions) initialises the FPU, and tries to detect it.  Upon hitting
the FSTCW instruction, though, it doesn't increase EIP enough when an
extra displacement byte is needed.  So, I've added a call to GetEA to
the escape() function (called when there is no FPU) which will fetch
the extra byte if necessary.

Second, is a 32-bit implementation of the SLDT and STR instructions.
Basically, I copied it from the 16-bit versions, and modified it to
use 32-bit registers.

Thanks,
Barry Rodewald
mailto:bsr@xnet.co.nz
This commit is contained in:
Phil Bennett 2009-12-10 09:12:35 +00:00
parent 7ffcc2ee76
commit 907c61c43e
2 changed files with 41 additions and 0 deletions

View File

@ -2655,6 +2655,42 @@ static void I386OP(group0F00_32)(i386_state *cpustate) // Opcode 0x0f 00
switch( (modrm >> 3) & 0x7 )
{
case 0: /* SLDT */
if ( PROTECTED_MODE && !V8086_MODE )
{
if( modrm >= 0xc0 ) {
address = LOAD_RM32(modrm);
STORE_RM32(address, cpustate->ldtr.segment);
CYCLES(cpustate,CYCLES_SLDT_REG);
} else {
ea = GetEA(cpustate,modrm);
WRITE32(cpustate, ea, cpustate->ldtr.segment);
CYCLES(cpustate,CYCLES_SLDT_MEM);
}
}
else
{
i386_trap(cpustate,6, 0);
}
break;
case 1: /* STR */
if ( PROTECTED_MODE && !V8086_MODE )
{
if( modrm >= 0xc0 ) {
address = LOAD_RM32(modrm);
STORE_RM32(address, cpustate->task.segment);
CYCLES(cpustate,CYCLES_STR_REG);
} else {
ea = GetEA(cpustate,modrm);
WRITE32(cpustate, ea, cpustate->task.segment);
CYCLES(cpustate,CYCLES_STR_MEM);
}
}
else
{
i386_trap(cpustate,6, 0);
}
break;
case 2: /* LLDT */
if ( PROTECTED_MODE && !V8086_MODE )
{

View File

@ -2212,6 +2212,11 @@ static void I386OP(into)(i386_state *cpustate) // Opcode 0xce
static void I386OP(escape)(i386_state *cpustate) // Opcodes 0xd8 - 0xdf
{
UINT8 modrm = FETCH(cpustate);
if(modrm < 0xc0)
{
UINT32 ea;
ea = GetEA(cpustate,modrm);
}
CYCLES(cpustate,3); // TODO: confirm this
(void) LOAD_RM8(modrm);
}