mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:52:56 +00:00
[SOFT386]
Implement the CLC, STC, CLI, STI, CLD and STD instructions. svn path=/branches/ntvdm/; revision=59876
This commit is contained in:
parent
1143eab8a5
commit
5a14da958f
2 changed files with 168 additions and 6 deletions
|
@ -272,12 +272,12 @@ Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] =
|
||||||
NULL, // TODO: OPCODE 0xF5 NOT SUPPORTED
|
NULL, // TODO: OPCODE 0xF5 NOT SUPPORTED
|
||||||
NULL, // TODO: OPCODE 0xF6 NOT SUPPORTED
|
NULL, // TODO: OPCODE 0xF6 NOT SUPPORTED
|
||||||
NULL, // TODO: OPCODE 0xF7 NOT SUPPORTED
|
NULL, // TODO: OPCODE 0xF7 NOT SUPPORTED
|
||||||
NULL, // TODO: OPCODE 0xF8 NOT SUPPORTED
|
Soft386OpcodeClearCarry,
|
||||||
NULL, // TODO: OPCODE 0xF9 NOT SUPPORTED
|
Soft386OpcodeSetCarry,
|
||||||
NULL, // TODO: OPCODE 0xFA NOT SUPPORTED
|
Soft386OpcodeClearInt,
|
||||||
NULL, // TODO: OPCODE 0xFB NOT SUPPORTED
|
Soft386OpcodeSetInt,
|
||||||
NULL, // TODO: OPCODE 0xFC NOT SUPPORTED
|
Soft386OpcodeClearDir,
|
||||||
NULL, // TODO: OPCODE 0xFD NOT SUPPORTED
|
Soft386OpcodeSetDir,
|
||||||
NULL, // TODO: OPCODE 0xFE NOT SUPPORTED
|
NULL, // TODO: OPCODE 0xFE NOT SUPPORTED
|
||||||
NULL, // TODO: OPCODE 0xFF NOT SUPPORTED
|
NULL, // TODO: OPCODE 0xFF NOT SUPPORTED
|
||||||
};
|
};
|
||||||
|
@ -740,3 +740,117 @@ Soft386OpcodeShortConditionalJmp(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearCarry(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xF8);
|
||||||
|
|
||||||
|
/* Clear CF and return success */
|
||||||
|
State->Flags.Cf = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetCarry(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xF9);
|
||||||
|
|
||||||
|
/* Set CF and return success*/
|
||||||
|
State->Flags.Cf = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearInt(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xFA);
|
||||||
|
|
||||||
|
/* Check for protected mode */
|
||||||
|
if (State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE)
|
||||||
|
{
|
||||||
|
/* Check IOPL */
|
||||||
|
if (State->Flags.Iopl >= State->SegmentRegs[SOFT386_REG_CS].Dpl)
|
||||||
|
{
|
||||||
|
/* Clear the interrupt flag */
|
||||||
|
State->Flags.If = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* General Protection Fault */
|
||||||
|
Soft386Exception(State, SOFT386_EXCEPTION_GP);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just clear the interrupt flag */
|
||||||
|
State->Flags.If = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetInt(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xFB);
|
||||||
|
|
||||||
|
/* Check for protected mode */
|
||||||
|
if (State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE)
|
||||||
|
{
|
||||||
|
/* Check IOPL */
|
||||||
|
if (State->Flags.Iopl >= State->SegmentRegs[SOFT386_REG_CS].Dpl)
|
||||||
|
{
|
||||||
|
/* Set the interrupt flag */
|
||||||
|
State->Flags.If = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* General Protection Fault */
|
||||||
|
Soft386Exception(State, SOFT386_EXCEPTION_GP);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just set the interrupt flag */
|
||||||
|
State->Flags.If = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearDir(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xFC);
|
||||||
|
|
||||||
|
/* Clear DF and return success */
|
||||||
|
State->Flags.Df = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetDir(PSOFT386_STATE State, UCHAR Opcode)
|
||||||
|
{
|
||||||
|
/* Make sure this is the right instruction */
|
||||||
|
ASSERT(Opcode == 0xFD);
|
||||||
|
|
||||||
|
/* Set DF and return success*/
|
||||||
|
State->Flags.Df = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -87,4 +87,52 @@ Soft386OpcodeShortConditionalJmp
|
||||||
UCHAR Opcode
|
UCHAR Opcode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearCarry
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetCarry
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearInt
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetInt
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeClearDir
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
FASTCALL
|
||||||
|
Soft386OpcodeSetDir
|
||||||
|
(
|
||||||
|
PSOFT386_STATE State,
|
||||||
|
UCHAR Opcode
|
||||||
|
);
|
||||||
|
|
||||||
#endif // _OPCODES_H_
|
#endif // _OPCODES_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue