mirror of
https://github.com/holub/mame
synced 2025-05-25 23:35:26 +03:00
i386: Reset NT flag on interrupt in V86 mode. (no whatsnew)
This commit is contained in:
parent
6d68855cc0
commit
077b528513
@ -393,6 +393,27 @@ static void i386_check_sreg_validity(i386_state* cpustate, int reg)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// this will be more useful once expand-down segments are supported (the FM-Towns uses these for the stack)
|
||||
static void i386_stack_check(i386_state *cpustate, INT16 offset)
|
||||
{
|
||||
if(PROTECTED_MODE && !V8086_MODE)
|
||||
{
|
||||
// Check that both current and eventual stack pointers are within the segment limits
|
||||
if(REG32(ESP) > cpustate->sreg[SS].limit)
|
||||
{
|
||||
logerror("Stack (%08x): ESP is outside stack segment limit.\n",cpustate->pc);
|
||||
FAULT(FAULT_SS,0);
|
||||
}
|
||||
if(REG32(ESP) + offset > cpustate->sreg[SS].limit)
|
||||
{
|
||||
logerror("Stack (%08x): ESP + offset (%i) is outside stack segment limit.\n",cpustate->pc,offset);
|
||||
FAULT(FAULT_SS,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void i386_protected_mode_sreg_load(i386_state *cpustate, UINT16 selector, UINT8 reg)
|
||||
{
|
||||
// Checks done when MOV changes a segment register in protected mode
|
||||
@ -623,6 +644,7 @@ static void i386_trap(i386_state *cpustate,int irq, int irq_gate, int trap_level
|
||||
tempflags = get_flags(cpustate);
|
||||
cpustate->VM = 0;
|
||||
cpustate->TF = 0;
|
||||
cpustate->NT = 0;
|
||||
if(type == 0x0e || type == 0x06)
|
||||
cpustate->IF = 0;
|
||||
tempSS = cpustate->sreg[SS].selector;
|
||||
|
@ -1587,7 +1587,9 @@ static void I386OP(pop_ss16)(i386_state *cpustate) // Opcode 0x17
|
||||
static void I386OP(pop_rm16)(i386_state *cpustate) // Opcode 0x8f
|
||||
{
|
||||
UINT8 modrm = FETCH(cpustate);
|
||||
UINT16 value = POP16(cpustate);
|
||||
UINT16 value;
|
||||
|
||||
value = POP16(cpustate);
|
||||
|
||||
if( modrm >= 0xc0 ) {
|
||||
STORE_RM16(modrm, value);
|
||||
@ -1613,7 +1615,7 @@ static void I386OP(popa)(i386_state *cpustate) // Opcode 0x61
|
||||
|
||||
static void I386OP(popf)(i386_state *cpustate) // Opcode 0x9d
|
||||
{
|
||||
UINT32 value = POP16(cpustate);
|
||||
UINT32 value;
|
||||
UINT32 current = get_flags(cpustate);
|
||||
UINT8 IOPL = (current >> 12) & 0x03;
|
||||
UINT32 mask = 0x7fd5;
|
||||
@ -1636,6 +1638,7 @@ static void I386OP(popf)(i386_state *cpustate) // Opcode 0x9d
|
||||
mask &= ~0x00003000; // IOPL cannot be changed while in V8086 mode
|
||||
}
|
||||
|
||||
value = POP16(cpustate);
|
||||
set_flags(cpustate,(current & ~mask) | (value & mask)); // mask out reserved bits
|
||||
CYCLES(cpustate,CYCLES_POPF);
|
||||
}
|
||||
|
@ -1463,7 +1463,9 @@ static void I386OP(pop_ss32)(i386_state *cpustate) // Opcode 0x17
|
||||
static void I386OP(pop_rm32)(i386_state *cpustate) // Opcode 0x8f
|
||||
{
|
||||
UINT8 modrm = FETCH(cpustate);
|
||||
UINT32 value = POP32(cpustate);
|
||||
UINT32 value;
|
||||
|
||||
value = POP32(cpustate);
|
||||
|
||||
if( modrm >= 0xc0 ) {
|
||||
STORE_RM32(modrm, value);
|
||||
@ -1489,13 +1491,11 @@ static void I386OP(popad)(i386_state *cpustate) // Opcode 0x61
|
||||
|
||||
static void I386OP(popfd)(i386_state *cpustate) // Opcode 0x9d
|
||||
{
|
||||
UINT32 value = POP32(cpustate);
|
||||
UINT32 value;
|
||||
UINT32 current = get_flags(cpustate);
|
||||
UINT8 IOPL = (current >> 12) & 0x03;
|
||||
UINT32 mask = 0x00257fd5; // VM, VIP and VIF cannot be set by POPF/POPFD
|
||||
|
||||
value &= ~0x00010000; // RF will always return zero
|
||||
|
||||
// IOPL can only change if CPL is 0
|
||||
if(cpustate->CPL != 0)
|
||||
mask &= ~0x00003000;
|
||||
@ -1513,6 +1513,9 @@ static void I386OP(popfd)(i386_state *cpustate) // Opcode 0x9d
|
||||
}
|
||||
mask &= ~0x00003000; // IOPL cannot be changed while in V8086 mode
|
||||
}
|
||||
|
||||
value = POP32(cpustate);
|
||||
value &= ~0x00010000; // RF will always return zero
|
||||
set_flags(cpustate,(current & ~mask) | (value & mask)); // mask out reserved bits
|
||||
CYCLES(cpustate,CYCLES_POPF);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user