[NTVDM] : Implement getMSW and setMSW for getting and setting the Machine Status Word (lower word of CR0).

[FAST486]: MSW = Machine Status Word

svn path=/branches/ntvdm/; revision=61044
This commit is contained in:
Hermès Bélusca-Maïto 2013-11-18 20:25:10 +00:00
parent 74933952b5
commit 8998a96d56
2 changed files with 10 additions and 8 deletions

View file

@ -1803,7 +1803,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
/* SMSW */ /* SMSW */
case 4: case 4:
{ {
/* Store the lower 16 bits of CR0 */ /* Store the lower 16 bits (Machine Status Word) of CR0 */
return Fast486WriteModrmWordOperands(State, return Fast486WriteModrmWordOperands(State,
&ModRegRm, &ModRegRm,
FALSE, FALSE,
@ -1813,7 +1813,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
/* LMSW */ /* LMSW */
case 6: case 6:
{ {
USHORT MasterStatusWord, Dummy; USHORT MachineStatusWord, Dummy;
/* This is a privileged instruction */ /* This is a privileged instruction */
if (Fast486GetCurrentPrivLevel(State) != 0) if (Fast486GetCurrentPrivLevel(State) != 0)
@ -1822,8 +1822,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
return FALSE; return FALSE;
} }
/* Read the new master status word */ /* Read the new Machine Status Word */
if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Dummy, &MasterStatusWord)) if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Dummy, &MachineStatusWord))
{ {
/* Exception occurred */ /* Exception occurred */
return FALSE; return FALSE;
@ -1831,7 +1831,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
/* This instruction cannot be used to return to real mode */ /* This instruction cannot be used to return to real mode */
if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
&& !(MasterStatusWord & FAST486_CR0_PE)) && !(MachineStatusWord & FAST486_CR0_PE))
{ {
Fast486Exception(State, FAST486_EXCEPTION_GP); Fast486Exception(State, FAST486_EXCEPTION_GP);
return FALSE; return FALSE;
@ -1839,7 +1839,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
/* Set the lowest 4 bits */ /* Set the lowest 4 bits */
State->ControlRegisters[FAST486_REG_CR0] &= 0xFFFFFFF0; State->ControlRegisters[FAST486_REG_CR0] &= 0xFFFFFFF0;
State->ControlRegisters[FAST486_REG_CR0] |= MasterStatusWord & 0x0F; State->ControlRegisters[FAST486_REG_CR0] |= MachineStatusWord & 0x0F;
return TRUE; return TRUE;
} }

View file

@ -661,14 +661,16 @@ USHORT
CDECL CDECL
getMSW(VOID) getMSW(VOID)
{ {
return 0; // UNIMPLEMENTED return LOWORD(EmulatorContext.ControlRegisters[FAST486_REG_CR0]);
} }
VOID VOID
CDECL CDECL
setMSW(USHORT Value) setMSW(USHORT Value)
{ {
// UNIMPLEMENTED /* Set the lowest word (8 bits) */
EmulatorContext.ControlRegisters[FAST486_REG_CR0] &= 0xFFFF0000;
EmulatorContext.ControlRegisters[FAST486_REG_CR0] |= Value & 0xFFFF;
} }
/* EOF */ /* EOF */