Virtual 8086 Mode: Difference between revisions

[unchecked revision][unchecked revision]
No edit summary
Line 4:
 
The CPU is executing in virtual 86 mode when the VM bit (bit 17) is set in the EFLAGS register. If you want to enter virtual 86 mode you must set this bit to 1.
A way of modifying the EFLAG register is to use the pushfPUSHF and popfPOPF instructions. These instructions repectivelyrespectively push and pop the eflags register on the stack. So you could push the register, modify it on the stack and pop it. But the popfPOPF instruction dondoesn't modify bits 16 and 17 in the eflagsEFLAGS register.
The only way to set the VM flag is to use the iretIRET instruction. This instruction is normalynormally use to return from an interrupt. When executing a iretIRET the CPU pop eipEIP, csCS, eflagsEFLAGS, espESP, ssSS from the stack and continue executing at the new eipEIP.
 
<pre>
Anonymous user