Author: aandrejevic
Date: Sat Oct 19 23:43:53 2013
New Revision: 60715
URL:
http://svn.reactos.org/svn/reactos?rev=60715&view=rev
Log:
[FAST486]
Fix more prefix handling.
Create the macros TOGGLE_ADSIZE and TOGGLE_OPSIZE to shorten the code.
Modified:
branches/ntvdm/lib/fast486/common.h
branches/ntvdm/lib/fast486/extraops.c
branches/ntvdm/lib/fast486/opcodes.c
branches/ntvdm/lib/fast486/opgroups.c
Modified: branches/ntvdm/lib/fast486/common.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.h?rev=…
==============================================================================
--- branches/ntvdm/lib/fast486/common.h [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/common.h [iso-8859-1] Sat Oct 19 23:43:53 2013
@@ -45,6 +45,14 @@
{\
Fast486Exception(State, FAST486_EXCEPTION_UD);\
return FALSE;\
+}
+#define TOGGLE_OPSIZE(x) if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)\
+{\
+ x = !x;\
+}
+#define TOGGLE_ADSIZE(x) if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)\
+{\
+ x = !x;\
}
#define PAGE_ALIGN(x) ((x) & 0xFFFFF000)
Modified: branches/ntvdm/lib/fast486/extraops.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/extraops.c?re…
==============================================================================
--- branches/ntvdm/lib/fast486/extraops.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/extraops.c [iso-8859-1] Sat Oct 19 23:43:53 2013
@@ -345,11 +345,7 @@
UCHAR Source, Destination, Result;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -399,17 +395,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -500,18 +487,8 @@
LONG Offset = 0;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_LOCK)
- {
- /* Invalid prefix */
- Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
- }
+ TOGGLE_OPSIZE(Size);
+ NO_LOCK_PREFIX();
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF0) == 0x80);
@@ -620,11 +597,7 @@
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
FAST486_MOD_REG_RM ModRegRm;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
Modified: branches/ntvdm/lib/fast486/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opcodes.c?rev…
==============================================================================
--- branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] Sat Oct 19 23:43:53 2013
@@ -466,12 +466,7 @@
ULONG Value;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Make sure this is the right instruction */
@@ -505,12 +500,7 @@
ULONG Value;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Make sure this is the right instruction */
@@ -555,12 +545,7 @@
ULONG Value;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_SS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Make sure this is the right instruction */
@@ -579,13 +564,6 @@
FAST486_OPCODE_HANDLER(Fast486OpcodeNop)
{
- if (State->PrefixFlags & ~(FAST486_PREFIX_OPSIZE | FAST486_PREFIX_REP))
- {
- /* Allowed prefixes are REP and OPSIZE */
- Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
- }
-
if (State->PrefixFlags & FAST486_PREFIX_REP)
{
/* Idle cycle */
@@ -600,12 +578,7 @@
INT Reg = Opcode & 0x07;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Make sure this is the right instruction */
@@ -952,12 +925,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF7) == 0xE5);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Opcode == 0xE5)
@@ -1047,12 +1015,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF7) == 0xE7);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Opcode == 0xE7)
@@ -1122,12 +1085,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF8) == 0xB8);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Size)
@@ -1206,20 +1164,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x00);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
- else if (State->PrefixFlags
- & ~(FAST486_PREFIX_ADSIZE
- | FAST486_PREFIX_SEG
- | FAST486_PREFIX_LOCK))
- {
- /* Invalid prefix */
- Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1266,17 +1211,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1397,12 +1333,7 @@
ASSERT(Opcode == 0x05);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -1469,11 +1400,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x08);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1518,17 +1445,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1643,12 +1561,7 @@
ASSERT(Opcode == 0x0D);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -1711,11 +1624,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x20);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1760,17 +1669,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1880,12 +1780,7 @@
ASSERT(Opcode == 0x25);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -1948,11 +1843,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x30);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -1997,17 +1888,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2122,12 +2004,7 @@
ASSERT(Opcode == 0x35);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -2190,11 +2067,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x84);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2235,17 +2108,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2349,12 +2213,7 @@
ASSERT(Opcode == 0xA9);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -2412,11 +2271,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x86);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2467,17 +2322,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2593,11 +2439,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x10);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2648,17 +2490,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2792,12 +2625,7 @@
ASSERT(Opcode == 0x15);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -2893,11 +2721,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x18);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -2954,17 +2778,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -3106,12 +2921,7 @@
ASSERT(Opcode == 0x1D);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -3235,11 +3045,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xED) == 0x28);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -3304,17 +3110,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -3475,12 +3272,7 @@
ASSERT((Opcode & 0xEF) == 0x2D);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -3649,12 +3441,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x60);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Push all the registers in order */
@@ -3693,12 +3480,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x61);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Pop all the registers in reverse order */
@@ -3745,11 +3527,7 @@
return FALSE;
}
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -3797,12 +3575,7 @@
ASSERT(Opcode == 0x68);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -3844,17 +3617,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Fetch the parameters */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -3981,11 +3745,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x88);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4024,17 +3784,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4100,17 +3851,8 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x8C);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4152,17 +3894,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4207,17 +3940,8 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x8E);
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the address size */
- AddressSize = !AddressSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the operand size */
- OperandSize = !OperandSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
+ TOGGLE_OPSIZE(OperandSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4267,12 +3991,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x98);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Size)
@@ -4303,12 +4022,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x99);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Size)
@@ -4338,12 +4052,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x9A);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Fetch the offset */
@@ -4412,12 +4121,7 @@
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* This OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
/* Check for VM86 mode when IOPL is not 3 */
if (State->Flags.Vm && (State->Flags.Iopl != 3))
@@ -4439,12 +4143,7 @@
ULONG NewFlags;
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* This OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
/* Pop the new flags */
if (!Fast486StackPop(State, &NewFlags))
@@ -4597,12 +4296,7 @@
ASSERT((Opcode & 0xFE) == 0xC2);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Opcode == 0xC2)
{
@@ -4639,11 +4333,7 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Get the operands */
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
@@ -4735,12 +4425,7 @@
ASSERT(Opcode == 0xC8);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (!Fast486FetchWord(State, &FrameSize))
{
@@ -4799,12 +4484,7 @@
ASSERT(Opcode == 0xC9);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -4841,12 +4521,7 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xCA);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Opcode == 0xCA)
@@ -4966,12 +4641,7 @@
ASSERT(Opcode == 0xCF);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
/* Pop EIP */
if (!Fast486StackPop(State, &InstPtr))
@@ -5234,11 +4904,7 @@
UCHAR Value;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
/* Read a byte from DS:[(E)BX + AL] */
if (!Fast486ReadMemory(State,
@@ -5271,12 +4937,7 @@
ASSERT((Opcode >= 0xE0) && (Opcode <= 0xE2));
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size) Condition = ((--State->GeneralRegs[FAST486_REG_ECX].Long) != 0);
else Condition = ((--State->GeneralRegs[FAST486_REG_ECX].LowWord) != 0);
@@ -5319,12 +4980,7 @@
ASSERT(Opcode == 0xE3);
NO_LOCK_PREFIX();
-
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size) Condition = (State->GeneralRegs[FAST486_REG_ECX].Long == 0);
else Condition = (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0);
@@ -5352,12 +5008,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xE8);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Size)
@@ -5413,12 +5064,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xE9);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
if (Size)
@@ -5462,12 +5108,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xEA);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
-
+ TOGGLE_OPSIZE(Size);
NO_LOCK_PREFIX();
/* Fetch the offset */
@@ -5517,11 +5158,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xA0);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -5561,11 +5198,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xA1);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -5615,11 +5248,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xA2);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -5658,11 +5287,7 @@
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xA3);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- Size = !Size;
- }
+ TOGGLE_OPSIZE(Size);
if (Size)
{
@@ -5726,17 +5351,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xA4);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (State->PrefixFlags & FAST486_PREFIX_SEG)
{
@@ -5920,17 +5536,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xA6);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (State->PrefixFlags & FAST486_PREFIX_SEG)
{
@@ -6065,17 +5672,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xAA);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
/* Calculate the size */
if (Opcode == 0xAA) DataSize = sizeof(UCHAR);
@@ -6205,17 +5803,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xAC);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (State->PrefixFlags & FAST486_PREFIX_SEG)
{
@@ -6290,17 +5879,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xAE);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
/* Calculate the size */
if (Opcode == 0xAE) DataSize = sizeof(UCHAR);
@@ -6400,17 +5980,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0x6C);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
/* Calculate the size */
if (Opcode == 0x6C) DataSize = sizeof(UCHAR);
@@ -6548,17 +6119,8 @@
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0x6E);
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
/* Calculate the size */
if (Opcode == 0x6E) DataSize = sizeof(UCHAR);
Modified: branches/ntvdm/lib/fast486/opgroups.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opgroups.c?re…
==============================================================================
--- branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] Sat Oct 19 23:43:53 2013
@@ -297,11 +297,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -342,17 +338,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -426,17 +413,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -505,17 +483,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -559,11 +528,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -607,17 +572,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -682,11 +638,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -721,17 +673,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -786,11 +729,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -823,18 +762,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -884,11 +813,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -924,17 +849,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -992,11 +908,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -1131,17 +1043,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -1386,11 +1289,7 @@
FAST486_MOD_REG_RM ModRegRm;
BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
@@ -1446,17 +1345,8 @@
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
- {
- /* The OPSIZE prefix toggles the size */
- OperandSize = !OperandSize;
- }
-
- if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
- {
- /* The ADSIZE prefix toggles the size */
- AddressSize = !AddressSize;
- }
+ TOGGLE_OPSIZE(OperandSize);
+ TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{