calpol2004 wrote:
I don't like the idea bloating the kernel with a emulator (even if it is labotomized to take away everything not required to run real mode interrupts) or to trap exceptions on the interrupt instruction and then jump in real mode to run the interrupt. But I don't like the idea of making the kernel annoying by forcing reboots when the display mode is swapped either! but at the same i don't want the kernel riddled with dirty hacks :/.
Thanks for the explanations guys.
You don't have to bloat your kernel with an emulator, there is no reason the video driver couldn't contain said emulator. This leaves the kernel to not have any hacks to support real mode, no dropping back, no worrying about rebooting, etc. As long as your video driver asks for the resources required (like a copy of <1mb, it doesn't gave to be the original, just a copy), and access to in/out, it can do all the emulation it needs without bloating or adding anything to your kernel.
And yes, since most video cards were made to support vm86, there is no need to support pmode in the emulation, as video rom bios' tend not to rely on it. You could always have a pmode protection scheme, if they try to jump to pmode, catch it, and cause an exception and report that the real mode program tried to set pmode. Typically though, like has been mentioned, video cards don't ever try to leave real mode, as this would break a lot of backwards compatibility (like, 32-bit versions of windows wouldn't be able to properly set modes... and i don't know to many manufacturers that would like to break that).