fireball(a)svn.reactos.org wrote:
Author: fireball
Date: Sat Sep 11 09:20:26 2010
New Revision: 48745
...
/* Save EFlags */
+ Esp -= 4;
+ *(PULONG)(Esp - 2) = V86EFlags;
This looks wrong to me. The (Esp - 2) I mean.
+ if (KiVdmGetPrefixFlags(Flags) &
PFX_FLAG_OPER32)
+ {
+ /* Read EFlags */
+ EFlags = *(PULONG)Esp;
+ Esp += 4;
+ }
+ else
+ {
+ /* Read EFlags */
+ EFlags = *(PUSHORT)Esp;
+ Esp += 2;
/* Read correct flags and use correct stack address */
- Esp -= 2;
EFlags &= 0xFFFF;
Here the comment got broken a bit.
/* Set new ESP */
- TrapFrame->HardwareEsp = Esp;
+ TrapFrame->HardwareEsp = (USHORT)Esp;
This is not correct. We earlier calculated the flat Esp from Ss and Sp.
Example:
HardwareSegSs = 0x10, HardwareEsp = 0x10 -> flat Esp = 0x110, then you
substract 4, and get 0x10C. But this is not the value of the new
HardwareEsp. TrapFrame->HardwareEsp needs to be either modified in
parallel to the flat Esp or calculated like (USHORT)(Esp -
(TrapFrame->HardwareSegSs << 4)).
Regards,
Timo