Virtual 8086 Mode: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Fixed typo by replacing "epb" with "ebp".)
m (Improved grammar and spelling.)
Line 4: 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.
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 pushf and popf instructions. These instructions repectively 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 popf instruction don't modify bits 16 and 17 in the eflags register.
A way of modifying the EFLAG register is to use the pushf and popf instructions. These instructions respectively 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 popf instruction doesn't modify bits 16 and 17 in the eflags register.
The only way to set the VM flag is to use the iret instruction. This instruction is normaly use to return from an interrupt. When executing a iret the CPU pop eip, cs, eflags, esp, ss from the stack and continue executing at the new eip.
The only way to set the VM flag is to use the iret instruction. This instruction is normally used to return from an interrupt. When executing an iret, the CPU pops eip, cs, eflags, esp, ss from the stack and continues executing at the new eip.


<pre>
<pre>