Page 1 of 1

Leaving Virtual-8086 Mode

Posted: Sun Mar 21, 2010 8:39 pm
by shindow
what i want to do is just leave Virtual-8086 Mode

I see the intel guide is like this:
3. General-protection exception caused by software interrupt (INT n), IRET,
POPF, PUSHF, IN, or OUT when IOPL is less than 3.
so when i enter the vm86,

Code: Select all

mov sp,0x2000
	popf
when execute the popf ,it will jump to protected-mode to do the GP fault,but error just happen,i don't see it execute the GP fault
and IOPL=0

thank you in advance

Re: Leaving Virtual-8086 Mode

Posted: Mon Mar 22, 2010 4:07 am
by Combuster
pushf/popf/cli/sti and some others will not cause a GPF when CR4.VME is enabled, neither will INx/OUTx under the right conditions.
Also, upon entry of the interrupt handler, DS/ES will still have the V8086 mode values, which can cause more problems if you are not aware of that. (are you sure you reload DS/ES upon interrupt entry)

To debug your exact problem, I'll need to know what instruction is executed where directly after the popf. You can use Bochs' debugger to find out what that is.

Re: Leaving Virtual-8086 Mode

Posted: Mon Mar 22, 2010 7:23 pm
by shindow
Combuster wrote:pushf/popf/cli/sti and some others will not cause a GPF when CR4.VME is enabled
yes,But this is another condition.It is like real mode.

Combuster wrote:I'll need to know what instruction is executed where directly after the popf
It doesn't matter what instruction it is after that.When s or n ,errors just happens

I guess that my problem is that i don't set TSS. I am reading the papersheet of intel,I don't know how to set TSS for IDT

In fact,i use "ud2" to in protected-mode,GPF happens,but i could still go on debug,but in vm86 i cann't .