Vmode
- Combuster
- 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:Vmode
Straight from the intel manual:
- set VM in a task's eflags and jump to that task
- set the VM bit in an interrupt structure before doing IRET
In your problems context:16.2.1. Enabling Virtual-8086 Mode
The processor runs in virtual-8086 mode when the VM (virtual machine) flag in the EFLAGS register is set. This flag can only be set when the processor switches to a new protected-mode task or resumes virtual-8086 mode via an IRET instruction.
- set VM in a task's eflags and jump to that task
- set the VM bit in an interrupt structure before doing IRET
- Combuster
- 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:Vmode
It helps by asking WHAT you do not understand about virtual 8086 mode. I suppose you didnt try to make a v8086 compatible stack and then iret from it?
As for that, you wont be getting away without reading intel's big book of patterns (volume 3, chapter 16) which close to dictates you what to do...
As for bios, you should be able to run all those functions within v8086 mode, but that depends on how you handle the corner cases - setting iopl to ring 3 would probably the easiest but also the most instable (i.e. win 95 style).
As for that, you wont be getting away without reading intel's big book of patterns (volume 3, chapter 16) which close to dictates you what to do...
As for bios, you should be able to run all those functions within v8086 mode, but that depends on how you handle the corner cases - setting iopl to ring 3 would probably the easiest but also the most instable (i.e. win 95 style).
Re:Vmode
hmmm
have you even setup a TSS or even things like gdt and idt
I have an idea though incase you want them without all that stuff(though you'll eventually have to do that..)
how about going through bios code, like the bochs bios code or qemu and then just converting the code to 32bit(which isn't hard most of the time)
have you even setup a TSS or even things like gdt and idt
I have an idea though incase you want them without all that stuff(though you'll eventually have to do that..)
how about going through bios code, like the bochs bios code or qemu and then just converting the code to 32bit(which isn't hard most of the time)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Vmode
all i can offer atm. is the in the VBE2 driver for clicker. It features code coming from the OSlib that does VM86 nitty-gritty. You'll find there code that does context change (e.g. messing with the Task Register of the CPU), but that is a very specific kind of context change. You don't actually need to have a full-blown task scheduler implemented for VM86.
at worst, if you have a scheduler already, all you need is to make sure that the thread structure correctly reflect the fact your thread now execute in a new TSS (think of TSS as a container for executing threads, not as units of executions per-se).
at worst, if you have a scheduler already, all you need is to make sure that the thread structure correctly reflect the fact your thread now execute in a new TSS (think of TSS as a container for executing threads, not as units of executions per-se).
Re:Vmode
You can try looking at this site. Maybe it will help you. http://osdev.berlios.de/v86.html
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Vmode
i'd say your next step will be to fill one TSS with V86-compatible register values (e.g. the VM bit set in EFLAGS), to manage to have an illegal instruction (e.g. HLT) somewhere below 1MB and to make the V86 task start executing there.abuashraf wrote: what is the next step?
That should give you a GPF with cross-ring stack and CS:IP:FLAGS values that will be the proof you've been in VM86 mode... Then it will depend on what you actually plan to do in VM.