src/emu/cpu/i386/i386op32.c
| r13999 | r14000 | |
| 1492 | 1492 | UINT32 value = POP32(cpustate); |
| 1493 | 1493 | UINT32 current = get_flags(cpustate); |
| 1494 | 1494 | 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 |
| 1496 | 1496 | |
| 1497 | value &= ~0x00010000; // RF will always return zero |
| 1498 | |
| 1497 | 1499 | // IOPL can only change if CPL is 0 |
| 1498 | 1500 | if(cpustate->CPL != 0) |
| 1499 | 1501 | mask &= ~0x00003000; |
| r13999 | r14000 | |
| 1502 | 1504 | if(cpustate->CPL > IOPL) |
| 1503 | 1505 | mask &= ~0x00000200; |
| 1504 | 1506 | |
| 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 | |
| 1505 | 1517 | set_flags(cpustate,(current & ~mask) | (value & mask)); // mask out reserved bits |
| 1506 | 1518 | CYCLES(cpustate,CYCLES_POPF); |
| 1507 | 1519 | } |