mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 20:32:18 +00:00
[FAST486]
XADD: Fix the order of operations. POP <modrm>: The value must be popped from the stack before parsing the Mod-Reg-R/M, because of the "POP DWORD [ESP]" case. svn path=/branches/ntvdm/; revision=60984
This commit is contained in:
parent
53dfb7da48
commit
cd496c8e21
3 changed files with 20 additions and 17 deletions
|
@ -326,7 +326,7 @@ Fast486StackPop(PFAST486_STATE State,
|
||||||
BOOLEAN Size = State->SegmentRegs[FAST486_REG_SS].Size;
|
BOOLEAN Size = State->SegmentRegs[FAST486_REG_SS].Size;
|
||||||
|
|
||||||
/* The OPSIZE prefix toggles the size */
|
/* The OPSIZE prefix toggles the size */
|
||||||
if (State->PrefixFlags & FAST486_PREFIX_OPSIZE) Size = !Size;
|
TOGGLE_OPSIZE(Size);
|
||||||
|
|
||||||
if (Size)
|
if (Size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2032,15 +2032,15 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd)
|
||||||
State->Flags.Sf = ((Result & SIGN_FLAG_LONG) != 0);
|
State->Flags.Sf = ((Result & SIGN_FLAG_LONG) != 0);
|
||||||
State->Flags.Pf = Fast486CalculateParity(Result);
|
State->Flags.Pf = Fast486CalculateParity(Result);
|
||||||
|
|
||||||
/* Write the sum to the destination */
|
/* Write the old value of the destination to the source */
|
||||||
if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result))
|
if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, Destination))
|
||||||
{
|
{
|
||||||
/* Exception occurred */
|
/* Exception occurred */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the old value of the destination to the source */
|
/* Write the sum to the destination */
|
||||||
if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, TRUE, Destination))
|
if (!Fast486WriteModrmDwordOperands(State, &ModRegRm, FALSE, Result))
|
||||||
{
|
{
|
||||||
/* Exception occurred */
|
/* Exception occurred */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2071,15 +2071,15 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeXadd)
|
||||||
State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0);
|
State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0);
|
||||||
State->Flags.Pf = Fast486CalculateParity(Result);
|
State->Flags.Pf = Fast486CalculateParity(Result);
|
||||||
|
|
||||||
/* Write the sum to the destination */
|
/* Write the old value of the destination to the source */
|
||||||
if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result))
|
if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, Destination))
|
||||||
{
|
{
|
||||||
/* Exception occurred */
|
/* Exception occurred */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the old value of the destination to the source */
|
/* Write the sum to the destination */
|
||||||
if (!Fast486WriteModrmWordOperands(State, &ModRegRm, TRUE, Destination))
|
if (!Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, Result))
|
||||||
{
|
{
|
||||||
/* Exception occurred */
|
/* Exception occurred */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -486,12 +486,22 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8F)
|
||||||
TOGGLE_OPSIZE(OperandSize);
|
TOGGLE_OPSIZE(OperandSize);
|
||||||
TOGGLE_ADSIZE(AddressSize);
|
TOGGLE_ADSIZE(AddressSize);
|
||||||
|
|
||||||
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
|
/* Pop a value from the stack - this must be done first */
|
||||||
|
if (!Fast486StackPop(State, &Value))
|
||||||
{
|
{
|
||||||
/* Exception occurred */
|
/* Exception occurred */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
|
||||||
|
{
|
||||||
|
/* Exception occurred - restore SP */
|
||||||
|
if (OperandSize) State->GeneralRegs[FAST486_REG_ESP].Long += sizeof(ULONG);
|
||||||
|
else State->GeneralRegs[FAST486_REG_ESP].LowWord += sizeof(USHORT);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ModRegRm.Register != 0)
|
if (ModRegRm.Register != 0)
|
||||||
{
|
{
|
||||||
/* Invalid */
|
/* Invalid */
|
||||||
|
@ -499,13 +509,6 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup8F)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop a value from the stack */
|
|
||||||
if (!Fast486StackPop(State, &Value))
|
|
||||||
{
|
|
||||||
/* Exception occurred */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OperandSize)
|
if (OperandSize)
|
||||||
{
|
{
|
||||||
return Fast486WriteModrmDwordOperands(State,
|
return Fast486WriteModrmDwordOperands(State,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue