[ros-diffs] [tkreuzer] 48781: [NTOS] - More fixes to VDM PUSH/POPF code: - When doing a 32bit push, don't store the flags 2 bytes off - Recalculate HardwareEsp, by substracting the segment part, instead of tru...

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Sep 16 19:21:22 UTC 2010


Author: tkreuzer
Date: Thu Sep 16 19:21:20 2010
New Revision: 48781

URL: http://svn.reactos.org/svn/reactos?rev=48781&view=rev
Log:
[NTOS]
- More fixes to VDM PUSH/POPF code: 
- When doing a 32bit push, don't store the flags 2 bytes off
- Recalculate HardwareEsp, by substracting the segment part, instead of truncating the flat pointer to 16 bit.

Modified:
    trunk/reactos/ntoskrnl/ke/i386/v86vdm.c

Modified: trunk/reactos/ntoskrnl/ke/i386/v86vdm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86vdm.c?rev=48781&r1=48780&r2=48781&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/v86vdm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/v86vdm.c [iso-8859-1] Thu Sep 16 19:21:20 2010
@@ -76,17 +76,17 @@
     {
         /* Save EFlags */
         Esp -= 4;
-        *(PULONG)(Esp - 2) = V86EFlags;
+        *(PULONG)Esp = V86EFlags;
     }
     else
     {
+        /* Save EFLags */
         Esp -= 2;
-        /* Save EFLags */
         *(PUSHORT)Esp = (USHORT)V86EFlags;
     }
     
     /* Set new ESP and EIP */
-    TrapFrame->HardwareEsp = (USHORT)Esp;
+    TrapFrame->HardwareEsp = Esp - (TrapFrame->HardwareSegSs << 4);
     TrapFrame->Eip += KiVdmGetInstructionSize(Flags);
     
     /* We're done */
@@ -115,12 +115,10 @@
         /* Read EFlags */
         EFlags = *(PUSHORT)Esp;
         Esp += 2;
-        /* Read correct flags and use correct stack address */
-        EFlags &= 0xFFFF;
     }
     
     /* Set new ESP */
-    TrapFrame->HardwareEsp = (USHORT)Esp;
+    TrapFrame->HardwareEsp = Esp - (TrapFrame->HardwareSegSs << 4);
     
     /* Mask out IOPL from the flags */
     EFlags &= ~EFLAGS_IOPL;




More information about the Ros-diffs mailing list