Previous 15994 Revisions Next

r14576 Wednesday 22nd February, 2012 at 22:29:24 UTC by Barry Rodewald
i386: Added 32-bit versions of LMSW, and made LMSW change only the lower
4 bits of CR0 [Barry Rodewald]
Fix for Windows 95 blue screen. [Carl]
[src/emu/cpu/i386]i386op16.c i386op32.c i386ops.c i486ops.c

src/emu/cpu/i386/i386op16.c
r14575r14576
33313331            }
33323332            if(PROTECTED_MODE)
33333333               b |= 0x0001;  // cannot return to real mode using this instruction.
3334            cpustate->cr[0] &= ~0x0000ffff;
3335            cpustate->cr[0] |= b & 0x0000ffff;
3334            cpustate->cr[0] &= ~0x0000000f;
3335            cpustate->cr[0] |= b & 0x0000000f;
33363336            break;
33373337         }
33383338      default:
src/emu/cpu/i386/i386ops.c
r14575r14576
736736   int s = (modrm >> 3) & 0x7;
737737
738738   if( modrm >= 0xc0 ) {
739      STORE_RM16(modrm, cpustate->sreg[s].selector);
739      if(cpustate->operand_size)
740         STORE_RM32(modrm, cpustate->sreg[s].selector);
741      else
742         STORE_RM16(modrm, cpustate->sreg[s].selector);
740743      CYCLES(cpustate,CYCLES_MOV_SREG_REG);
741744   } else {
742745      UINT32 ea = GetEA(cpustate,modrm,1);
src/emu/cpu/i386/i486ops.c
r14575r14576
282282         }
283283      case 6:         /* LMSW */
284284         {
285            UINT8 b;
285            UINT16 b;
286286            if(PROTECTED_MODE && cpustate->CPL)
287287               FAULT(FAULT_GP,0)
288288            if( modrm >= 0xc0 ) {
289               b = LOAD_RM8(modrm);
289               b = LOAD_RM16(modrm);
290290               CYCLES(cpustate,CYCLES_LMSW_REG);
291291            } else {
292292               ea = GetEA(cpustate,modrm,0);
293293               CYCLES(cpustate,CYCLES_LMSW_MEM);
294               b = READ8(cpustate,ea);
294               b = READ16(cpustate,ea);
295295            }
296            cpustate->cr[0] &= ~0x03;
297            cpustate->cr[0] |= b & 0x03;
296            if(PROTECTED_MODE)
297               b |= 0x0001;  // cannot return to real mode using this instruction.
298            cpustate->cr[0] &= ~0x0000000f;
299            cpustate->cr[0] |= b & 0x0000000f;
298300            break;
299301         }
300302      case 7:         /* INVLPG */
r14575r14576
387389            }
388390            break;
389391         }
392      case 6:         /* LMSW */
393         {
394            if(PROTECTED_MODE && cpustate->CPL)
395               FAULT(FAULT_GP,0)
396            UINT16 b;
397            if( modrm >= 0xc0 ) {
398               b = LOAD_RM16(modrm);
399               CYCLES(cpustate,CYCLES_LMSW_REG);
400            } else {
401               ea = GetEA(cpustate,modrm,0);
402               CYCLES(cpustate,CYCLES_LMSW_MEM);
403            b = READ16(cpustate,ea);
404            }
405            if(PROTECTED_MODE)
406               b |= 0x0001;  // cannot return to real mode using this instruction.
407            cpustate->cr[0] &= ~0x0000000f;
408            cpustate->cr[0] |= b & 0x0000000f;
409            break;
410         }
390411      case 7:         /* INVLPG */
391412         {
392413            // Nothing to do ?
src/emu/cpu/i386/i386op32.c
r14575r14576
31633163            }
31643164            break;
31653165         }
3166      case 6:         /* LMSW */
3167         {
3168            if(PROTECTED_MODE && cpustate->CPL)
3169               FAULT(FAULT_GP,0)
3170            UINT16 b;
3171            if( modrm >= 0xc0 ) {
3172               b = LOAD_RM16(modrm);
3173               CYCLES(cpustate,CYCLES_LMSW_REG);
3174            } else {
3175               ea = GetEA(cpustate,modrm,0);
3176               CYCLES(cpustate,CYCLES_LMSW_MEM);
3177            b = READ16(cpustate,ea);
3178            }
3179            if(PROTECTED_MODE)
3180               b |= 0x0001;  // cannot return to real mode using this instruction.
3181            cpustate->cr[0] &= ~0x0000000f;
3182            cpustate->cr[0] |= b & 0x0000000f;
3183            break;
3184         }
31663185      default:
31673186         fatalerror("i386: unimplemented opcode 0x0f 01 /%d at %08X", (modrm >> 3) & 0x7, cpustate->eip - 2);
31683187         break;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team