Leaving Virtual-8086 Mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
shindow
Member
Member
Posts: 26
Joined: Thu Feb 25, 2010 7:35 am

Leaving Virtual-8086 Mode

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Leaving Virtual-8086 Mode

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
shindow
Member
Member
Posts: 26
Joined: Thu Feb 25, 2010 7:35 am

Re: Leaving Virtual-8086 Mode

Post 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 .
Post Reply