summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2016-02-14 19:45:23 -0600
committer cracyc <cracyc@users.noreply.github.com>2016-02-14 19:45:23 -0600
commit74dfcd6a84222ac4a601abf5f06ace300627f62d (patch)
treedb250cc2d7b31cdc358dfddda97330bc1b59bc8a /src
parent94f44bbcea731903d6cd839f1646b5bea0be7b3b (diff)
i386: don't change IF when IOPL < CPL (nw)
Diffstat (limited to 'src')
-rw-r--r--src/devices/cpu/i386/i386.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index 62a65155a59..be65518f57b 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -2364,6 +2364,7 @@ void i386_device::i386_protected_mode_iret(int operand32)
I386_SREG desc,stack;
UINT8 CPL, RPL, DPL;
UINT32 newflags;
+ UINT8 IOPL = m_IOP1 | (m_IOP2 << 1);
CPL = m_CPL;
UINT32 ea = i386_translate(SS, (STACK_32BIT)?REG32(ESP):REG16(SP), 0);
@@ -2383,7 +2384,7 @@ void i386_device::i386_protected_mode_iret(int operand32)
if(V8086_MODE)
{
UINT32 oldflags = get_flags();
- if(!m_IOP1 || !m_IOP2)
+ if(IOPL != 3)
{
logerror("IRET (%08x): Is in Virtual 8086 mode and IOPL != 3.\n",m_pc);
FAULT(FAULT_GP,0)
@@ -2455,6 +2456,8 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
+ if(CPL > IOPL)
+ newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
set_flags(newflags);
m_eip = POP32() & 0xffff; // high 16 bits are ignored
@@ -2584,6 +2587,8 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
+ if(CPL > IOPL)
+ newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
if(operand32 == 0)
@@ -2753,6 +2758,8 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
+ if(CPL > IOPL)
+ newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
if(operand32 == 0)