[FAST486]

The top half of EIP is cleared after a 16-bit jump.


svn path=/branches/ntvdm/; revision=61058
This commit is contained in:
Aleksandar Andrejevic
2013-11-20 14:21:47 +00:00
parent 459e3a6f48
commit f90a1db2b7
2 changed files with 32 additions and 4 deletions
+24 -4
View File
@@ -606,10 +606,13 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp)
{
BOOLEAN Jump = FALSE;
CHAR Offset = 0;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */
ASSERT((Opcode & 0xF0) == 0x70);
TOGGLE_OPSIZE(Size);
/* Fetch the offset */
if (!Fast486FetchByte(State, (PUCHAR)&Offset))
{
@@ -686,6 +689,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortConditionalJmp)
{
/* Move the instruction pointer */
State->InstPtr.Long += Offset;
if (!Size)
{
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
}
/* Return success */
@@ -1058,6 +1067,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOut)
FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump)
{
CHAR Offset = 0;
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
TOGGLE_OPSIZE(Size);
/* Make sure this is the right instruction */
ASSERT(Opcode == 0xEB);
@@ -1072,6 +1084,12 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeShortJump)
/* Move the instruction pointer */
State->InstPtr.Long += Offset;
if (!Size)
{
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
return TRUE;
}
@@ -5087,7 +5105,10 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmp)
}
/* Move the instruction pointer */
State->InstPtr.LowWord += Offset;
State->InstPtr.Long += Offset;
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
return TRUE;
@@ -5137,9 +5158,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeJmpAbs)
return FALSE;
}
/* Load new (E)IP */
if (Size) State->InstPtr.Long = Offset;
else State->InstPtr.LowWord = LOWORD(Offset);
/* Load new EIP */
State->InstPtr.Long = Offset;
return TRUE;
}
+8
View File
@@ -1539,6 +1539,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF)
/* Set the IP to the address */
State->InstPtr.LowWord = Value;
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
else if (ModRegRm.Register == 3)
{
@@ -1588,6 +1591,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF)
/* Set the IP to the address */
State->InstPtr.LowWord = Value;
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
else if (ModRegRm.Register == 4)
{
@@ -1627,6 +1632,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupFF)
/* Set the IP to the address */
State->InstPtr.LowWord = Value;
/* Clear the top half of EIP */
State->InstPtr.Long &= 0xFFFF;
}
else if (ModRegRm.Register == 6)
{