Some basic Questions about 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
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Some basic Questions about Virtual 8086 Mode.....

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:54 pm, edited 2 times in total.
Tim

Re:Some basic Questions about Virtual 8086 Mode.....

Post by Tim »

Perica Senjak wrote:--When using the "iret" instruction to Switch to vm86 Mode (After changing the eflags.vm bit) Do i load a RealMode/vm86 mode CS Value (Pushing a RealMode/vm86 mode CS Value onto the Stack before executing "iret") or do i wait until i have entered vm86 mode, and then jump to a RealMode/vm86 mode Segment?
Put a CS value compatible with real mode into the stack image before IRET. A ring 0 to V86 stack frame looks like a normal ring 0 to ring 3 frame except that there are DS, ES, FS and GS register images there too (check the Intel manual for details).
--Just before exectuting the "iret" Instruction to Enter vm86 mode, Do i pust a 16-Bit (word) Instruction Pointer ((e)ip) Value, or do i push a 32-Bit value??
32-bit. As I said, the stack frame is as normal except for the extra segment register images.
--While in vm86 mode, is it possible to use 32-Bit Registers (eax, ebx, ecx, edx etc. ?) ??
Yes. Use the address and operand size override prefixes as normal.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Interrupts in vm86 Mode?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:53 pm, edited 1 time in total.
Tim

Re:Some basic Questions about Virtual 8086 Mode.....

Post by Tim »

I think this page should answer these questions: http://osdev.berlios.de/v86.html
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Some basic Questions about Virtual 8086 Mode.....

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:53 pm, edited 1 time in total.
DarylD

Re:Some basic Questions about Virtual 8086 Mode.....

Post by DarylD »

I don't think you read it very well Perica.

Within seconds I found this little snippet:
If it uses the BIOS, your code will also need the interrupt vector table and BIOS data area from address 0 to 500. If your boot loader or kernel wrote over the IVT and BDA you are also stuck; if so, you will need to modify them so as to preseve that memory. Again, you could make the bottom 500 bytes copy-on-write so that each task got its own IVT and BDA; however, for now it should be enough to map the first page to address zero and make it read-write.
Read it again!
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Some basic Questions about Virtual 8086 Mode.....

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:53 pm, edited 1 time in total.
Tim

Re:Some basic Questions about Virtual 8086 Mode.....

Post by Tim »

Perica Senjak wrote:So, does this mean When i am Multi-Tasking vm86 Mode and ProtectedMode that i have to Load the IDT each time?
No.
How would i load the IVT, would i use the lidt instruction? If so, then does the Offset address Remain a Double-Word in Size, or is it a Word in Size?
You wouldn't. The IVT isn't an IDT.
And, lastly... How do i handle IRQ's and Exceptions? Do i have to put all of this Code below the 1mb Mark, or is there another way??
The IDT remains in force even when a V86 task is running. A sure way of handling interrupts is to have them all go through the IDT in ring 0, then modify CS and IP for the V86 task as appropriate.
Yes, the tutorial answers most questions about vm86 Mode, but i couldn't find answers anywhere to the ones above. So if somebody could please help me out ;D .....
Read the Intel manuals. All the answers are in there if you read closely enough.
Post Reply