summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2013-09-13 13:57:47 +0000
committer cracyc <cracyc@users.noreply.github.com>2013-09-13 13:57:47 +0000
commitddc3074ec6fa9768b0e0ca7c95c30bbcfe5ff768 (patch)
tree87257ce2ca21026cbeb0ae315d3fc199d81ea182
parentb4ac65f9372da85d5f5b03e40e3ff1951c8a41e6 (diff)
i386: use correct PL and stack address size in call gates (nw)
--- fixes win95 hw detection
-rw-r--r--src/emu/cpu/i386/i386.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c
index 11e8fb1d2c5..cf6e1143d0f 100644
--- a/src/emu/cpu/i386/i386.c
+++ b/src/emu/cpu/i386/i386.c
@@ -1760,6 +1760,10 @@ static void i386_protected_mode_call(i386_state *cpustate, UINT16 seg, UINT32 of
FAULT(FAULT_SS,stack.selector) // #SS(SS selector)
}
UINT32 newESP = i386_get_stack_ptr(cpustate,DPL);
+ if(!stack.d)
+ {
+ newESP &= 0xffff;
+ }
if(operand32 != 0)
{
if(newESP < ((gate.dword_count & 0x1f) + 16))
@@ -1775,7 +1779,6 @@ static void i386_protected_mode_call(i386_state *cpustate, UINT16 seg, UINT32 of
}
else
{
- newESP &= 0x0000ffff;
if(newESP < ((gate.dword_count & 0x1f) + 8))
{
logerror("CALL: Call gate: New stack has no room for 16-bit return address and parameters.\n");
@@ -1795,7 +1798,7 @@ static void i386_protected_mode_call(i386_state *cpustate, UINT16 seg, UINT32 of
WRITE_TEST(cpustate, stack.base+newESP-1);
/* switch to new stack */
oldSS = cpustate->sreg[SS].selector;
- cpustate->sreg[SS].selector = i386_get_stack_segment(cpustate,gate.selector & 0x03);
+ cpustate->sreg[SS].selector = i386_get_stack_segment(cpustate,cpustate->CPL);
if(operand32 != 0)
{
oldESP = REG32(ESP);