[haiku-development] Virtual 8086 mode support

Hi,

looking at the restriction not being able to change the resolution when running
on the vesa driver I decided to try implementing virtual 8086 mode support as a
first step. So here it is... ;-)

It turned out to be not very difficult in the end. There is a new syscall
vm86() which enters virtual 8086 mode for the current thread. The caller passes
a structure with all the registers with where the execution should begin in
vm86 mode. Whenever a priviliged intruction is executed the vm86() call will
return with B_OK or, if a signal is delivered, with B_INTERRUPTED. In any case
the passed registers structure will be updated to the values where the vm86
mode was left.

To the implementation itself... to enter vm86 mode the current syscall iframe
is overwritten with the given register values and the VM bit in EFLAGS is
enabled. This will cause the CPU to switch to vm86 mode when executing the iret
intruction on this frame.

Any interrupt or exception will cause the CPU to leave vm86 mode. When it was
a general protection exception or a signal is about to be delivered the old
iframe is restored and the current register state is saved to the user mode
structure.

I coded a very small test application and the code seems to be working so far.

But what is missing to call the VESA bios is the ability to mmap 0xA000--0xFFFF
physically into the address space of the team. Don't know if this is aready
possible...

/Jan

Other related posts: