mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 00:31:27 +00:00
[FAST486]
Implement the two operand version of IMUL. svn path=/branches/ntvdm/; revision=60929
This commit is contained in:
parent
9677ec13ad
commit
43bbc0afb4
2 changed files with 66 additions and 1 deletions
|
@ -212,7 +212,7 @@ Fast486ExtendedHandlers[FAST486_NUM_OPCODE_HANDLERS] =
|
|||
NULL, // TODO: OPCODE 0xAC NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xAD NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xAE NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xAF NOT IMPLEMENTED
|
||||
Fast486ExtOpcodeImul,
|
||||
Fast486ExtOpcodeCmpXchgByte,
|
||||
Fast486ExtOpcodeCmpXchg,
|
||||
NULL, // TODO: OPCODE 0xB2 NOT IMPLEMENTED
|
||||
|
@ -712,6 +712,70 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul)
|
||||
{
|
||||
BOOLEAN OperandSize, AddressSize;
|
||||
FAST486_MOD_REG_RM ModRegRm;
|
||||
|
||||
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
|
||||
|
||||
/* Get the operands */
|
||||
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
|
||||
{
|
||||
/* Exception occurred */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (OperandSize)
|
||||
{
|
||||
LONG Source, Destination;
|
||||
LONGLONG Result;
|
||||
|
||||
/* Read the operands */
|
||||
if (!Fast486ReadModrmDwordOperands(State,
|
||||
&ModRegRm,
|
||||
(PULONG)&Destination,
|
||||
(PULONG)&Source))
|
||||
{
|
||||
/* Exception occurred */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
Result = (LONGLONG)Source * (LONGLONG)Destination;
|
||||
|
||||
/* Update the flags */
|
||||
State->Flags.Cf = State->Flags.Of = ((Result < -2147483648LL) || (Result > 2147483647LL));
|
||||
|
||||
/* Write back the result */
|
||||
return Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, (ULONG)((LONG)Result));
|
||||
}
|
||||
else
|
||||
{
|
||||
SHORT Source, Destination;
|
||||
LONG Result;
|
||||
|
||||
/* Read the operands */
|
||||
if (!Fast486ReadModrmWordOperands(State,
|
||||
&ModRegRm,
|
||||
(PUSHORT)&Destination,
|
||||
(PUSHORT)&Source))
|
||||
{
|
||||
/* Exception occurred */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
Result = (LONG)Source * (LONG)Destination;
|
||||
|
||||
/* Update the flags */
|
||||
State->Flags.Cf = State->Flags.Of = ((Result < -32768) || (Result > 32767));
|
||||
|
||||
/* Write back the result */
|
||||
return Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, (USHORT)((SHORT)Result));
|
||||
}
|
||||
}
|
||||
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchgByte)
|
||||
{
|
||||
FAST486_MOD_REG_RM ModRegRm;
|
||||
|
|
|
@ -37,6 +37,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBitTest);
|
|||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodePushGs);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodePopGs);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBts);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeImul);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchgByte);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeCmpXchg);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr);
|
||||
|
|
Loading…
Reference in a new issue