Author: aandrejevic
Date: Fri Nov 21 09:46:57 2014
New Revision: 65441

URL: http://svn.reactos.org/svn/reactos?rev=65441&view=rev
Log:
[FAST486]
Attempt to write the value to the stack before subtracting from the actual ESP 
register
in Fast486StackPush.


Modified:
    trunk/reactos/lib/fast486/common.inl

Modified: trunk/reactos/lib/fast486/common.inl
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.inl?rev=65441&r1=65440&r2=65441&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/common.inl        [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl        [iso-8859-1] Fri Nov 21 
09:46:57 2014
@@ -317,15 +317,19 @@
             return FALSE;
         }
 
+        /* Store the value in SS:[ESP - 4] */
+        if (!Fast486WriteMemory(State,
+                                FAST486_REG_SS,
+                                State->GeneralRegs[FAST486_REG_ESP].Long - 
sizeof(ULONG),
+                                &Value,
+                                sizeof(ULONG)))
+        {
+            /* Exception occurred */
+            return FALSE;
+        }
+
         /* Subtract ESP by 4 */
         State->GeneralRegs[FAST486_REG_ESP].Long -= sizeof(ULONG);
-
-        /* Store the value in SS:ESP */
-        return Fast486WriteMemory(State,
-                                  FAST486_REG_SS,
-                                  State->GeneralRegs[FAST486_REG_ESP].Long,
-                                  &Value,
-                                  sizeof(ULONG));
     }
     else
     {
@@ -339,16 +343,22 @@
             return FALSE;
         }
 
+        /* Store the value in SS:[SP - 2] */
+        if (!Fast486WriteMemory(State,
+                                FAST486_REG_SS,
+                                
LOWORD(State->GeneralRegs[FAST486_REG_ESP].LowWord - sizeof(USHORT)),
+                                &ShortValue,
+                                sizeof(USHORT)))
+        {
+            /* Exception occurred */
+            return FALSE;
+        }
+
         /* Subtract SP by 2 */
         State->GeneralRegs[FAST486_REG_ESP].LowWord -= sizeof(USHORT);
-
-        /* Store the value in SS:SP */
-        return Fast486WriteMemory(State,
-                                  FAST486_REG_SS,
-                                  State->GeneralRegs[FAST486_REG_ESP].LowWord,
-                                  &ShortValue,
-                                  sizeof(USHORT));
-    }
+    }
+
+    return TRUE;
 }
 
 FORCEINLINE


Reply via email to