diff options
author | 2019-05-25 21:55:53 -0500 | |
---|---|---|
committer | 2019-05-25 21:55:53 -0500 | |
commit | 85c7144e0d4105ac38df8ae7792e9002a0e985ff (patch) | |
tree | b87bbd0ff4b8f1be5764d1ac23984107c13a977f /src/devices/cpu/i386 | |
parent | 4187ef61d0bbdef0f3ef0f23c7855532816c92cd (diff) |
i386: fix enter insn (nw)
Diffstat (limited to 'src/devices/cpu/i386')
-rw-r--r-- | src/devices/cpu/i386/i386op16.hxx | 16 | ||||
-rw-r--r-- | src/devices/cpu/i386/i386op32.hxx | 16 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/devices/cpu/i386/i386op16.hxx b/src/devices/cpu/i386/i386op16.hxx index cfaa9901dd5..57c6c06cb63 100644 --- a/src/devices/cpu/i386/i386op16.hxx +++ b/src/devices/cpu/i386/i386op16.hxx @@ -1185,10 +1185,20 @@ void i386_device::i386_enter16() // Opcode 0xc8 if(level > 0) { - for(x=1;x<level-1;x++) + for(x=1;x<=level-1;x++) { - REG16(BP) -= 2; - PUSH16(READ16(REG16(BP))); + uint32_t addr; + if(!STACK_32BIT) + { + REG16(BP) -= 2; + addr = REG16(BP); + } + else + { + REG32(EBP) -= 2; + addr = REG32(EBP); + } + PUSH16(READ16(i386_translate(SS, addr, 0))); } PUSH16(frameptr); } diff --git a/src/devices/cpu/i386/i386op32.hxx b/src/devices/cpu/i386/i386op32.hxx index 0d5db177169..3b828a779a0 100644 --- a/src/devices/cpu/i386/i386op32.hxx +++ b/src/devices/cpu/i386/i386op32.hxx @@ -1030,10 +1030,20 @@ void i386_device::i386_enter32() // Opcode 0xc8 if(level > 0) { - for(x=1;x<level-1;x++) + for(x=1;x<=level-1;x++) { - REG32(EBP) -= 4; - PUSH32(READ32(REG32(EBP))); + uint32_t addr; + if(!STACK_32BIT) + { + REG16(BP) -= 4; + addr = REG16(BP); + } + else + { + REG32(EBP) -= 4; + addr = REG32(EBP); + } + PUSH32(READ32(i386_translate(SS, addr, 0))); } PUSH32(frameptr); } |