/*
- * Soft386 386/486 CPU Emulation Library
+ * Fast486 386/486 CPU Emulation Library
* opcodes.c
*
* Copyright (C) 2013 Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
// #define NDEBUG
#include <debug.h>
-#include <soft386.h>
+#include <fast486.h>
#include "opcodes.h"
#include "opgroups.h"
#include "extraops.h"
/* PUBLIC VARIABLES ***********************************************************/
-SOFT386_OPCODE_HANDLER_PROC
-Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] =
+FAST486_OPCODE_HANDLER_PROC
+Fast486OpcodeHandlers[FAST486_NUM_OPCODE_HANDLERS] =
{
- Soft386OpcodeAddByteModrm,
- Soft386OpcodeAddModrm,
- Soft386OpcodeAddByteModrm,
- Soft386OpcodeAddModrm,
- Soft386OpcodeAddAl,
- Soft386OpcodeAddEax,
- Soft386OpcodePushEs,
- Soft386OpcodePopEs,
- Soft386OpcodeOrByteModrm,
- Soft386OpcodeOrModrm,
- Soft386OpcodeOrByteModrm,
- Soft386OpcodeOrModrm,
- Soft386OpcodeOrAl,
- Soft386OpcodeOrEax,
- Soft386OpcodePushCs,
- Soft386OpcodeExtended,
- Soft386OpcodeAdcByteModrm,
- Soft386OpcodeAdcModrm,
- Soft386OpcodeAdcByteModrm,
- Soft386OpcodeAdcModrm,
- Soft386OpcodeAdcAl,
- Soft386OpcodeAdcEax,
- Soft386OpcodePushSs,
- Soft386OpcodePopSs,
- Soft386OpcodeSbbByteModrm,
- Soft386OpcodeSbbModrm,
- Soft386OpcodeSbbByteModrm,
- Soft386OpcodeSbbModrm,
- Soft386OpcodeSbbAl,
- Soft386OpcodeSbbEax,
- Soft386OpcodePushDs,
- Soft386OpcodePopDs,
- Soft386OpcodeAndByteModrm,
- Soft386OpcodeAndModrm,
- Soft386OpcodeAndByteModrm,
- Soft386OpcodeAndModrm,
- Soft386OpcodeAndAl,
- Soft386OpcodeAndEax,
- Soft386OpcodePrefix,
- Soft386OpcodeDaa,
- Soft386OpcodeCmpSubByteModrm,
- Soft386OpcodeCmpSubModrm,
- Soft386OpcodeCmpSubByteModrm,
- Soft386OpcodeCmpSubModrm,
- Soft386OpcodeCmpSubAl,
- Soft386OpcodeCmpSubEax,
- Soft386OpcodePrefix,
- Soft386OpcodeDas,
- Soft386OpcodeXorByteModrm,
- Soft386OpcodeXorModrm,
- Soft386OpcodeXorByteModrm,
- Soft386OpcodeXorModrm,
- Soft386OpcodeXorAl,
- Soft386OpcodeXorEax,
- Soft386OpcodePrefix,
- Soft386OpcodeAaa,
- Soft386OpcodeCmpSubByteModrm,
- Soft386OpcodeCmpSubModrm,
- Soft386OpcodeCmpSubByteModrm,
- Soft386OpcodeCmpSubModrm,
- Soft386OpcodeCmpSubAl,
- Soft386OpcodeCmpSubEax,
- Soft386OpcodePrefix,
- Soft386OpcodeAas,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeIncrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodeDecrement,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePushReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePopReg,
- Soft386OpcodePushAll,
- Soft386OpcodePopAll,
- Soft386OpcodeBound,
- Soft386OpcodeArpl,
- Soft386OpcodePrefix,
- Soft386OpcodePrefix,
- Soft386OpcodePrefix,
- Soft386OpcodePrefix,
- Soft386OpcodePushImm,
- Soft386OpcodeImulModrmImm,
- Soft386OpcodePushByteImm,
- Soft386OpcodeImulModrmImm,
- Soft386OpcodeIns,
- Soft386OpcodeIns,
- Soft386OpcodeOuts,
- Soft386OpcodeOuts,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeShortConditionalJmp,
- Soft386OpcodeGroup8082,
- Soft386OpcodeGroup81,
- Soft386OpcodeGroup8082,
- Soft386OpcodeGroup83,
- Soft386OpcodeTestByteModrm,
- Soft386OpcodeTestModrm,
- Soft386OpcodeXchgByteModrm,
- Soft386OpcodeXchgModrm,
- Soft386OpcodeMovByteModrm,
- Soft386OpcodeMovModrm,
- Soft386OpcodeMovByteModrm,
- Soft386OpcodeMovModrm,
- Soft386OpcodeMovStoreSeg,
- Soft386OpcodeLea,
- Soft386OpcodeMovLoadSeg,
- Soft386OpcodeGroup8F,
- Soft386OpcodeNop,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeExchangeEax,
- Soft386OpcodeCwde,
- Soft386OpcodeCdq,
- Soft386OpcodeCallAbs,
- Soft386OpcodeWait,
- Soft386OpcodePushFlags,
- Soft386OpcodePopFlags,
- Soft386OpcodeSahf,
- Soft386OpcodeLahf,
- Soft386OpcodeMovAlOffset,
- Soft386OpcodeMovEaxOffset,
- Soft386OpcodeMovOffsetAl,
- Soft386OpcodeMovOffsetEax,
- Soft386OpcodeMovs,
- Soft386OpcodeMovs,
- Soft386OpcodeCmps,
- Soft386OpcodeCmps,
- Soft386OpcodeTestAl,
- Soft386OpcodeTestEax,
- Soft386OpcodeStos,
- Soft386OpcodeStos,
- Soft386OpcodeLods,
- Soft386OpcodeLods,
- Soft386OpcodeScas,
- Soft386OpcodeScas,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovByteRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeMovRegImm,
- Soft386OpcodeGroupC0,
- Soft386OpcodeGroupC1,
- Soft386OpcodeRet,
- Soft386OpcodeRet,
- Soft386OpcodeLdsLes,
- Soft386OpcodeLdsLes,
- Soft386OpcodeGroupC6,
- Soft386OpcodeGroupC7,
- Soft386OpcodeEnter,
- Soft386OpcodeLeave,
- Soft386OpcodeRetFar,
- Soft386OpcodeRetFar,
- Soft386OpcodeInt,
- Soft386OpcodeInt,
- Soft386OpcodeInt,
- Soft386OpcodeIret,
- Soft386OpcodeGroupD0,
- Soft386OpcodeGroupD1,
- Soft386OpcodeGroupD2,
- Soft386OpcodeGroupD3,
- Soft386OpcodeAam,
- Soft386OpcodeAad,
- Soft386OpcodeSalc,
- Soft386OpcodeXlat,
+ Fast486OpcodeAddByteModrm,
+ Fast486OpcodeAddModrm,
+ Fast486OpcodeAddByteModrm,
+ Fast486OpcodeAddModrm,
+ Fast486OpcodeAddAl,
+ Fast486OpcodeAddEax,
+ Fast486OpcodePushEs,
+ Fast486OpcodePopEs,
+ Fast486OpcodeOrByteModrm,
+ Fast486OpcodeOrModrm,
+ Fast486OpcodeOrByteModrm,
+ Fast486OpcodeOrModrm,
+ Fast486OpcodeOrAl,
+ Fast486OpcodeOrEax,
+ Fast486OpcodePushCs,
+ Fast486OpcodeExtended,
+ Fast486OpcodeAdcByteModrm,
+ Fast486OpcodeAdcModrm,
+ Fast486OpcodeAdcByteModrm,
+ Fast486OpcodeAdcModrm,
+ Fast486OpcodeAdcAl,
+ Fast486OpcodeAdcEax,
+ Fast486OpcodePushSs,
+ Fast486OpcodePopSs,
+ Fast486OpcodeSbbByteModrm,
+ Fast486OpcodeSbbModrm,
+ Fast486OpcodeSbbByteModrm,
+ Fast486OpcodeSbbModrm,
+ Fast486OpcodeSbbAl,
+ Fast486OpcodeSbbEax,
+ Fast486OpcodePushDs,
+ Fast486OpcodePopDs,
+ Fast486OpcodeAndByteModrm,
+ Fast486OpcodeAndModrm,
+ Fast486OpcodeAndByteModrm,
+ Fast486OpcodeAndModrm,
+ Fast486OpcodeAndAl,
+ Fast486OpcodeAndEax,
+ Fast486OpcodePrefix,
+ Fast486OpcodeDaa,
+ Fast486OpcodeCmpSubByteModrm,
+ Fast486OpcodeCmpSubModrm,
+ Fast486OpcodeCmpSubByteModrm,
+ Fast486OpcodeCmpSubModrm,
+ Fast486OpcodeCmpSubAl,
+ Fast486OpcodeCmpSubEax,
+ Fast486OpcodePrefix,
+ Fast486OpcodeDas,
+ Fast486OpcodeXorByteModrm,
+ Fast486OpcodeXorModrm,
+ Fast486OpcodeXorByteModrm,
+ Fast486OpcodeXorModrm,
+ Fast486OpcodeXorAl,
+ Fast486OpcodeXorEax,
+ Fast486OpcodePrefix,
+ Fast486OpcodeAaa,
+ Fast486OpcodeCmpSubByteModrm,
+ Fast486OpcodeCmpSubModrm,
+ Fast486OpcodeCmpSubByteModrm,
+ Fast486OpcodeCmpSubModrm,
+ Fast486OpcodeCmpSubAl,
+ Fast486OpcodeCmpSubEax,
+ Fast486OpcodePrefix,
+ Fast486OpcodeAas,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeIncrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodeDecrement,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePushReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePopReg,
+ Fast486OpcodePushAll,
+ Fast486OpcodePopAll,
+ Fast486OpcodeBound,
+ Fast486OpcodeArpl,
+ Fast486OpcodePrefix,
+ Fast486OpcodePrefix,
+ Fast486OpcodePrefix,
+ Fast486OpcodePrefix,
+ Fast486OpcodePushImm,
+ Fast486OpcodeImulModrmImm,
+ Fast486OpcodePushByteImm,
+ Fast486OpcodeImulModrmImm,
+ Fast486OpcodeIns,
+ Fast486OpcodeIns,
+ Fast486OpcodeOuts,
+ Fast486OpcodeOuts,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeShortConditionalJmp,
+ Fast486OpcodeGroup8082,
+ Fast486OpcodeGroup81,
+ Fast486OpcodeGroup8082,
+ Fast486OpcodeGroup83,
+ Fast486OpcodeTestByteModrm,
+ Fast486OpcodeTestModrm,
+ Fast486OpcodeXchgByteModrm,
+ Fast486OpcodeXchgModrm,
+ Fast486OpcodeMovByteModrm,
+ Fast486OpcodeMovModrm,
+ Fast486OpcodeMovByteModrm,
+ Fast486OpcodeMovModrm,
+ Fast486OpcodeMovStoreSeg,
+ Fast486OpcodeLea,
+ Fast486OpcodeMovLoadSeg,
+ Fast486OpcodeGroup8F,
+ Fast486OpcodeNop,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeExchangeEax,
+ Fast486OpcodeCwde,
+ Fast486OpcodeCdq,
+ Fast486OpcodeCallAbs,
+ Fast486OpcodeWait,
+ Fast486OpcodePushFlags,
+ Fast486OpcodePopFlags,
+ Fast486OpcodeSahf,
+ Fast486OpcodeLahf,
+ Fast486OpcodeMovAlOffset,
+ Fast486OpcodeMovEaxOffset,
+ Fast486OpcodeMovOffsetAl,
+ Fast486OpcodeMovOffsetEax,
+ Fast486OpcodeMovs,
+ Fast486OpcodeMovs,
+ Fast486OpcodeCmps,
+ Fast486OpcodeCmps,
+ Fast486OpcodeTestAl,
+ Fast486OpcodeTestEax,
+ Fast486OpcodeStos,
+ Fast486OpcodeStos,
+ Fast486OpcodeLods,
+ Fast486OpcodeLods,
+ Fast486OpcodeScas,
+ Fast486OpcodeScas,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovByteRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeMovRegImm,
+ Fast486OpcodeGroupC0,
+ Fast486OpcodeGroupC1,
+ Fast486OpcodeRet,
+ Fast486OpcodeRet,
+ Fast486OpcodeLdsLes,
+ Fast486OpcodeLdsLes,
+ Fast486OpcodeGroupC6,
+ Fast486OpcodeGroupC7,
+ Fast486OpcodeEnter,
+ Fast486OpcodeLeave,
+ Fast486OpcodeRetFar,
+ Fast486OpcodeRetFar,
+ Fast486OpcodeInt,
+ Fast486OpcodeInt,
+ Fast486OpcodeInt,
+ Fast486OpcodeIret,
+ Fast486OpcodeGroupD0,
+ Fast486OpcodeGroupD1,
+ Fast486OpcodeGroupD2,
+ Fast486OpcodeGroupD3,
+ Fast486OpcodeAam,
+ Fast486OpcodeAad,
+ Fast486OpcodeSalc,
+ Fast486OpcodeXlat,
NULL, // TODO: OPCODE 0xD8 NOT SUPPORTED
NULL, // TODO: OPCODE 0xD9 NOT SUPPORTED
NULL, // TODO: OPCODE 0xDA NOT SUPPORTED
NULL, // TODO: OPCODE 0xDD NOT SUPPORTED
NULL, // TODO: OPCODE 0xDE NOT SUPPORTED
NULL, // TODO: OPCODE 0xDF NOT SUPPORTED
- Soft386OpcodeLoop,
- Soft386OpcodeLoop,
- Soft386OpcodeLoop,
- Soft386OpcodeJecxz,
- Soft386OpcodeInByte,
- Soft386OpcodeIn,
- Soft386OpcodeOutByte,
- Soft386OpcodeOut,
- Soft386OpcodeCall,
- Soft386OpcodeJmp,
- Soft386OpcodeJmpAbs,
- Soft386OpcodeShortJump,
- Soft386OpcodeInByte,
- Soft386OpcodeIn,
- Soft386OpcodeOutByte,
- Soft386OpcodeOut,
- Soft386OpcodePrefix,
+ Fast486OpcodeLoop,
+ Fast486OpcodeLoop,
+ Fast486OpcodeLoop,
+ Fast486OpcodeJecxz,
+ Fast486OpcodeInByte,
+ Fast486OpcodeIn,
+ Fast486OpcodeOutByte,
+ Fast486OpcodeOut,
+ Fast486OpcodeCall,
+ Fast486OpcodeJmp,
+ Fast486OpcodeJmpAbs,
+ Fast486OpcodeShortJump,
+ Fast486OpcodeInByte,
+ Fast486OpcodeIn,
+ Fast486OpcodeOutByte,
+ Fast486OpcodeOut,
+ Fast486OpcodePrefix,
NULL, // Invalid
- Soft386OpcodePrefix,
- Soft386OpcodePrefix,
- Soft386OpcodeHalt,
- Soft386OpcodeComplCarry,
- Soft386OpcodeGroupF6,
- Soft386OpcodeGroupF7,
- Soft386OpcodeClearCarry,
- Soft386OpcodeSetCarry,
- Soft386OpcodeClearInt,
- Soft386OpcodeSetInt,
- Soft386OpcodeClearDir,
- Soft386OpcodeSetDir,
- Soft386OpcodeGroupFE,
- Soft386OpcodeGroupFF,
+ Fast486OpcodePrefix,
+ Fast486OpcodePrefix,
+ Fast486OpcodeHalt,
+ Fast486OpcodeComplCarry,
+ Fast486OpcodeGroupF6,
+ Fast486OpcodeGroupF7,
+ Fast486OpcodeClearCarry,
+ Fast486OpcodeSetCarry,
+ Fast486OpcodeClearInt,
+ Fast486OpcodeSetInt,
+ Fast486OpcodeClearDir,
+ Fast486OpcodeSetDir,
+ Fast486OpcodeGroupFE,
+ Fast486OpcodeGroupFF,
};
/* PUBLIC FUNCTIONS ***********************************************************/
-SOFT386_OPCODE_HANDLER(Soft386OpcodePrefix)
+FAST486_OPCODE_HANDLER(Fast486OpcodePrefix)
{
BOOLEAN Valid = FALSE;
/* ES: */
case 0x26:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_ES;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_ES;
Valid = TRUE;
}
/* CS: */
case 0x2E:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_CS;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_CS;
Valid = TRUE;
}
/* SS: */
case 0x36:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_SS;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_SS;
Valid = TRUE;
}
/* DS: */
case 0x3E:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_DS;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_DS;
Valid = TRUE;
}
/* FS: */
case 0x64:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_FS;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_FS;
Valid = TRUE;
}
/* GS: */
case 0x65:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_SEG))
+ if (!(State->PrefixFlags & FAST486_PREFIX_SEG))
{
- State->PrefixFlags |= SOFT386_PREFIX_SEG;
- State->SegmentOverride = SOFT386_REG_GS;
+ State->PrefixFlags |= FAST486_PREFIX_SEG;
+ State->SegmentOverride = FAST486_REG_GS;
Valid = TRUE;
}
/* OPSIZE */
case 0x66:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_OPSIZE))
+ if (!(State->PrefixFlags & FAST486_PREFIX_OPSIZE))
{
- State->PrefixFlags |= SOFT386_PREFIX_OPSIZE;
+ State->PrefixFlags |= FAST486_PREFIX_OPSIZE;
Valid = TRUE;
}
/* ADSIZE */
case 0x67:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_ADSIZE))
+ if (!(State->PrefixFlags & FAST486_PREFIX_ADSIZE))
{
- State->PrefixFlags |= SOFT386_PREFIX_ADSIZE;
+ State->PrefixFlags |= FAST486_PREFIX_ADSIZE;
Valid = TRUE;
}
break;
/* LOCK */
case 0xF0:
{
- if (!(State->PrefixFlags & SOFT386_PREFIX_LOCK))
+ if (!(State->PrefixFlags & FAST486_PREFIX_LOCK))
{
- State->PrefixFlags |= SOFT386_PREFIX_LOCK;
+ State->PrefixFlags |= FAST486_PREFIX_LOCK;
Valid = TRUE;
}
{
/* Mutually exclusive with REP */
if (!(State->PrefixFlags
- & (SOFT386_PREFIX_REPNZ | SOFT386_PREFIX_REP)))
+ & (FAST486_PREFIX_REPNZ | FAST486_PREFIX_REP)))
{
- State->PrefixFlags |= SOFT386_PREFIX_REPNZ;
+ State->PrefixFlags |= FAST486_PREFIX_REPNZ;
Valid = TRUE;
}
{
/* Mutually exclusive with REPNZ */
if (!(State->PrefixFlags
- & (SOFT386_PREFIX_REPNZ | SOFT386_PREFIX_REP)))
+ & (FAST486_PREFIX_REPNZ | FAST486_PREFIX_REP)))
{
- State->PrefixFlags |= SOFT386_PREFIX_REP;
+ State->PrefixFlags |= FAST486_PREFIX_REP;
Valid = TRUE;
}
State->PrefixFlags = 0;
/* Throw an exception */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeIncrement)
+FAST486_OPCODE_HANDLER(Fast486OpcodeIncrement)
{
ULONG Value;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
State->Flags.Zf = (Value == 0) ? TRUE : FALSE;
State->Flags.Af = ((Value & 0x0F) == 0) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(LOBYTE(Value));
+ State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value));
/* Return success */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeDecrement)
+FAST486_OPCODE_HANDLER(Fast486OpcodeDecrement)
{
ULONG Value;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
State->Flags.Zf = (Value == 0) ? TRUE : FALSE;
State->Flags.Af = ((Value & 0x0F) == 0x0F) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(LOBYTE(Value));
+ State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value));
/* Return success */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushReg)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushReg)
{
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
ASSERT((Opcode & 0xF8) == 0x50);
/* Call the internal function */
- return Soft386StackPush(State, State->GeneralRegs[Opcode & 0x07].Long);
+ return Fast486StackPush(State, State->GeneralRegs[Opcode & 0x07].Long);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopReg)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopReg)
{
ULONG Value;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_SS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_SS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
ASSERT((Opcode & 0xF8) == 0x58);
/* Call the internal function */
- if (!Soft386StackPop(State, &Value)) return FALSE;
+ if (!Fast486StackPop(State, &Value)) return FALSE;
/* Store the value */
if (Size) State->GeneralRegs[Opcode & 0x07].Long = Value;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeNop)
+FAST486_OPCODE_HANDLER(Fast486OpcodeNop)
{
- if (State->PrefixFlags & ~(SOFT386_PREFIX_OPSIZE | SOFT386_PREFIX_REP))
+ if (State->PrefixFlags & ~(FAST486_PREFIX_OPSIZE | FAST486_PREFIX_REP))
{
/* Allowed prefixes are REP and OPSIZE */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_REP)
+ if (State->PrefixFlags & FAST486_PREFIX_REP)
{
/* Idle cycle */
State->IdleCallback(State);
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeExchangeEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeExchangeEax)
{
INT Reg = Opcode & 0x07;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
ULONG Value;
Value = State->GeneralRegs[Reg].Long;
- State->GeneralRegs[Reg].Long = State->GeneralRegs[SOFT386_REG_EAX].Long;
- State->GeneralRegs[SOFT386_REG_EAX].Long = Value;
+ State->GeneralRegs[Reg].Long = State->GeneralRegs[FAST486_REG_EAX].Long;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Value;
}
else
{
USHORT Value;
Value = State->GeneralRegs[Reg].LowWord;
- State->GeneralRegs[Reg].LowWord = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Value;
+ State->GeneralRegs[Reg].LowWord = State->GeneralRegs[FAST486_REG_EAX].LowWord;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Value;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeShortConditionalJmp)
+FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp)
{
BOOLEAN Jump = FALSE;
CHAR Offset = 0;
ASSERT((Opcode & 0xF0) == 0x70);
/* Fetch the offset */
- if (!Soft386FetchByte(State, (PUCHAR)&Offset))
+ if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
return FALSE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeClearCarry)
+FAST486_OPCODE_HANDLER(Fast486OpcodeClearCarry)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xF8);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSetCarry)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSetCarry)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xF9);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeComplCarry)
+FAST486_OPCODE_HANDLER(Fast486OpcodeComplCarry)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xF5);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeClearInt)
+FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xFA);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Check for protected mode */
- if (State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE)
+ if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
{
/* Check IOPL */
- if (State->Flags.Iopl >= State->SegmentRegs[SOFT386_REG_CS].Dpl)
+ if (State->Flags.Iopl >= State->SegmentRegs[FAST486_REG_CS].Dpl)
{
/* Clear the interrupt flag */
State->Flags.If = FALSE;
else
{
/* General Protection Fault */
- Soft386Exception(State, SOFT386_EXCEPTION_GP);
+ Fast486Exception(State, FAST486_EXCEPTION_GP);
return FALSE;
}
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSetInt)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xFB);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Check for protected mode */
- if (State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE)
+ if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
{
/* Check IOPL */
- if (State->Flags.Iopl >= State->SegmentRegs[SOFT386_REG_CS].Dpl)
+ if (State->Flags.Iopl >= State->SegmentRegs[FAST486_REG_CS].Dpl)
{
/* Set the interrupt flag */
State->Flags.If = TRUE;
else
{
/* General Protection Fault */
- Soft386Exception(State, SOFT386_EXCEPTION_GP);
+ Fast486Exception(State, FAST486_EXCEPTION_GP);
return FALSE;
}
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeClearDir)
+FAST486_OPCODE_HANDLER(Fast486OpcodeClearDir)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xFC);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSetDir)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSetDir)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xFD);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeHalt)
+FAST486_OPCODE_HANDLER(Fast486OpcodeHalt)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xF4);
/* No prefixes allowed */
if (State->PrefixFlags)
{
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Privileged instructions can only be executed under CPL = 0 */
- if (State->SegmentRegs[SOFT386_REG_CS].Dpl != 0)
+ if (State->SegmentRegs[FAST486_REG_CS].Dpl != 0)
{
- Soft386Exception(State, SOFT386_EXCEPTION_GP);
+ Fast486Exception(State, FAST486_EXCEPTION_GP);
return FALSE;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeInByte)
+FAST486_OPCODE_HANDLER(Fast486OpcodeInByte)
{
UCHAR Data;
ULONG Port;
if (Opcode == 0xE4)
{
/* Fetch the parameter */
- if (!Soft386FetchByte(State, &Data))
+ if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
return FALSE;
else
{
/* The port number is in DX */
- Port = State->GeneralRegs[SOFT386_REG_EDX].LowWord;
+ Port = State->GeneralRegs[FAST486_REG_EDX].LowWord;
}
/* Read a byte from the I/O port */
State->IoReadCallback(State, Port, &Data, sizeof(UCHAR));
/* Store the result in AL */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Data;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Data;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeIn)
+FAST486_OPCODE_HANDLER(Fast486OpcodeIn)
{
ULONG Port;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF7) == 0xE5);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
UCHAR Data;
/* Fetch the parameter */
- if (!Soft386FetchByte(State, &Data))
+ if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
return FALSE;
else
{
/* The port number is in DX */
- Port = State->GeneralRegs[SOFT386_REG_EDX].LowWord;
+ Port = State->GeneralRegs[FAST486_REG_EDX].LowWord;
}
if (Size)
State->IoReadCallback(State, Port, &Data, sizeof(ULONG));
/* Store the value in EAX */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Data;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Data;
}
else
{
State->IoReadCallback(State, Port, &Data, sizeof(USHORT));
/* Store the value in AX */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Data;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Data;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOutByte)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte)
{
UCHAR Data;
ULONG Port;
if (Opcode == 0xE6)
{
/* Fetch the parameter */
- if (!Soft386FetchByte(State, &Data))
+ if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
return FALSE;
else
{
/* The port number is in DX */
- Port = State->GeneralRegs[SOFT386_REG_EDX].LowWord;
+ Port = State->GeneralRegs[FAST486_REG_EDX].LowWord;
}
/* Read the value from AL */
- Data = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ Data = State->GeneralRegs[FAST486_REG_EAX].LowByte;
/* Write the byte to the I/O port */
State->IoWriteCallback(State, Port, &Data, sizeof(UCHAR));
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOut)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOut)
{
ULONG Port;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF7) == 0xE7);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
UCHAR Data;
/* Fetch the parameter */
- if (!Soft386FetchByte(State, &Data))
+ if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
return FALSE;
else
{
/* The port number is in DX */
- Port = State->GeneralRegs[SOFT386_REG_EDX].LowWord;
+ Port = State->GeneralRegs[FAST486_REG_EDX].LowWord;
}
if (Size)
{
/* Get the value from EAX */
- ULONG Data = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG Data = State->GeneralRegs[FAST486_REG_EAX].Long;
/* Write a dword to the I/O port */
State->IoReadCallback(State, Port, &Data, sizeof(ULONG));
else
{
/* Get the value from AX */
- USHORT Data = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT Data = State->GeneralRegs[FAST486_REG_EAX].LowWord;
/* Write a word to the I/O port */
State->IoWriteCallback(State, Port, &Data, sizeof(USHORT));
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeShortJump)
+FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump)
{
CHAR Offset = 0;
ASSERT(Opcode == 0xEB);
/* Fetch the offset */
- if (!Soft386FetchByte(State, (PUCHAR)&Offset))
+ if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
return FALSE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovRegImm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovRegImm)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF8) == 0xB8);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
ULONG Value;
/* Fetch the dword */
- if (!Soft386FetchDword(State, &Value))
+ if (!Fast486FetchDword(State, &Value))
{
/* Exception occurred */
return FALSE;
USHORT Value;
/* Fetch the word */
- if (!Soft386FetchWord(State, &Value))
+ if (!Fast486FetchWord(State, &Value))
{
/* Exception occurred */
return FALSE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovByteRegImm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteRegImm)
{
UCHAR Value;
if (State->PrefixFlags != 0)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Fetch the byte */
- if (!Soft386FetchByte(State, &Value))
+ if (!Fast486FetchByte(State, &Value))
{
/* Exception occurred */
return FALSE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAddByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x00);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAddModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x01);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAddAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAddAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAddEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x05);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOrByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x08);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOrModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x09);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOrAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOrAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeOrEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x0D);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAndByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x20);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAndModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x21);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAndAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAndAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x24);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAndEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x25);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXorByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x30);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXorModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x31);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXorAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXorAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXorEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x35);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeTestByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x84);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* The result is discarded */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeTestModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x85);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
}
/* The result is discarded */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeTestAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeTestAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* The result is discarded */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeTestEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xA9);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Of = FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
}
/* The result is discarded */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXchgByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm)
{
UCHAR FirstValue, SecondValue;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x86);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Write the value from the register to the R/M */
- if (!Soft386WriteModrmByteOperands(State,
+ if (!Fast486WriteModrmByteOperands(State,
&ModRegRm,
FALSE,
FirstValue))
}
/* Write the value from the R/M to the register */
- if (!Soft386WriteModrmByteOperands(State,
+ if (!Fast486WriteModrmByteOperands(State,
&ModRegRm,
TRUE,
SecondValue))
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeXchgModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x87);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Write the value from the register to the R/M */
- if (!Soft386WriteModrmDwordOperands(State,
+ if (!Fast486WriteModrmDwordOperands(State,
&ModRegRm,
FALSE,
FirstValue))
}
/* Write the value from the R/M to the register */
- if (!Soft386WriteModrmDwordOperands(State,
+ if (!Fast486WriteModrmDwordOperands(State,
&ModRegRm,
TRUE,
SecondValue))
{
USHORT FirstValue, SecondValue;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Write the value from the register to the R/M */
- if (!Soft386WriteModrmWordOperands(State,
+ if (!Fast486WriteModrmWordOperands(State,
&ModRegRm,
FALSE,
FirstValue))
}
/* Write the value from the R/M to the register */
- if (!Soft386WriteModrmWordOperands(State,
+ if (!Fast486WriteModrmWordOperands(State,
&ModRegRm,
TRUE,
SecondValue))
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushEs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushEs)
{
/* Call the internal API */
- return Soft386StackPush(State, State->SegmentRegs[SOFT386_REG_ES].Selector);
+ return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopEs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopEs)
{
ULONG NewSelector;
- if (!Soft386StackPop(State, &NewSelector))
+ if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386LoadSegment(State, SOFT386_REG_ES, LOWORD(NewSelector));
+ return Fast486LoadSegment(State, FAST486_REG_ES, LOWORD(NewSelector));
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushCs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushCs)
{
/* Call the internal API */
- return Soft386StackPush(State, State->SegmentRegs[SOFT386_REG_CS].Selector);
+ return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAdcByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x10);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAdcModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x11);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAdcAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAdcAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAdcEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x15);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (((FirstValue & 0x0F) + (SecondValue & 0x0F)) & 0x10) ? TRUE : FALSE;
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushSs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushSs)
{
/* Call the internal API */
- return Soft386StackPush(State, State->SegmentRegs[SOFT386_REG_SS].Selector);
+ return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_SS].Selector);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopSs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopSs)
{
ULONG NewSelector;
- if (!Soft386StackPop(State, &NewSelector))
+ if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386LoadSegment(State, SOFT386_REG_SS, LOWORD(NewSelector));
+ return Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector));
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSbbByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
INT Carry = State->Flags.Cf ? 1 : 0;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x18);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + 1) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSbbModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
INT Carry = State->Flags.Cf ? 1 : 0;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x19);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + 1) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + 1) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSbbAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSbbAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
INT Carry = State->Flags.Cf ? 1 : 0;
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + 1) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSbbEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
INT Carry = State->Flags.Cf ? 1 : 0;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x1D);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + Carry) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < ((SecondValue + Carry) & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushDs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushDs)
{
/* Call the internal API */
- return Soft386StackPush(State, State->SegmentRegs[SOFT386_REG_DS].Selector);
+ return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopDs)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopDs)
{
ULONG NewSelector;
- if (!Soft386StackPop(State, &NewSelector))
+ if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386LoadSegment(State, SOFT386_REG_DS, LOWORD(NewSelector));
+ return Fast486LoadSegment(State, FAST486_REG_DS, LOWORD(NewSelector));
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeDaa)
+FAST486_OPCODE_HANDLER(Fast486OpcodeDaa)
{
- UCHAR Value = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
BOOLEAN Carry = State->Flags.Cf;
/* Clear the carry flag */
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte += 0x06;
- if (State->GeneralRegs[SOFT386_REG_EAX].LowByte < 0x06)
+ State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x06;
+ if (State->GeneralRegs[FAST486_REG_EAX].LowByte < 0x06)
{
/* A carry occurred */
State->Flags.Cf = TRUE;
if ((Value > 0x99) || Carry)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte += 0x60;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x60;
/* There was a carry */
State->Flags.Cf = TRUE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCmpSubByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xED) == 0x28);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCmpSubModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xED) == 0x29);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
}
/* Check if this is the instruction that writes to R/M */
- if (!(Opcode & SOFT386_OPCODE_WRITE_REG))
+ if (!(Opcode & FAST486_OPCODE_WRITE_REG))
{
/* Swap the order */
FirstValue ^= SecondValue;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCmpSubAl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubAl)
{
- UCHAR FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowByte;
UCHAR SecondValue, Result;
/* Make sure this is the right instruction */
if (State->PrefixFlags)
{
/* This opcode doesn't take any prefixes */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386FetchByte(State, &SecondValue))
+ if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_BYTE) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCmpSubEax)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xEF) == 0x2D);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Size)
{
- ULONG FirstValue = State->GeneralRegs[SOFT386_REG_EAX].Long;
+ ULONG FirstValue = State->GeneralRegs[FAST486_REG_EAX].Long;
ULONG SecondValue, Result;
- if (!Soft386FetchDword(State, &SecondValue))
+ if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_LONG) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].Long = Result;
+ State->GeneralRegs[FAST486_REG_EAX].Long = Result;
}
}
else
{
- USHORT FirstValue = State->GeneralRegs[SOFT386_REG_EAX].LowWord;
+ USHORT FirstValue = State->GeneralRegs[FAST486_REG_EAX].LowWord;
USHORT SecondValue, Result;
- if (!Soft386FetchWord(State, &SecondValue))
+ if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
return FALSE;
State->Flags.Af = (FirstValue & 0x0F) < (SecondValue & 0x0F);
State->Flags.Zf = (Result == 0) ? TRUE : FALSE;
State->Flags.Sf = (Result & SIGN_FLAG_WORD) ? TRUE : FALSE;
- State->Flags.Pf = Soft386CalculateParity(Result);
+ State->Flags.Pf = Fast486CalculateParity(Result);
/* Check if this is not a CMP */
if (!(Opcode & 0x10))
{
/* Write back the result */
- State->GeneralRegs[SOFT386_REG_EAX].LowWord = Result;
+ State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeDas)
+FAST486_OPCODE_HANDLER(Fast486OpcodeDas)
{
- UCHAR Value = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
BOOLEAN Carry = State->Flags.Cf;
/* Clear the carry flag */
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte -= 0x06;
- if (State->GeneralRegs[SOFT386_REG_EAX].LowByte > 0xFB)
+ State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x06;
+ if (State->GeneralRegs[FAST486_REG_EAX].LowByte > 0xFB)
{
/* A borrow occurred */
State->Flags.Cf = TRUE;
if ((Value > 0x99) || Carry)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte -= 0x60;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x60;
/* There was a borrow */
State->Flags.Cf = TRUE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAaa)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAaa)
{
- UCHAR Value = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
/*
* Check if the value in AL is not a valid BCD digit,
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte += 0x06;
- State->GeneralRegs[SOFT386_REG_EAX].HighByte++;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte += 0x06;
+ State->GeneralRegs[FAST486_REG_EAX].HighByte++;
/* Set CF and AF */
State->Flags.Cf = State->Flags.Af = TRUE;
}
/* Keep only the lowest 4 bits of AL */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte &= 0x0F;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeAas)
+FAST486_OPCODE_HANDLER(Fast486OpcodeAas)
{
- UCHAR Value = State->GeneralRegs[SOFT386_REG_EAX].LowByte;
+ UCHAR Value = State->GeneralRegs[FAST486_REG_EAX].LowByte;
/*
* Check if the value in AL is not a valid BCD digit,
if (((Value & 0x0F) > 9) || State->Flags.Af)
{
/* Correct it */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte -= 0x06;
- State->GeneralRegs[SOFT386_REG_EAX].HighByte--;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte -= 0x06;
+ State->GeneralRegs[FAST486_REG_EAX].HighByte--;
/* Set CF and AF */
State->Flags.Cf = State->Flags.Af = TRUE;
}
/* Keep only the lowest 4 bits of AL */
- State->GeneralRegs[SOFT386_REG_EAX].LowByte &= 0x0F;
+ State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushAll)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushAll)
{
INT i;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
- SOFT386_REG SavedEsp = State->GeneralRegs[SOFT386_REG_ESP];
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
+ FAST486_REG SavedEsp = State->GeneralRegs[FAST486_REG_ESP];
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x60);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Push all the registers in order */
- for (i = 0; i < SOFT386_NUM_GEN_REGS; i++)
+ for (i = 0; i < FAST486_NUM_GEN_REGS; i++)
{
- if (i == SOFT386_REG_ESP)
+ if (i == FAST486_REG_ESP)
{
/* Use the saved ESP instead */
- if (!Soft386StackPush(State, Size ? SavedEsp.Long : SavedEsp.LowWord))
+ if (!Fast486StackPush(State, Size ? SavedEsp.Long : SavedEsp.LowWord))
{
/* Exception occurred */
return FALSE;
else
{
/* Push the register */
- if (!Soft386StackPush(State, Size ? State->GeneralRegs[i].Long
+ if (!Fast486StackPush(State, Size ? State->GeneralRegs[i].Long
: State->GeneralRegs[i].LowWord))
{
/* Exception occurred */
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopAll)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopAll)
{
INT i;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
ULONG Value;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x61);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Pop all the registers in reverse order */
- for (i = SOFT386_NUM_GEN_REGS - 1; i >= 0; i--)
+ for (i = FAST486_NUM_GEN_REGS - 1; i >= 0; i--)
{
/* Pop the value */
- if (!Soft386StackPop(State, &Value))
+ if (!Fast486StackPop(State, &Value))
{
/* Exception occurred */
return FALSE;
}
/* Don't modify ESP */
- if (i != SOFT386_REG_ESP)
+ if (i != FAST486_REG_ESP)
{
if (Size) State->GeneralRegs[i].Long = Value;
else State->GeneralRegs[i].LowWord = LOWORD(Value);
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeBound)
+FAST486_OPCODE_HANDLER(Fast486OpcodeBound)
{
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
return FALSE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeArpl)
+FAST486_OPCODE_HANDLER(Fast486OpcodeArpl)
{
USHORT FirstValue, SecondValue;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (!(State->ControlRegisters[SOFT386_REG_CR0] & SOFT386_CR0_PE)
+ if (!(State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
|| State->Flags.Vm
- || (State->PrefixFlags & SOFT386_PREFIX_LOCK))
+ || (State->PrefixFlags & FAST486_PREFIX_LOCK))
{
/* Cannot be used in real mode or with a LOCK prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
/* Read the operands */
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
State->Flags.Zf = TRUE;
/* Write back the result */
- return Soft386WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue);
+ return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue);
}
else
{
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushImm)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushImm)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x68);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
{
ULONG Data;
- if (!Soft386FetchDword(State, &Data))
+ if (!Fast486FetchDword(State, &Data))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386StackPush(State, Data);
+ return Fast486StackPush(State, Data);
}
else
{
USHORT Data;
- if (!Soft386FetchWord(State, &Data))
+ if (!Fast486FetchWord(State, &Data))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386StackPush(State, Data);
+ return Fast486StackPush(State, Data);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeImulModrmImm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeImulModrmImm)
{
BOOLEAN OperandSize, AddressSize;
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
LONG Multiplier;
LONGLONG Product;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x69);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
/* Fetch the parameters */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
CHAR Byte;
/* Fetch the immediate operand */
- if (!Soft386FetchByte(State, (PUCHAR)&Byte))
+ if (!Fast486FetchByte(State, (PUCHAR)&Byte))
{
/* Exception occurred */
return FALSE;
LONG Dword;
/* Fetch the immediate operand */
- if (!Soft386FetchDword(State, (PULONG)&Dword))
+ if (!Fast486FetchDword(State, (PULONG)&Dword))
{
/* Exception occurred */
return FALSE;
SHORT Word;
/* Fetch the immediate operand */
- if (!Soft386FetchWord(State, (PUSHORT)&Word))
+ if (!Fast486FetchWord(State, (PUSHORT)&Word))
{
/* Exception occurred */
return FALSE;
LONG RegValue, Multiplicand;
/* Read the operands */
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
(PULONG)&RegValue,
(PULONG)&Multiplicand))
SHORT RegValue, Multiplicand;
/* Read the operands */
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
(PUSHORT)&RegValue,
(PUSHORT)&Multiplicand))
else State->Flags.Cf = State->Flags.Of = FALSE;
/* Write-back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
TRUE,
(ULONG)((LONG)Product));
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushByteImm)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushByteImm)
{
UCHAR Data;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x6A);
- if (!Soft386FetchByte(State, &Data))
+ if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
return FALSE;
}
/* Call the internal API */
- return Soft386StackPush(State, Data);
+ return Fast486StackPush(State, Data);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovByteModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteModrm)
{
UCHAR FirstValue, SecondValue, Result;
- SOFT386_MOD_REG_RM ModRegRm;
- BOOLEAN AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ FAST486_MOD_REG_RM ModRegRm;
+ BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x88);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
else if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386ReadModrmByteOperands(State,
+ if (!Fast486ReadModrmByteOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
return FALSE;
}
- if (Opcode & SOFT386_OPCODE_WRITE_REG) Result = SecondValue;
+ if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Soft386WriteModrmByteOperands(State,
+ return Fast486WriteModrmByteOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovModrm)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovModrm)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFD) == 0x89);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
if (State->PrefixFlags
- & ~(SOFT386_PREFIX_ADSIZE
- | SOFT386_PREFIX_OPSIZE
- | SOFT386_PREFIX_SEG
- | SOFT386_PREFIX_LOCK))
+ & ~(FAST486_PREFIX_ADSIZE
+ | FAST486_PREFIX_OPSIZE
+ | FAST486_PREFIX_SEG
+ | FAST486_PREFIX_LOCK))
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
ULONG FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmDwordOperands(State,
+ if (!Fast486ReadModrmDwordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
return FALSE;
}
- if (Opcode & SOFT386_OPCODE_WRITE_REG) Result = SecondValue;
+ if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
else
{
USHORT FirstValue, SecondValue, Result;
- if (!Soft386ReadModrmWordOperands(State,
+ if (!Fast486ReadModrmWordOperands(State,
&ModRegRm,
&FirstValue,
&SecondValue))
return FALSE;
}
- if (Opcode & SOFT386_OPCODE_WRITE_REG) Result = SecondValue;
+ if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
- Opcode & SOFT386_OPCODE_WRITE_REG,
+ Opcode & FAST486_OPCODE_WRITE_REG,
Result);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovStoreSeg)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovStoreSeg)
{
BOOLEAN OperandSize, AddressSize;
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x8C);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if (ModRegRm.Register >= SOFT386_NUM_SEG_REGS)
+ if (ModRegRm.Register >= FAST486_NUM_SEG_REGS)
{
/* Invalid */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
if (OperandSize)
{
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
FALSE,
State->SegmentRegs[ModRegRm.Register].Selector);
}
else
{
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
FALSE,
State->SegmentRegs[ModRegRm.Register].Selector);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeLea)
+FAST486_OPCODE_HANDLER(Fast486OpcodeLea)
{
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
BOOLEAN OperandSize, AddressSize;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x8D);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
if (!ModRegRm.Memory)
{
/* Invalid */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Write the address to the register */
if (OperandSize)
{
- return Soft386WriteModrmDwordOperands(State,
+ return Fast486WriteModrmDwordOperands(State,
&ModRegRm,
TRUE,
ModRegRm.MemoryAddress);
}
else
{
- return Soft386WriteModrmWordOperands(State,
+ return Fast486WriteModrmWordOperands(State,
&ModRegRm,
TRUE,
ModRegRm.MemoryAddress);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeMovLoadSeg)
+FAST486_OPCODE_HANDLER(Fast486OpcodeMovLoadSeg)
{
BOOLEAN OperandSize, AddressSize;
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x8E);
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the address size */
AddressSize = !AddressSize;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the operand size */
OperandSize = !OperandSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
}
- if ((ModRegRm.Register >= SOFT386_NUM_SEG_REGS)
- || ((SOFT386_SEG_REGS)ModRegRm.Register == SOFT386_REG_CS))
+ if ((ModRegRm.Register >= FAST486_NUM_SEG_REGS)
+ || ((FAST486_SEG_REGS)ModRegRm.Register == FAST486_REG_CS))
{
/* Invalid */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
{
ULONG Dummy, Selector;
- if (!Soft386ReadModrmDwordOperands(State, &ModRegRm, &Dummy, &Selector))
+ if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, &Dummy, &Selector))
{
/* Exception occurred */
return FALSE;
}
- return Soft386LoadSegment(State, ModRegRm.Register, LOWORD(Selector));
+ return Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector));
}
else
{
USHORT Dummy, Selector;
- if (!Soft386ReadModrmWordOperands(State, &ModRegRm, &Dummy, &Selector))
+ if (!Fast486ReadModrmWordOperands(State, &ModRegRm, &Dummy, &Selector))
{
/* Exception occurred */
return FALSE;
}
- return Soft386LoadSegment(State, ModRegRm.Register, Selector);
+ return Fast486LoadSegment(State, ModRegRm.Register, Selector);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCwde)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCwde)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x98);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
if (Size)
{
/* Sign extend AX to EAX */
- State->GeneralRegs[SOFT386_REG_EAX].Long = MAKELONG
+ State->GeneralRegs[FAST486_REG_EAX].Long = MAKELONG
(
- State->GeneralRegs[SOFT386_REG_EAX].LowWord,
- (State->GeneralRegs[SOFT386_REG_EAX].LowWord & SIGN_FLAG_WORD)
+ State->GeneralRegs[FAST486_REG_EAX].LowWord,
+ (State->GeneralRegs[FAST486_REG_EAX].LowWord & SIGN_FLAG_WORD)
? 0xFFFF : 0x0000
);
}
else
{
/* Sign extend AL to AX */
- State->GeneralRegs[SOFT386_REG_EAX].HighByte =
- (State->GeneralRegs[SOFT386_REG_EAX].LowByte & SIGN_FLAG_BYTE)
+ State->GeneralRegs[FAST486_REG_EAX].HighByte =
+ (State->GeneralRegs[FAST486_REG_EAX].LowByte & SIGN_FLAG_BYTE)
? 0xFF : 0x00;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCdq)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCdq)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x99);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
if (Size)
{
/* Sign extend EAX to EDX:EAX */
- State->GeneralRegs[SOFT386_REG_EDX].Long =
- (State->GeneralRegs[SOFT386_REG_EAX].Long & SIGN_FLAG_LONG)
+ State->GeneralRegs[FAST486_REG_EDX].Long =
+ (State->GeneralRegs[FAST486_REG_EAX].Long & SIGN_FLAG_LONG)
? 0xFFFFFFFF : 0x00000000;
}
else
{
/* Sign extend AX to DX:AX */
- State->GeneralRegs[SOFT386_REG_EDX].LowWord =
- (State->GeneralRegs[SOFT386_REG_EAX].LowWord & SIGN_FLAG_WORD)
+ State->GeneralRegs[FAST486_REG_EDX].LowWord =
+ (State->GeneralRegs[FAST486_REG_EAX].LowWord & SIGN_FLAG_WORD)
? 0xFFFF : 0x0000;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeCallAbs)
+FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs)
{
USHORT Segment = 0;
ULONG Offset = 0;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x9A);
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
/* Fetch the offset */
if (Size)
{
- if (!Soft386FetchDword(State, &Offset))
+ if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
return FALSE;
}
else
{
- if (!Soft386FetchWord(State, (PUSHORT)&Offset))
+ if (!Fast486FetchWord(State, (PUSHORT)&Offset))
{
/* Exception occurred */
return FALSE;
}
/* Fetch the segment */
- if (!Soft386FetchWord(State, &Segment))
+ if (!Fast486FetchWord(State, &Segment))
{
/* Exception occurred */
return FALSE;
}
/* Push the current code segment selector */
- if (!Soft386StackPush(State, State->SegmentRegs[SOFT386_REG_CS].Selector))
+ if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector))
{
/* Exception occurred */
return FALSE;
}
/* Push the current value of the instruction pointer */
- if (!Soft386StackPush(State, State->InstPtr.Long))
+ if (!Fast486StackPush(State, State->InstPtr.Long))
{
/* Exception occurred */
return FALSE;
}
/* Load the new CS */
- if (!Soft386LoadSegment(State, SOFT386_REG_CS, Segment))
+ if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment))
{
/* Exception occurred */
return FALSE;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeWait)
+FAST486_OPCODE_HANDLER(Fast486OpcodeWait)
{
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
return FALSE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePushFlags)
+FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* This OPSIZE prefix toggles the size */
Size = !Size;
if (State->Flags.Vm && (State->Flags.Iopl != 3))
{
/* Call the VM86 monitor */
- Soft386ExceptionWithErrorCode(State, SOFT386_EXCEPTION_GP, 0);
+ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
return FALSE;
}
/* Push the flags */
- if (Size) return Soft386StackPush(State, State->Flags.Long);
- else return Soft386StackPush(State, LOWORD(State->Flags.Long));
+ if (Size) return Fast486StackPush(State, State->Flags.Long);
+ else return Fast486StackPush(State, LOWORD(State->Flags.Long));
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodePopFlags)
+FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
- INT Cpl = Soft386GetCurrentPrivLevel(State);
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
+ INT Cpl = Fast486GetCurrentPrivLevel(State);
ULONG NewFlags;
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* This OPSIZE prefix toggles the size */
Size = !Size;
}
/* Pop the new flags */
- if (!Soft386StackPop(State, &NewFlags))
+ if (!Fast486StackPop(State, &NewFlags))
{
/* Exception occurred */
return FALSE;
else
{
/* Call the VM86 monitor */
- Soft386ExceptionWithErrorCode(State, SOFT386_EXCEPTION_GP, 0);
+ Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
}
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeSahf)
+FAST486_OPCODE_HANDLER(Fast486OpcodeSahf)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x9E);
/* Set the low-order byte of FLAGS to AH */
State->Flags.Long &= 0xFFFFFF00;
- State->Flags.Long |= State->GeneralRegs[SOFT386_REG_EAX].HighByte;
+ State->Flags.Long |= State->GeneralRegs[FAST486_REG_EAX].HighByte;
/* Restore the reserved bits of FLAGS */
State->Flags.AlwaysSet = TRUE;
return FALSE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeLahf)
+FAST486_OPCODE_HANDLER(Fast486OpcodeLahf)
{
/* Make sure this is the right instruction */
ASSERT(Opcode == 0x9F);
/* Set AH to the low-order byte of FLAGS */
- State->GeneralRegs[SOFT386_REG_EAX].HighByte = LOBYTE(State->Flags.Long);
+ State->GeneralRegs[FAST486_REG_EAX].HighByte = LOBYTE(State->Flags.Long);
return FALSE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeRet)
+FAST486_OPCODE_HANDLER(Fast486OpcodeRet)
{
ULONG ReturnAddress;
USHORT BytesToPop = 0;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xC2);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
if (Opcode == 0xC2)
{
/* Fetch the number of bytes to pop after the return */
- if (!Soft386FetchWord(State, &BytesToPop)) return FALSE;
+ if (!Fast486FetchWord(State, &BytesToPop)) return FALSE;
}
/* Pop the return address */
- if (!Soft386StackPop(State, &ReturnAddress)) return FALSE;
+ if (!Fast486StackPop(State, &ReturnAddress)) return FALSE;
/* Return to the calling procedure, and if necessary, pop the parameters */
if (Size)
{
State->InstPtr.Long = ReturnAddress;
- State->GeneralRegs[SOFT386_REG_ESP].Long += BytesToPop;
+ State->GeneralRegs[FAST486_REG_ESP].Long += BytesToPop;
}
else
{
State->InstPtr.LowWord = LOWORD(ReturnAddress);
- State->GeneralRegs[SOFT386_REG_ESP].LowWord += BytesToPop;
+ State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop;
}
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeLdsLes)
+FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes)
{
UCHAR FarPointer[6];
BOOLEAN OperandSize, AddressSize;
- SOFT386_MOD_REG_RM ModRegRm;
+ FAST486_MOD_REG_RM ModRegRm;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xFE) == 0xC4);
- OperandSize = AddressSize = State->SegmentRegs[SOFT386_REG_CS].Size;
+ OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
- if (State->PrefixFlags & SOFT386_PREFIX_ADSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)
{
/* The ADSIZE prefix toggles the size */
AddressSize = !AddressSize;
}
/* Get the operands */
- if (!Soft386ParseModRegRm(State, AddressSize, &ModRegRm))
+ if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
return FALSE;
{
/* Check if this is a BOP and the host supports BOPs */
if ((Opcode == 0xC4)
- && (ModRegRm.Register == SOFT386_REG_EAX)
- && (ModRegRm.SecondRegister == SOFT386_REG_ESP)
+ && (ModRegRm.Register == FAST486_REG_EAX)
+ && (ModRegRm.SecondRegister == FAST486_REG_ESP)
&& (State->BopCallback != NULL))
{
USHORT BopCode;
/* Fetch the BOP code */
- if (!Soft386FetchWord(State, &BopCode))
+ if (!Fast486FetchWord(State, &BopCode))
{
/* Exception occurred */
return FALSE;
}
/* Invalid */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (!Soft386ReadMemory(State,
- (State->PrefixFlags & SOFT386_PREFIX_SEG)
- ? State->SegmentOverride : SOFT386_REG_DS,
+ if (!Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG)
+ ? State->SegmentOverride : FAST486_REG_DS,
ModRegRm.MemoryAddress,
FALSE,
FarPointer,
State->GeneralRegs[ModRegRm.Register].Long = Offset;
/* Load the segment */
- return Soft386LoadSegment(State,
+ return Fast486LoadSegment(State,
(Opcode == 0xC4)
- ? SOFT386_REG_ES : SOFT386_REG_DS,
+ ? FAST486_REG_ES : FAST486_REG_DS,
Segment);
}
else
State->GeneralRegs[ModRegRm.Register].LowWord = Offset;
/* Load the segment */
- return Soft386LoadSegment(State,
+ return Fast486LoadSegment(State,
(Opcode == 0xC4)
- ? SOFT386_REG_ES : SOFT386_REG_DS,
+ ? FAST486_REG_ES : FAST486_REG_DS,
Segment);
}
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeEnter)
+FAST486_OPCODE_HANDLER(Fast486OpcodeEnter)
{
INT i;
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
USHORT FrameSize;
UCHAR NestingLevel;
- SOFT386_REG FramePointer;
+ FAST486_REG FramePointer;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xC8);
- if (State->PrefixFlags & SOFT386_PREFIX_LOCK)
+ if (State->PrefixFlags & FAST486_PREFIX_LOCK)
{
/* Invalid prefix */
- Soft386Exception(State, SOFT386_EXCEPTION_UD);
+ Fast486Exception(State, FAST486_EXCEPTION_UD);
return FALSE;
}
- if (State->PrefixFlags & SOFT386_PREFIX_OPSIZE)
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
- if (!Soft386FetchWord(State, &FrameSize))
+ if (!Fast486FetchWord(State, &FrameSize))
{
/* Exception occurred */
return FALSE;
}
- if (!Soft386FetchByte(State, &NestingLevel))
+ if (!Fast486FetchByte(State, &NestingLevel))
{
/* Exception occurred */
return FALSE;
}
/* Push EBP */
- if (!Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].Long))
+ if (!Fast486StackPush(State, State->GeneralRegs[FAST486_REG_EBP].Long))
{
/* Exception occurred */
return FALSE;
}
/* Save ESP */
- FramePointer = State->GeneralRegs[SOFT386_REG_ESP];
+ FramePointer = State->GeneralRegs[FAST486_REG_ESP];
/* Set up the nested procedure stacks */
for (i = 1; i < NestingLevel; i++)
{
if (Size)
{
- State->GeneralRegs[SOFT386_REG_EBP].Long -= 4;
- Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].Long);
+ State->GeneralRegs[FAST486_REG_EBP].Long -= 4;
+ Fast486StackPush(State, State->GeneralRegs[FAST486_REG_EBP].Long);
}
else
{
- State->GeneralRegs[SOFT386_REG_EBP].LowWord -= 2;
- Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].LowWord);
+ State->GeneralRegs[FAST486_REG_EBP].LowWord -= 2;
+ Fast486StackPush(State, State->GeneralRegs[FAST486_REG_EBP].LowWord);
}
}
- if (NestingLevel > 0) Soft386StackPush(State, FramePointer.Long);
+ if (NestingLevel > 0) Fast486StackPush(State, FramePointer.Long);
/* Set EBP to the frame pointer */
- State->GeneralRegs[SOFT386_REG_EBP] = FramePointer;
+ State->GeneralRegs[FAST486_REG_EBP] = FramePointer;
/* Reserve space for the frame */
- if (Size) State->GeneralRegs[SOFT386_REG_ESP].Long -= (ULONG)FrameSize;
- else State->GeneralRegs[SOFT386_REG_ESP].LowWord -= FrameSize;
+ if (Size) State->GeneralRegs[FAST486_REG_ESP].Long -= (ULONG)FrameSize;
+ else State->GeneralRegs[FAST486_REG_ESP].LowWord -= FrameSize;
return TRUE;
}
-SOFT386_OPCODE_HANDLER(Soft386OpcodeLeave)
+FAST486_OPCODE_HANDLER(Fast486OpcodeLeave)
{
- BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
+ BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instru