[SOFT386]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 21 Sep 2013 01:00:36 +0000 (01:00 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Sat, 21 Sep 2013 01:00:36 +0000 (01:00 +0000)
Fix the CALL instruction. The offset must be fetched before EIP is pushed.

svn path=/branches/ntvdm/; revision=60259

lib/soft386/opcodes.c

index b0dd8f5..88dcdfa 100644 (file)
@@ -4506,13 +4506,6 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall)
         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;
@@ -4524,6 +4517,13 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall)
             return FALSE;
         }
 
+        /* Push the current value of the instruction pointer */
+        if (!Soft386StackPush(State, State->InstPtr.Long))
+        {
+            /* Exception occurred */
+            return FALSE;
+        }
+
         /* Move the instruction pointer */        
         State->InstPtr.Long += Offset;
     }
@@ -4538,6 +4538,13 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeCall)
             return FALSE;
         }
 
+        /* Push the current value of the instruction pointer */
+        if (!Soft386StackPush(State, State->InstPtr.Long))
+        {
+            /* Exception occurred */
+            return FALSE;
+        }
+
         /* Move the instruction pointer */        
         State->InstPtr.LowWord += Offset;
     }