Page 1 of 1
VM86
Posted: Sat Oct 08, 2011 2:37 am
by InsightSoft
Hi,
I have all up and running (user layer, vm86. Even multitask...)
But now, how to be able to use 16bits ints??? (since all goes trough the IDT??)
Re: VM86
Posted: Sat Oct 08, 2011 3:08 am
by rdos
If you mean how to simulate 16-bit ints (like DOS & BIOS software interrupts), it is simple. You set the IDT gate to kernel-only access, and then you emulate the function so the application cannot see the difference.
I have a device-driver that does all this to provide DOS and DOS-extender support in my OS, but it is rather obsolete at this point.
Re: VM86
Posted: Sun Oct 09, 2011 1:03 am
by Nessphoro
rdos wrote:If you mean how to simulate 16-bit ints (like DOS & BIOS software interrupts), it is simple. You set the IDT gate to kernel-only access, and then you emulate the function so the application cannot see the difference.
I have a device-driver that does all this to provide DOS and DOS-extender support in my OS, but it is rather obsolete at this point.
Obsolete, huh?
Then, how do you enable graphics mode, sir?
Re: VM86
Posted: Sun Oct 09, 2011 7:00 am
by Chandra
Nessphoro wrote:Then, how do you enable graphics mode, sir?
Not all people use Graphics mode. Some are happy with the VGA, while other feel comfortable with the text mode. A few rare people are smart enough to use native video drivers.
Re: VM86
Posted: Sun Oct 09, 2011 7:22 am
by rdos
Nessphoro wrote:rdos wrote:If you mean how to simulate 16-bit ints (like DOS & BIOS software interrupts), it is simple. You set the IDT gate to kernel-only access, and then you emulate the function so the application cannot see the difference.
I have a device-driver that does all this to provide DOS and DOS-extender support in my OS, but it is rather obsolete at this point.
Obsolete, huh?
Then, how do you enable graphics mode, sir?
The easiest way is to do it before you start the kernel (in real-mode). The hardest way is to do it in V86-mode, since then you need to setup the needed fault-handlers because the BIOS will use instructions that are not allowed in V86-mode. In either case, you use int 0x10 in real-mode / V86 mode to change video-mode.
It also depends on if the processor supports V86 extensions. If it does, there is no need for an instruction emulator, and the generated faults are simple to handle. If there is no support for V86 extensions, I need to load the emulator module (the above DOS & DOS extender device-driver). I have support for switching between video-modes in my OS, and especially between graphics mode and text-mode. I have hot keys to be able to switch between consoles / processes that might use different video-modes.
Re: VM86
Posted: Sun Oct 09, 2011 4:07 pm
by InsightSoft
thanks ,
so, suppose your about to create a VM86 that will call INT 0xXX.
it will generate the INT, the kernel will catch through IDT (with a task gate (another vm86???), somehow this task should put it self in real-mode (while in interrupt-handler-time) and jump to interrupt address SSSS:OOOO (from IVT)??????
Or I'm missing something??
Re: VM86
Posted: Sun Oct 09, 2011 10:51 pm
by rdos
InsightSoft wrote:thanks ,
so, suppose your about to create a VM86 that will call INT 0xXX.
You start a V86 task by doing an iretd from kernel. The stack should have the register content suitable for V86, most importantly EFLAGS VM bit should be set. The INT 0xXX itself is easiest simulated by loading CS:IP with the real-mode IVT entry before doing the call. Then you need to be able to get back to your kernel. You can do this by putting an invalid instruction in real-mode space, and then catch it. Before the call, you setup the real-mode stack so it contains CS:IP of the invalid instruction.
InsightSoft wrote:it will generate the INT, the kernel will catch through IDT (with a task gate (another vm86???), somehow this task should put it self in real-mode (while in interrupt-handler-time) and jump to interrupt address SSSS:OOOO (from IVT)??????
Or I'm missing something??
V86-mode need its own IVT. It cannot use your protected mode IVT (different format). You need to simulate int x instructions.
Re: VM86
Posted: Mon Oct 10, 2011 3:07 am
by InsightSoft
The INT 0xXX itself is easiest simulated by loading CS:IP with the real-mode IVT entry before doing the call
How? you are at multi-task environment. And even in vm86 all goes trough IDT... (I'm stuck!)
V86-mode need its own IVT. It cannot use your protected mode IVT (different format). You need to simulate int x instructions.
simulate... How exactly?
I mean, there's a lot (and dirty) ways to do that. But, wich one, is the correct one? How you guys, are doing?
Re: VM86
Posted: Mon Oct 10, 2011 4:55 pm
by Nessphoro
Listen, bud, google before you ask.
http://osdev.berlios.de/v86.html
/thread