VM86

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
InsightSoft
Member
Member
Posts: 76
Joined: Mon Aug 18, 2008 6:17 am

VM86

Post 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??)
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: VM86

Post 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.
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: VM86

Post 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?
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: VM86

Post 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.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: VM86

Post 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.
InsightSoft
Member
Member
Posts: 76
Joined: Mon Aug 18, 2008 6:17 am

Re: VM86

Post 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??
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: VM86

Post 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.
InsightSoft
Member
Member
Posts: 76
Joined: Mon Aug 18, 2008 6:17 am

Re: VM86

Post 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?
User avatar
Nessphoro
Member
Member
Posts: 308
Joined: Sat Apr 30, 2011 12:50 am

Re: VM86

Post by Nessphoro »

Listen, bud, google before you ask.

http://osdev.berlios.de/v86.html

/thread
Post Reply