summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2018-04-15 22:02:00 -0500
committer cracyc <cracyc@users.noreply.github.com>2018-04-15 22:02:00 -0500
commitde007f3e5f775017e3b0aa04b6834783d99c09ad (patch)
tree14049074cd28ce5709269b96ff05427052fdd814
parent73e9041964e545be34b0bee21091a636e5b077be (diff)
i386: fix stack size in call too (nw)
-rw-r--r--src/devices/cpu/i386/i386.cpp12
-rw-r--r--src/devices/cpu/i386/x87ops.hxx3
2 files changed, 10 insertions, 5 deletions
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index 479f1f463f0..dcfadb70650 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -1720,7 +1720,8 @@ void i386_device::i386_protected_mode_call(uint16_t seg, uint32_t off, int indir
}
if (operand32 != 0) // if 32-bit
{
- if(i386_limit_check(SS, REG32(ESP) - 8))
+ uint32_t offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
+ if(i386_limit_check(SS, offset - 8))
{
logerror("CALL (%08x): Stack has no room for return address.\n",m_pc);
FAULT(FAULT_SS,0) // #SS(0)
@@ -1728,7 +1729,8 @@ void i386_device::i386_protected_mode_call(uint16_t seg, uint32_t off, int indir
}
else
{
- if(i386_limit_check(SS, (REG16(SP) - 4) & 0xffff))
+ uint32_t offset = (STACK_32BIT ? REG32(ESP) : REG16(SP));
+ if(i386_limit_check(SS, (offset - 4) & 0xffff))
{
logerror("CALL (%08x): Stack has no room for return address.\n",m_pc);
FAULT(FAULT_SS,0) // #SS(0)
@@ -1978,7 +1980,8 @@ void i386_device::i386_protected_mode_call(uint16_t seg, uint32_t off, int indir
/* same privilege */
if (operand32 != 0) // if 32-bit
{
- if(i386_limit_check(SS, REG32(ESP) - 8))
+ uint32_t stkoff = (STACK_32BIT ? REG32(ESP) : REG16(SP));
+ if(i386_limit_check(SS, stkoff - 8))
{
logerror("CALL: Stack has no room for return address.\n");
FAULT(FAULT_SS,0) // #SS(0)
@@ -1988,7 +1991,8 @@ void i386_device::i386_protected_mode_call(uint16_t seg, uint32_t off, int indir
}
else
{
- if(i386_limit_check(SS, (REG16(SP) - 4) & 0xffff))
+ uint32_t stkoff = (STACK_32BIT ? REG32(ESP) : REG16(SP));
+ if(i386_limit_check(SS, (stkoff - 4) & 0xffff))
{
logerror("CALL: Stack has no room for return address.\n");
FAULT(FAULT_SS,0) // #SS(0)
diff --git a/src/devices/cpu/i386/x87ops.hxx b/src/devices/cpu/i386/x87ops.hxx
index 20de238eca2..4c58719b88b 100644
--- a/src/devices/cpu/i386/x87ops.hxx
+++ b/src/devices/cpu/i386/x87ops.hxx
@@ -4709,7 +4709,8 @@ void i386_device::x87_fstsw_m2byte(uint8_t modrm)
void i386_device::x87_invalid(uint8_t modrm)
{
// TODO
- fatalerror("x87 invalid instruction (PC:%.4x)\n", m_pc);
+ report_invalid_opcode();
+ i386_trap(6, 0, 0);
}