Previous 15994 Revisions Next

r14000 Thursday 12th January, 2012 at 23:48:16 UTC by Barry Rodewald
i386: Added the ability to set the ID and AC bits via POPFD, should improve CPU detection. (no whatsnew)
[src/emu/cpu/i386]i386op16.c i386op32.c

src/emu/cpu/i386/i386op16.c
r13999r14000
16261626   if(cpustate->CPL > IOPL)
16271627      mask &= ~0x00000200;
16281628
1629   if(V8086_MODE)
1630   {
1631      if(IOPL < 3)
1632      {
1633         logerror("POPFD(%08x): IOPL < 3 while in V86 mode.\n",cpustate->pc);
1634         FAULT(FAULT_GP,0)  // #GP(0)
1635      }
1636      mask &= ~0x00003000;  // IOPL cannot be changed while in V8086 mode
1637   }
1638
16291639   set_flags(cpustate,(current & ~mask) | (value & mask));  // mask out reserved bits
16301640   CYCLES(cpustate,CYCLES_POPF);
16311641}
src/emu/cpu/i386/i386op32.c
r13999r14000
14921492   UINT32 value = POP32(cpustate);
14931493   UINT32 current = get_flags(cpustate);
14941494   UINT8 IOPL = (current >> 12) & 0x03;
1495   UINT32 mask = 0x00007fd5;  // VM and RF are not affected by POPF or POPFD, same for higher (486+) bits?
1495   UINT32 mask = 0x00257fd5;  // VM, VIP and VIF cannot be set by POPF/POPFD
14961496
1497   value &= ~0x00010000;  // RF will always return zero
1498
14971499   // IOPL can only change if CPL is 0
14981500   if(cpustate->CPL != 0)
14991501      mask &= ~0x00003000;
r13999r14000
15021504   if(cpustate->CPL > IOPL)
15031505      mask &= ~0x00000200;
15041506
1507   if(V8086_MODE)
1508   {
1509      if(IOPL < 3)
1510      {
1511         logerror("POPFD(%08x): IOPL < 3 while in V86 mode.\n",cpustate->pc);
1512         FAULT(FAULT_GP,0)  // #GP(0)
1513      }
1514      mask &= ~0x00003000;  // IOPL cannot be changed while in V8086 mode
1515   }
1516
15051517   set_flags(cpustate,(current & ~mask) | (value & mask));  // mask out reserved bits
15061518   CYCLES(cpustate,CYCLES_POPF);
15071519}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team