Fast486OpcodeOutByte, /* 0xEE */
Fast486OpcodeOut, /* 0xEF */
Fast486OpcodePrefix, /* 0xF0 */
- Fast486OpcodeInvalid, /* 0xF1 */ // Invalid opcode
+ Fast486OpcodeInvalid, /* 0xF1 */ // Invalid opcode -- ICEBP/INT01 opcode
Fast486OpcodePrefix, /* 0xF2 */
Fast486OpcodePrefix, /* 0xF3 */
Fast486OpcodeHalt, /* 0xF4 */
FAST486_OPCODE_HANDLER(Fast486OpcodeInvalid)
{
- /* This is not a valid opcode */
+ /*
+ * This is not a valid opcode.
+ * Well, not totally: see http://www.rcollins.org/secrets/opcodes/ICEBP.html
+ * for more details.
+ */
+ DPRINT1("FAST486 -- Calling ICEBP opcode\n");
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePrefix)
/* Throw an exception */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeIncrement)
State->Flags.Zf = (Value == 0);
State->Flags.Af = ((Value & 0x0F) == 0);
State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value));
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeDecrement)
State->Flags.Zf = (Value == 0);
State->Flags.Af = ((Value & 0x0F) == 0x0F);
State->Flags.Pf = Fast486CalculateParity(LOBYTE(Value));
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushReg)
ASSERT((Opcode & 0xF8) == 0x50);
/* Call the internal function */
- return Fast486StackPush(State, State->GeneralRegs[Opcode & 0x07].Long);
+ Fast486StackPush(State, State->GeneralRegs[Opcode & 0x07].Long);
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopReg)
ASSERT((Opcode & 0xF8) == 0x58);
/* Call the internal function */
- if (!Fast486StackPop(State, &Value)) return FALSE;
+ if (!Fast486StackPop(State, &Value)) return;
/* Store the value */
if (Size) State->GeneralRegs[Opcode & 0x07].Long = Value;
else State->GeneralRegs[Opcode & 0x07].LowWord = Value;
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeNop)
{
- if (State->PrefixFlags & FAST486_PREFIX_REP)
- {
- /* Idle cycle */
- State->IdleCallback(State);
- }
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeExchangeEax)
State->GeneralRegs[Reg].LowWord = State->GeneralRegs[FAST486_REG_EAX].LowWord;
State->GeneralRegs[FAST486_REG_EAX].LowWord = Value;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp)
if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
switch ((Opcode & 0x0F) >> 1)
State->InstPtr.Long &= 0xFFFF;
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeClearCarry)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Clear CF and return success */
State->Flags.Cf = FALSE;
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSetCarry)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Set CF and return success*/
State->Flags.Cf = TRUE;
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeComplCarry)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Toggle CF and return success */
State->Flags.Cf = !State->Flags.Cf;
- return TRUE;
+ return;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Check for protected mode */
{
/* General Protection Fault */
Fast486Exception(State, FAST486_EXCEPTION_GP);
- return FALSE;
+ return;
}
}
else
/* Just clear the interrupt flag */
State->Flags.If = FALSE;
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Check for protected mode */
{
/* General Protection Fault */
Fast486Exception(State, FAST486_EXCEPTION_GP);
- return FALSE;
+ return;
}
}
else
/* Just set the interrupt flag */
State->Flags.If = TRUE;
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeClearDir)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
- /* Clear DF and return success */
+ /* Clear DF */
State->Flags.Df = FALSE;
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSetDir)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
- /* Set DF and return success*/
+ /* Set DF */
State->Flags.Df = TRUE;
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeHalt)
if (State->PrefixFlags)
{
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Privileged instructions can only be executed under CPL = 0 */
if (State->SegmentRegs[FAST486_REG_CS].Dpl != 0)
{
Fast486Exception(State, FAST486_EXCEPTION_GP);
- return FALSE;
+ return;
}
/* Halt */
- // TODO: Halt the CPU until an interrupt occurs, using IdleCallback if needed.
-
- /* Return success */
- return TRUE;
+ State->Halted = TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeInByte)
if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the port number to the parameter */
/* Store the result in AL */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Data;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeIn)
if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the port number to the parameter */
/* Store the value in AX */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Data;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte)
if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the port number to the parameter */
/* Write the byte to the I/O port */
State->IoWriteCallback(State, Port, &Data, 1, sizeof(UCHAR));
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOut)
if (!Fast486FetchByte(State, &Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the port number to the parameter */
/* Write a word to the I/O port */
State->IoWriteCallback(State, Port, &Data, 1, sizeof(USHORT));
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump)
if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
/* Move the instruction pointer */
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovRegImm)
if (!Fast486FetchDword(State, &Value))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Store the value in the register */
if (!Fast486FetchWord(State, &Value))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Store the value in the register */
State->GeneralRegs[Opcode & 0x07].LowWord = Value;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteRegImm)
{
/* Invalid prefix */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Fetch the byte */
if (!Fast486FetchByte(State, &Value))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (Opcode & 0x04)
/* AL, CL, DL or BL */
State->GeneralRegs[Opcode & 0x03].LowByte = Value;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAddByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAddModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAddEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOrByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOrModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOrEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAndByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAndModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAndEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXorByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXorModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXorEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeTestByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
Result = FirstValue & SecondValue;
State->Flags.Zf = (Result == 0);
State->Flags.Sf = ((Result & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Result);
-
- /* The result is discarded */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeTestModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0);
State->Flags.Pf = Fast486CalculateParity(Result);
}
-
- /* The result is discarded */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeTestAl)
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Zf = (Result == 0);
State->Flags.Sf = ((Result & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Result);
-
- /* The result is discarded */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeTestEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Sf = ((Result & SIGN_FLAG_WORD) != 0);
State->Flags.Pf = Fast486CalculateParity(Result);
}
-
- /* The result is discarded */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXchgByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the register to the R/M */
FirstValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the R/M to the register */
- if (!Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- TRUE,
- SecondValue))
- {
- /* Exception occurred */
- return FALSE;
- }
-
- return TRUE;
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ TRUE,
+ SecondValue);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXchgModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the register to the R/M */
FirstValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the R/M to the register */
- if (!Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- TRUE,
- SecondValue))
- {
- /* Exception occurred */
- return FALSE;
- }
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ TRUE,
+ SecondValue);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the register to the R/M */
FirstValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write the value from the R/M to the register */
- if (!Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- TRUE,
- SecondValue))
- {
- /* Exception occurred */
- return FALSE;
- }
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ TRUE,
+ SecondValue);
}
-
- /* The result is discarded */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushEs)
{
/* Call the internal API */
- return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector);
+ Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector);
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopEs)
if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486LoadSegment(State, FAST486_REG_ES, LOWORD(NewSelector));
+ Fast486LoadSegment(State, FAST486_REG_ES, LOWORD(NewSelector));
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushCs)
{
/* Call the internal API */
- return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector);
+ Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAdcByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAdcModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAdcEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushSs)
{
/* Call the internal API */
- return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_SS].Selector);
+ Fast486StackPush(State, State->SegmentRegs[FAST486_REG_SS].Selector);
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopSs)
if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector));
+ Fast486LoadSegment(State, FAST486_REG_SS, LOWORD(NewSelector));
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSbbByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSbbModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
State->Flags.Pf = Fast486CalculateParity(Result);
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
-
- return TRUE;
-
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSbbEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
-
- return TRUE;
-
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushDs)
{
/* Call the internal API */
- return Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector);
+ Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector);
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopDs)
if (!Fast486StackPop(State, &NewSelector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486LoadSegment(State, FAST486_REG_DS, LOWORD(NewSelector));
+ Fast486LoadSegment(State, FAST486_REG_DS, LOWORD(NewSelector));
}
FAST486_OPCODE_HANDLER(Fast486OpcodeDaa)
State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0;
State->Flags.Zf = (Value == 0);
State->Flags.Pf = Fast486CalculateParity(Value);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
- }
- else
- {
- /* Discard the result */
- return TRUE;
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
- }
- else
- {
- /* Discard the result */
- return TRUE;
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
else
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if this is the instruction that writes to R/M */
if (!(Opcode & 0x10))
{
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
- }
- else
- {
- /* Discard the result */
- return TRUE;
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
}
{
/* This opcode doesn't take any prefixes */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
/* Write back the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Result;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCmpSubEax)
if (!Fast486FetchDword(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
if (!Fast486FetchWord(State, &SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Result;
}
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeDas)
State->Flags.Sf = (Value & SIGN_FLAG_BYTE) != 0;
State->Flags.Zf = (Value == 0);
State->Flags.Pf = Fast486CalculateParity(Value);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAaa)
/* Keep only the lowest 4 bits of AL */
State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAas)
/* Keep only the lowest 4 bits of AL */
State->GeneralRegs[FAST486_REG_EAX].LowByte &= 0x0F;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushAll)
if (!Fast486StackPush(State, Size ? SavedEsp.Long : SavedEsp.LowWord))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
else
: State->GeneralRegs[i].LowWord))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopAll)
if (!Fast486StackPop(State, &Value))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Don't modify ESP */
else State->GeneralRegs[i].LowWord = LOWORD(Value);
}
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeBound)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!ModRegRm.Memory)
{
/* Invalid */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Check for the segment override */
(PULONG)&LowerBound))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadMemory(State,
sizeof(ULONG)))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if ((Index < LowerBound) || (Index > UpperBound))
{
/* Out of bounds */
Fast486Exception(State, FAST486_EXCEPTION_BR);
- return FALSE;
}
}
else
(PUSHORT)&LowerBound))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadMemory(State,
sizeof(USHORT)))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if ((Index < LowerBound) || (Index > UpperBound))
{
/* Out of bounds */
Fast486Exception(State, FAST486_EXCEPTION_BR);
- return FALSE;
}
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeArpl)
{
/* Cannot be used in real mode or with a LOCK prefix */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
TOGGLE_ADSIZE(AddressSize);
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Read the operands */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if the RPL needs adjusting */
State->Flags.Zf = TRUE;
/* Write back the result */
- return Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue);
+ Fast486WriteModrmWordOperands(State, &ModRegRm, FALSE, SecondValue);
}
else
{
/* Clear ZF */
State->Flags.Zf = FALSE;
- return TRUE;
}
}
if (!Fast486FetchDword(State, &Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486StackPush(State, Data);
+ Fast486StackPush(State, Data);
}
else
{
if (!Fast486FetchWord(State, (PUSHORT)&Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486StackPush(State, Data);
+ Fast486StackPush(State, Data);
}
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (Opcode == 0x6B)
if (!Fast486FetchByte(State, (PUCHAR)&Byte))
{
/* Exception occurred */
- return FALSE;
+ return;
}
Multiplier = (LONG)Byte;
if (!Fast486FetchDword(State, (PULONG)&Dword))
{
/* Exception occurred */
- return FALSE;
+ return;
}
Multiplier = Dword;
if (!Fast486FetchWord(State, (PUSHORT)&Word))
{
/* Exception occurred */
- return FALSE;
+ return;
}
Multiplier = (LONG)Word;
(PULONG)&Multiplicand))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Multiply */
State->Flags.Cf = State->Flags.Of = ((Product < MINLONG) || (Product > MAXLONG));
/* Write-back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- TRUE,
- (ULONG)((LONG)Product));
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ TRUE,
+ (ULONG)((LONG)Product));
}
else
{
(PUSHORT)&Multiplicand))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Multiply */
State->Flags.Cf = State->Flags.Of = ((Product < MINSHORT) || (Product > MAXSHORT));
/* Write-back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- TRUE,
- (USHORT)((SHORT)Product));
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ TRUE,
+ (USHORT)((SHORT)Product));
}
}
if (!Fast486FetchByte(State, (PUCHAR)&Data))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the internal API */
- return Fast486StackPush(State, Data);
+ Fast486StackPush(State, Data);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovByteModrm)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486ReadModrmByteOperands(State,
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Fast486WriteModrmByteOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmByteOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check the operand size */
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
else
{
&SecondValue))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (Opcode & FAST486_OPCODE_WRITE_REG) Result = SecondValue;
else Result = FirstValue;
/* Write back the result */
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- Opcode & FAST486_OPCODE_WRITE_REG,
- Result);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ Opcode & FAST486_OPCODE_WRITE_REG,
+ Result);
}
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (ModRegRm.Register >= FAST486_NUM_SEG_REGS)
{
/* Invalid */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (OperandSize)
{
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- FALSE,
- State->SegmentRegs[ModRegRm.Register].Selector);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ FALSE,
+ State->SegmentRegs[ModRegRm.Register].Selector);
}
else
{
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- FALSE,
- State->SegmentRegs[ModRegRm.Register].Selector);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ FALSE,
+ State->SegmentRegs[ModRegRm.Register].Selector);
}
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* The second operand must be memory */
{
/* Invalid */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
/* Write the address to the register */
if (OperandSize)
{
- return Fast486WriteModrmDwordOperands(State,
- &ModRegRm,
- TRUE,
- ModRegRm.MemoryAddress);
+ Fast486WriteModrmDwordOperands(State,
+ &ModRegRm,
+ TRUE,
+ ModRegRm.MemoryAddress);
}
else
{
- return Fast486WriteModrmWordOperands(State,
- &ModRegRm,
- TRUE,
- ModRegRm.MemoryAddress);
+ Fast486WriteModrmWordOperands(State,
+ &ModRegRm,
+ TRUE,
+ ModRegRm.MemoryAddress);
}
}
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if ((ModRegRm.Register >= FAST486_NUM_SEG_REGS)
{
/* Invalid */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (OperandSize)
if (!Fast486ReadModrmDwordOperands(State, &ModRegRm, NULL, &Selector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
- return Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector));
+ Fast486LoadSegment(State, ModRegRm.Register, LOWORD(Selector));
}
else
{
if (!Fast486ReadModrmWordOperands(State, &ModRegRm, NULL, &Selector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
- return Fast486LoadSegment(State, ModRegRm.Register, Selector);
+ Fast486LoadSegment(State, ModRegRm.Register, Selector);
}
}
(State->GeneralRegs[FAST486_REG_EAX].LowByte & SIGN_FLAG_BYTE)
? 0xFF : 0x00;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCdq)
(State->GeneralRegs[FAST486_REG_EAX].LowWord & SIGN_FLAG_WORD)
? 0xFFFF : 0x0000;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCallAbs)
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
else
if (!Fast486FetchWord(State, (PUSHORT)&Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
if (!Fast486FetchWord(State, &Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Push the current code segment selector */
if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_CS].Selector))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Push the current value of the instruction pointer */
if (!Fast486StackPush(State, State->InstPtr.Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load the new CS */
if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load new (E)IP */
if (Size) State->InstPtr.Long = Offset;
else State->InstPtr.LowWord = LOWORD(Offset);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeWait)
{
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
-
- return FALSE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags)
{
/* Call the VM86 monitor */
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
- return FALSE;
+ return;
}
/* Push the flags */
- if (Size) return Fast486StackPush(State, State->Flags.Long);
- else return Fast486StackPush(State, LOWORD(State->Flags.Long));
+ if (Size) Fast486StackPush(State, State->Flags.Long);
+ else Fast486StackPush(State, LOWORD(State->Flags.Long));
}
FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags)
if (!Fast486StackPop(State, &NewFlags.Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check for VM86 mode when IOPL is not 3 */
{
/* Call the VM86 monitor */
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
- return FALSE;
+ return;
}
State->Flags.Cf = NewFlags.Cf;
if (Cpl == 0) State->Flags.Iopl = NewFlags.Iopl;
if (Cpl <= State->Flags.Iopl) State->Flags.If = NewFlags.If;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSahf)
/* Restore the reserved bits of FLAGS */
State->Flags.AlwaysSet = TRUE;
State->Flags.Reserved0 = State->Flags.Reserved1 = FALSE;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeLahf)
/* Set AH to the low-order byte of FLAGS */
State->GeneralRegs[FAST486_REG_EAX].HighByte = LOBYTE(State->Flags.Long);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeRet)
if (Opcode == 0xC2)
{
/* Fetch the number of bytes to pop after the return */
- if (!Fast486FetchWord(State, &BytesToPop)) return FALSE;
+ if (!Fast486FetchWord(State, &BytesToPop)) return;
}
/* Pop the return address */
- if (!Fast486StackPop(State, &ReturnAddress)) return FALSE;
+ if (!Fast486StackPop(State, &ReturnAddress)) return;
/* Return to the calling procedure, and if necessary, pop the parameters */
if (Size)
State->InstPtr.LowWord = LOWORD(ReturnAddress);
State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeLdsLes)
if (!Fast486ParseModRegRm(State, AddressSize, &ModRegRm))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!ModRegRm.Memory)
if (!Fast486FetchByte(State, &BopCode))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Call the BOP handler */
State->IntStatus = FAST486_INT_DELAYED;
}
- /* Return success */
- return TRUE;
+ return;
}
/* Invalid */
Fast486Exception(State, FAST486_EXCEPTION_UD);
- return FALSE;
+ return;
}
if (!Fast486ReadMemory(State,
OperandSize ? 6 : 4))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (OperandSize)
State->GeneralRegs[ModRegRm.Register].Long = Offset;
/* Load the segment */
- return Fast486LoadSegment(State,
- (Opcode == 0xC4)
- ? FAST486_REG_ES : FAST486_REG_DS,
- Segment);
+ Fast486LoadSegment(State,
+ (Opcode == 0xC4)
+ ? FAST486_REG_ES : FAST486_REG_DS,
+ Segment);
}
else
{
State->GeneralRegs[ModRegRm.Register].LowWord = Offset;
/* Load the segment */
- return Fast486LoadSegment(State,
- (Opcode == 0xC4)
- ? FAST486_REG_ES : FAST486_REG_DS,
- Segment);
+ Fast486LoadSegment(State,
+ (Opcode == 0xC4)
+ ? FAST486_REG_ES : FAST486_REG_DS,
+ Segment);
}
}
if (!Fast486FetchWord(State, &FrameSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
if (!Fast486FetchByte(State, &NestingLevel))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Push EBP */
if (!Fast486StackPush(State, State->GeneralRegs[FAST486_REG_EBP].Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Save ESP */
/* Reserve space for the frame */
if (Size) State->GeneralRegs[FAST486_REG_ESP].Long -= (ULONG)FrameSize;
else State->GeneralRegs[FAST486_REG_ESP].LowWord -= FrameSize;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeLeave)
State->GeneralRegs[FAST486_REG_ESP].Long = State->GeneralRegs[FAST486_REG_EBP].Long;
/* Pop the saved base pointer from the stack */
- return Fast486StackPop(State, &State->GeneralRegs[FAST486_REG_EBP].Long);
+ Fast486StackPop(State, &State->GeneralRegs[FAST486_REG_EBP].Long);
}
else
{
if (Fast486StackPop(State, &Value))
{
State->GeneralRegs[FAST486_REG_EBP].LowWord = LOWORD(Value);
- return TRUE;
}
- else return FALSE;
}
}
if (Opcode == 0xCA)
{
/* Fetch the number of bytes to pop after the return */
- if (!Fast486FetchWord(State, &BytesToPop)) return FALSE;
+ if (!Fast486FetchWord(State, &BytesToPop)) return;
}
/* Pop the offset */
if (!Fast486StackPop(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Pop the segment */
if (!Fast486StackPop(State, &Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load the new CS */
if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load new (E)IP, and if necessary, pop the parameters */
State->InstPtr.LowWord = LOWORD(Offset);
State->GeneralRegs[FAST486_REG_ESP].LowWord += BytesToPop;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeInt)
switch (Opcode)
{
- case 0xCC:
+ case 0xCC: // INT 3
{
/* This is the INT3 instruction */
IntNum = 3;
break;
}
- case 0xCD:
+ case 0xCD: // INT xx
{
/* Fetch the interrupt number */
if (!Fast486FetchByte(State, &IntNum))
{
/* Exception occurred */
- return FALSE;
+ return;
}
break;
}
- case 0xCE:
+ case 0xCE: // INTO
{
/* Don't do anything if OF is cleared */
- if (!State->Flags.Of) return TRUE;
+ if (!State->Flags.Of) return;
/* Exception #OF */
IntNum = FAST486_EXCEPTION_OF;
}
/* Perform the interrupt */
- return Fast486PerformInterrupt(State, IntNum);
+ Fast486PerformInterrupt(State, IntNum);
}
FAST486_OPCODE_HANDLER(Fast486OpcodeIret)
if (!Fast486StackPop(State, &InstPtr))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Pop CS */
if (!Fast486StackPop(State, &CodeSel))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Pop EFLAGS */
if (!Fast486StackPop(State, &NewFlags.Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check for protected mode */
if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the new flags */
{
/* Call the VM86 monitor */
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
- return FALSE;
+ return;
}
- return TRUE;
+ return;
}
if (State->Flags.Nt)
/* Nested task return */
UNIMPLEMENTED;
- return FALSE;
+ return;
}
if (NewFlags.Vm)
ULONG Es, Ds, Fs, Gs;
/* Pop ESP, SS, ES, FS, GS */
- if (!Fast486StackPop(State, &StackPtr)) return FALSE;
- if (!Fast486StackPop(State, &StackSel)) return FALSE;
- if (!Fast486StackPop(State, &Es)) return FALSE;
- if (!Fast486StackPop(State, &Ds)) return FALSE;
- if (!Fast486StackPop(State, &Fs)) return FALSE;
- if (!Fast486StackPop(State, &Gs)) return FALSE;
+ if (!Fast486StackPop(State, &StackPtr)) return;
+ if (!Fast486StackPop(State, &StackSel)) return;
+ if (!Fast486StackPop(State, &Es)) return;
+ if (!Fast486StackPop(State, &Ds)) return;
+ if (!Fast486StackPop(State, &Fs)) return;
+ if (!Fast486StackPop(State, &Gs)) return;
/* Set the new IP */
State->InstPtr.Long = LOWORD(InstPtr);
State->Flags.AlwaysSet = State->Flags.Vm = TRUE;
/* Load the new segments */
- if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) return FALSE;
- if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel)) return FALSE;
- if (!Fast486LoadSegment(State, FAST486_REG_ES, Es)) return FALSE;
- if (!Fast486LoadSegment(State, FAST486_REG_DS, Ds)) return FALSE;
- if (!Fast486LoadSegment(State, FAST486_REG_FS, Fs)) return FALSE;
- if (!Fast486LoadSegment(State, FAST486_REG_GS, Gs)) return FALSE;
+ if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel)) return;
+ if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel)) return;
+ if (!Fast486LoadSegment(State, FAST486_REG_ES, Es)) return;
+ if (!Fast486LoadSegment(State, FAST486_REG_DS, Ds)) return;
+ if (!Fast486LoadSegment(State, FAST486_REG_FS, Fs)) return;
+ if (!Fast486LoadSegment(State, FAST486_REG_GS, Gs)) return;
- return TRUE;
+ return;
}
/* Load the new CS */
if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set EIP */
if (!Fast486StackPop(State, &StackPtr))
{
/* Exception */
- return FALSE;
+ return;
}
/* Pop SS */
if (!Fast486StackPop(State, &StackSel))
{
/* Exception */
- return FALSE;
+ return;
}
/* Load new SS */
if (!Fast486LoadSegment(State, FAST486_REG_SS, StackSel))
{
/* Exception */
- return FALSE;
+ return;
}
/* Set ESP */
|| !State->SegmentRegs[i].DirConf))
{
/* Load the NULL descriptor in the segment */
- if (!Fast486LoadSegment(State, i, 0)) return FALSE;
+ if (!Fast486LoadSegment(State, i, 0)) return;
}
}
}
{
/* Invalid */
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, 0);
- return FALSE;
+ return;
}
/* Set new EIP */
if (!Fast486LoadSegment(State, FAST486_REG_CS, CodeSel))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set the new flags */
else State->Flags.LowWord = NewFlags.LowWord & REAL_MODE_FLAGS_MASK;
State->Flags.AlwaysSet = TRUE;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAam)
if (!Fast486FetchByte(State, &Base))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Check if the base is zero */
{
/* Divide error */
Fast486Exception(State, FAST486_EXCEPTION_DE);
- return FALSE;
+ return;
}
/* Adjust */
State->Flags.Zf = (Value == 0);
State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Value);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeAad)
if (!Fast486FetchByte(State, &Base))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Adjust */
State->Flags.Zf = (Value == 0);
State->Flags.Sf = ((Value & SIGN_FLAG_BYTE) != 0);
State->Flags.Pf = Fast486CalculateParity(Value);
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeXlat)
sizeof(UCHAR)))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Set AL to the result */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Value;
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeLoop)
/* Additional rule for LOOPNZ */
if (State->Flags.Zf) Condition = FALSE;
}
-
- if (Opcode == 0xE1)
+ else if (Opcode == 0xE1)
{
/* Additional rule for LOOPZ */
if (!State->Flags.Zf) Condition = FALSE;
if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
if (Condition)
if (Size) State->InstPtr.Long += Offset;
else State->InstPtr.LowWord += Offset;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeJecxz)
if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
if (Condition)
if (Size) State->InstPtr.Long += Offset;
else State->InstPtr.LowWord += Offset;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCall)
if (!Fast486FetchDword(State, (PULONG)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
/* Push the current value of the instruction pointer */
if (!Fast486StackPush(State, State->InstPtr.Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Move the instruction pointer */
if (!Fast486FetchWord(State, (PUSHORT)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
/* Push the current value of the instruction pointer */
if (!Fast486StackPush(State, State->InstPtr.Long))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Move the instruction pointer */
State->InstPtr.LowWord += Offset;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeJmp)
if (!Fast486FetchDword(State, (PULONG)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
/* Move the instruction pointer */
if (!Fast486FetchWord(State, (PUSHORT)&Offset))
{
/* An exception occurred */
- return FALSE;
+ return;
}
/* Move the instruction pointer */
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs)
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
else
if (!Fast486FetchWord(State, (PUSHORT)&Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
if (!Fast486FetchWord(State, &Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load the new CS */
if (!Fast486LoadSegment(State, FAST486_REG_CS, Segment))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Load new EIP */
State->InstPtr.Long = Offset;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovAlOffset)
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
else
if (!Fast486FetchWord(State, &WordOffset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
Offset = (ULONG)WordOffset;
}
/* Read from memory */
- return Fast486ReadMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- FALSE,
- &State->GeneralRegs[FAST486_REG_EAX].LowByte,
- sizeof(UCHAR));
+ Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ FALSE,
+ &State->GeneralRegs[FAST486_REG_EAX].LowByte,
+ sizeof(UCHAR));
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovEaxOffset)
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Read from memory */
if (OperandSize)
{
- return Fast486ReadMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- FALSE,
- &State->GeneralRegs[FAST486_REG_EAX].Long,
- sizeof(ULONG));
+ Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ FALSE,
+ &State->GeneralRegs[FAST486_REG_EAX].Long,
+ sizeof(ULONG));
}
else
{
- return Fast486ReadMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- FALSE,
- &State->GeneralRegs[FAST486_REG_EAX].LowWord,
- sizeof(USHORT));
+ Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ FALSE,
+ &State->GeneralRegs[FAST486_REG_EAX].LowWord,
+ sizeof(USHORT));
}
}
else
if (!Fast486FetchWord(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Read from memory */
if (OperandSize)
{
- return Fast486ReadMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- FALSE,
- &State->GeneralRegs[FAST486_REG_EAX].Long,
- sizeof(ULONG));
+ Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ FALSE,
+ &State->GeneralRegs[FAST486_REG_EAX].Long,
+ sizeof(ULONG));
}
else
{
- return Fast486ReadMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- FALSE,
- &State->GeneralRegs[FAST486_REG_EAX].LowWord,
- sizeof(USHORT));
+ Fast486ReadMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ FALSE,
+ &State->GeneralRegs[FAST486_REG_EAX].LowWord,
+ sizeof(USHORT));
}
}
}
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
}
else
if (!Fast486FetchWord(State, &WordOffset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
Offset = (ULONG)WordOffset;
}
/* Write to memory */
- return Fast486WriteMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- &State->GeneralRegs[FAST486_REG_EAX].LowByte,
- sizeof(UCHAR));
+ Fast486WriteMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ &State->GeneralRegs[FAST486_REG_EAX].LowByte,
+ sizeof(UCHAR));
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax)
if (!Fast486FetchDword(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write to memory */
if (OperandSize)
{
- return Fast486WriteMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- &State->GeneralRegs[FAST486_REG_EAX].Long,
- sizeof(ULONG));
+ Fast486WriteMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ &State->GeneralRegs[FAST486_REG_EAX].Long,
+ sizeof(ULONG));
}
else
{
- return Fast486WriteMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- &State->GeneralRegs[FAST486_REG_EAX].LowWord,
- sizeof(USHORT));
+ Fast486WriteMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ &State->GeneralRegs[FAST486_REG_EAX].LowWord,
+ sizeof(USHORT));
}
}
else
if (!Fast486FetchWord(State, &Offset))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write to memory */
if (OperandSize)
{
- return Fast486WriteMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- &State->GeneralRegs[FAST486_REG_EAX].Long,
- sizeof(ULONG));
+ Fast486WriteMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ &State->GeneralRegs[FAST486_REG_EAX].Long,
+ sizeof(ULONG));
}
else
{
- return Fast486WriteMemory(State,
- (State->PrefixFlags & FAST486_PREFIX_SEG) ?
- State->SegmentOverride : FAST486_REG_DS,
- Offset,
- &State->GeneralRegs[FAST486_REG_EAX].LowWord,
- sizeof(USHORT));
+ Fast486WriteMemory(State,
+ (State->PrefixFlags & FAST486_PREFIX_SEG) ?
+ State->SegmentOverride : FAST486_REG_DS,
+ Offset,
+ &State->GeneralRegs[FAST486_REG_EAX].LowWord,
+ sizeof(USHORT));
}
}
}
FAST486_OPCODE_HANDLER(Fast486OpcodeSalc)
{
+ /*
+ * See: http://www.rcollins.org/secrets/opcodes/SALC.html
+ * for more information.
+ */
+
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xD6);
/* Set all the bits of AL to CF */
State->GeneralRegs[FAST486_REG_EAX].LowByte = State->Flags.Cf ? 0xFF : 0x00;
-
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeMovs)
|| (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
{
/* Do nothing */
- return TRUE;
+ return;
}
}
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write to the destination operand */
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Increment/decrement ESI and EDI */
}
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeCmps)
|| (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
{
/* Do nothing */
- return TRUE;
+ return;
}
}
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Read from the second source operand */
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->InstPtr = State->SavedInstPtr;
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeStos)
else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count);
/* Exception occurred */
- return FALSE;
+ return;
}
if (!State->Flags.Df)
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Increment/decrement EDI */
else State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize;
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeLods)
: State->GeneralRegs[FAST486_REG_ECX].LowWord;
/* If the count is 0, do nothing */
- if (Count == 0) return TRUE;
+ if (Count == 0) return;
/* Only the last entry will be loaded */
if (!State->Flags.Df)
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Increment/decrement ESI */
if (!State->Flags.Df) State->GeneralRegs[FAST486_REG_ESI].LowWord += DataSize;
else State->GeneralRegs[FAST486_REG_ESI].LowWord -= DataSize;
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeScas)
|| (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
{
/* Do nothing */
- return TRUE;
+ return;
}
}
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Calculate the result */
State->InstPtr = State->SavedInstPtr;
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeIns)
else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count);
/* Exception occurred */
- return FALSE;
+ return;
}
if (!State->Flags.Df)
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Increment/decrement EDI */
else State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize;
}
}
-
- /* Return success */
- return TRUE;
}
FAST486_OPCODE_HANDLER(Fast486OpcodeOuts)
else State->GeneralRegs[FAST486_REG_ECX].LowWord = LOWORD(Count);
/* Exception occurred */
- return FALSE;
+ return;
}
if (State->Flags.Df)
DataSize))
{
/* Exception occurred */
- return FALSE;
+ return;
}
/* Write to the I/O port */
else State->GeneralRegs[FAST486_REG_ESI].LowWord -= DataSize;
}
}
-
- /* Return success */
- return TRUE;
}
/* EOF */