Author: aandrejevic
Date: Mon Apr 20 01:25:04 2015
New Revision: 67321

URL: http://svn.reactos.org/svn/reactos?rev=67321&view=rev
Log:
[FAST486]
(Addendum to r67320) ... and that goes for POP too...


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=67321&r1=67320&r2=67321&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/common.inl        [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl        [iso-8859-1] Mon Apr 20 
01:25:04 2015
@@ -408,7 +408,9 @@
         /* Read the value from SS:ESP */
         if (!Fast486ReadMemory(State,
                                FAST486_REG_SS,
-                               State->GeneralRegs[FAST486_REG_ESP].Long,
+                               State->SegmentRegs[FAST486_REG_SS].Size
+                               ? State->GeneralRegs[FAST486_REG_ESP].Long
+                               : State->GeneralRegs[FAST486_REG_ESP].LowWord,
                                FALSE,
                                &LongValue,
                                sizeof(LongValue)))
@@ -417,8 +419,16 @@
             return FALSE;
         }
 
-        /* Increment ESP by 4 */
-        State->GeneralRegs[FAST486_REG_ESP].Long += sizeof(ULONG);
+        if (State->SegmentRegs[FAST486_REG_SS].Size)
+        {
+            /* Increment ESP by 4 */
+            State->GeneralRegs[FAST486_REG_ESP].Long += sizeof(ULONG);
+        }
+        else
+        {
+            /* Increment SP by 4 */
+            State->GeneralRegs[FAST486_REG_ESP].LowWord += sizeof(ULONG);
+        }
 
         /* Store the value in the result */
         *Value = LongValue;
@@ -438,7 +448,9 @@
         /* Read the value from SS:SP */
         if (!Fast486ReadMemory(State,
                                FAST486_REG_SS,
-                               State->GeneralRegs[FAST486_REG_ESP].LowWord,
+                               State->SegmentRegs[FAST486_REG_SS].Size
+                               ? State->GeneralRegs[FAST486_REG_ESP].Long
+                               : State->GeneralRegs[FAST486_REG_ESP].LowWord,
                                FALSE,
                                &ShortValue,
                                sizeof(ShortValue)))
@@ -447,8 +459,16 @@
             return FALSE;
         }
 
-        /* Increment SP by 2 */
-        State->GeneralRegs[FAST486_REG_ESP].LowWord += sizeof(USHORT);
+        if (State->SegmentRegs[FAST486_REG_SS].Size)
+        {
+            /* Increment ESP by 2 */
+            State->GeneralRegs[FAST486_REG_ESP].Long += sizeof(USHORT);
+        }
+        else
+        {
+            /* Increment SP by 2 */
+            State->GeneralRegs[FAST486_REG_ESP].LowWord += sizeof(USHORT);
+        }
 
         /* Store the value in the result */
         *Value = ShortValue;


Reply via email to