mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[FAST486]
Create a macro SWAP (swaps two variables) to shorten the code. Implement the BSWAP instruction. svn path=/branches/ntvdm/; revision=60717
This commit is contained in:
parent
a93095e678
commit
67b093f38c
4 changed files with 33 additions and 26 deletions
|
@ -54,6 +54,7 @@
|
|||
{\
|
||||
x = !x;\
|
||||
}
|
||||
#define SWAP(x, y) { (x) ^= (y); (y) ^= (x); (x) ^= (y); }
|
||||
|
||||
#define PAGE_ALIGN(x) ((x) & 0xFFFFF000)
|
||||
#define PAGE_OFFSET(x) ((x) & 0x00000FFF)
|
||||
|
|
|
@ -238,14 +238,14 @@ Fast486ExtendedHandlers[FAST486_NUM_OPCODE_HANDLERS] =
|
|||
NULL, // Invalid
|
||||
NULL, // Invalid
|
||||
NULL, // Invalid
|
||||
NULL, // TODO: OPCODE 0xC8 NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xC9 NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCA NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCB NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCC NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCD NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCE NOT IMPLEMENTED
|
||||
NULL, // TODO: OPCODE 0xCF NOT IMPLEMENTED
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
Fast486ExtOpcodeBswap,
|
||||
NULL, // Invalid
|
||||
NULL, // Invalid
|
||||
NULL, // Invalid
|
||||
|
@ -1021,6 +1021,23 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet)
|
|||
return Fast486WriteModrmByteOperands(State, &ModRegRm, FALSE, Value);
|
||||
}
|
||||
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBswap)
|
||||
{
|
||||
PUCHAR Pointer;
|
||||
|
||||
NO_LOCK_PREFIX();
|
||||
|
||||
/* Get a pointer to the value */
|
||||
Pointer = (PUCHAR)&State->GeneralRegs[Opcode & 0x07].Long;
|
||||
|
||||
/* Swap the byte order */
|
||||
SWAP(Pointer[0], Pointer[3]);
|
||||
SWAP(Pointer[1], Pointer[2]);
|
||||
|
||||
/* Return success */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FAST486_OPCODE_HANDLER(Fast486OpcodeExtended)
|
||||
{
|
||||
UCHAR SecondOpcode;
|
||||
|
|
|
@ -35,6 +35,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtr);
|
|||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalJmp);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeConditionalSet);
|
||||
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBswap);
|
||||
FAST486_OPCODE_HANDLER(Fast486OpcodeExtended);
|
||||
|
||||
#endif // _EXTRAOPS_H_
|
||||
|
|
|
@ -2743,9 +2743,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
@ -2806,9 +2804,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
@ -2846,9 +2842,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
@ -3067,9 +3061,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
@ -3138,9 +3130,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
@ -3187,9 +3177,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm)
|
|||
if (!(Opcode & FAST486_OPCODE_WRITE_REG))
|
||||
{
|
||||
/* Swap the order */
|
||||
FirstValue ^= SecondValue;
|
||||
SecondValue ^= FirstValue;
|
||||
FirstValue ^= SecondValue;
|
||||
SWAP(FirstValue, SecondValue);
|
||||
}
|
||||
|
||||
/* Calculate the result */
|
||||
|
|
Loading…
Reference in a new issue