[SOFT386]

Implement the direct relative near call (CALL rel16/32) instruction.


svn path=/branches/ntvdm/; revision=60147
This commit is contained in:
Aleksandar Andrejevic 2013-09-15 18:26:25 +00:00
parent 429d182d64
commit b78a6cb212

View file

@ -4204,10 +4204,60 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeJecxz)
SOFT386_OPCODE_HANDLER(Soft386OpcodeCall)
{
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size;
return FALSE;
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xE8);
if (State->PrefixFlags == SOFT386_PREFIX_OPSIZE)
{
/* The OPSIZE prefix toggles the size */
Size = !Size;
}
else if (State->PrefixFlags != 0)
{
/* Invalid prefix */
Soft386Exception(State, SOFT386_EXCEPTION_UD);
return FALSE;
}
/* Push the current value of the instruction pointer */
if (!Soft386StackPush(State, State->InstPtr.Long))
{
/* Exception occurred */
return FALSE;
}
if (Size)
{
LONG Offset = 0;
/* Fetch the offset */
if (!Soft386FetchDword(State, (PULONG)&Offset))
{
/* An exception occurred */
return FALSE;
}
/* Move the instruction pointer */
State->InstPtr.Long += Offset;
}
else
{
SHORT Offset = 0;
/* Fetch the offset */
if (!Soft386FetchWord(State, (PUSHORT)&Offset))
{
/* An exception occurred */
return FALSE;
}
/* Move the instruction pointer */
State->InstPtr.LowWord += Offset;
}
return TRUE;
}
SOFT386_OPCODE_HANDLER(Soft386OpcodeJmp)