i386: fix stack size in call too (nw)

This commit is contained in:
cracyc 2018-04-15 22:02:00 -05:00
parent 73e9041964
commit de007f3e5f
2 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -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);
}