Previous 15994 Revisions Next

r14041 Sunday 15th January, 2012 at 09:39:23 UTC by Barry Rodewald
i386: Reset NT flag on interrupt during V86 mode. (no whatsnew)
[src/emu/cpu/i386]i386.c i386op16.c i386op32.c

src/emu/cpu/i386/i386op16.c
r14040r14041
15871587static void I386OP(pop_rm16)(i386_state *cpustate)         // Opcode 0x8f
15881588{
15891589   UINT8 modrm = FETCH(cpustate);
1590   UINT16 value = POP16(cpustate);
1590   UINT16 value;
15911591
1592   value = POP16(cpustate);
1593
15921594   if( modrm >= 0xc0 ) {
15931595      STORE_RM16(modrm, value);
15941596   } else {
r14040r14041
16131615
16141616static void I386OP(popf)(i386_state *cpustate)            // Opcode 0x9d
16151617{
1616   UINT32 value = POP16(cpustate);
1618   UINT32 value;
16171619   UINT32 current = get_flags(cpustate);
16181620   UINT8 IOPL = (current >> 12) & 0x03;
16191621   UINT32 mask = 0x7fd5;
r14040r14041
16361638      mask &= ~0x00003000;  // IOPL cannot be changed while in V8086 mode
16371639   }
16381640
1641   value = POP16(cpustate);
16391642   set_flags(cpustate,(current & ~mask) | (value & mask));  // mask out reserved bits
16401643   CYCLES(cpustate,CYCLES_POPF);
16411644}
src/emu/cpu/i386/i386.c
r14040r14041
393393   }
394394}
395395
396#if 0
397// this will be more useful once expand-down segments are supported (the FM-Towns uses these for the stack)
398static void i386_stack_check(i386_state *cpustate, INT16 offset)
399{
400   if(PROTECTED_MODE && !V8086_MODE)
401   {
402      // Check that both current and eventual stack pointers are within the segment limits
403      if(REG32(ESP) > cpustate->sreg[SS].limit)
404      {
405         logerror("Stack (%08x): ESP is outside stack segment limit.\n",cpustate->pc);
406         FAULT(FAULT_SS,0);
407      }
408      if(REG32(ESP) + offset > cpustate->sreg[SS].limit)
409      {
410         logerror("Stack (%08x): ESP + offset (%i) is outside stack segment limit.\n",cpustate->pc,offset);
411         FAULT(FAULT_SS,0);
412      }
413   }
414}
415#endif
416
396417static void i386_protected_mode_sreg_load(i386_state *cpustate, UINT16 selector, UINT8 reg)
397418{
398419   // Checks done when MOV changes a segment register in protected mode
r14040r14041
623644         tempflags = get_flags(cpustate);
624645         cpustate->VM = 0;
625646         cpustate->TF = 0;
647         cpustate->NT = 0;
626648         if(type == 0x0e || type == 0x06)
627649            cpustate->IF = 0;
628650         tempSS = cpustate->sreg[SS].selector;
src/emu/cpu/i386/i386op32.c
r14040r14041
14631463static void I386OP(pop_rm32)(i386_state *cpustate)         // Opcode 0x8f
14641464{
14651465   UINT8 modrm = FETCH(cpustate);
1466   UINT32 value = POP32(cpustate);
1466   UINT32 value;
14671467
1468   value = POP32(cpustate);
1469
14681470   if( modrm >= 0xc0 ) {
14691471      STORE_RM32(modrm, value);
14701472   } else {
r14040r14041
14891491
14901492static void I386OP(popfd)(i386_state *cpustate)            // Opcode 0x9d
14911493{
1492   UINT32 value = POP32(cpustate);
1494   UINT32 value;
14931495   UINT32 current = get_flags(cpustate);
14941496   UINT8 IOPL = (current >> 12) & 0x03;
14951497   UINT32 mask = 0x00257fd5;  // VM, VIP and VIF cannot be set by POPF/POPFD
14961498
1497   value &= ~0x00010000;  // RF will always return zero
1498
14991499   // IOPL can only change if CPL is 0
15001500   if(cpustate->CPL != 0)
15011501      mask &= ~0x00003000;
r14040r14041
15131513      }
15141514      mask &= ~0x00003000;  // IOPL cannot be changed while in V8086 mode
15151515   }
1516
1517   value = POP32(cpustate);
1518   value &= ~0x00010000;  // RF will always return zero
15161519   set_flags(cpustate,(current & ~mask) | (value & mask));  // mask out reserved bits
15171520   CYCLES(cpustate,CYCLES_POPF);
15181521}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team