Author: aandrejevic Date: Wed Nov 20 14:21:47 2013 New Revision: 61058
URL: http://svn.reactos.org/svn/reactos?rev=61058&view=rev Log: [FAST486] The top half of EIP is cleared after a 16-bit jump.
Modified: branches/ntvdm/lib/fast486/opcodes.c branches/ntvdm/lib/fast486/opgroups.c
Modified: branches/ntvdm/lib/fast486/opcodes.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opcodes.c?rev=... ============================================================================== --- branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] (original) +++ branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] Wed Nov 20 14:21:47 2013 @@ -606,9 +606,12 @@ { 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 @@ { /* 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(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); @@ -1071,6 +1083,12 @@
/* 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 @@ }
/* 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 @@ 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; }
Modified: branches/ntvdm/lib/fast486/opgroups.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opgroups.c?rev... ============================================================================== --- branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] (original) +++ branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] Wed Nov 20 14:21:47 2013 @@ -1539,6 +1539,9 @@
/* 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 @@ /* 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 @@
/* 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) {