[haiku-development] Virtual 8086 mode support
- From: Jan Klötzke <jan.kloetzke@xxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Sat, 19 Apr 2008 19:28:11 +0200
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
- Follow-Ups:
- [haiku-development] [PATCH 1/5] Allow areas in the lower 1Mb for x86 for vm86 mode.
- From: Jan Klötzke
- [haiku-development] [PATCH 2/5] Replace all checks to USER_CODE_SEG by IFRAME_IS_USER macro.
- From: Jan Klötzke
- [haiku-development] [PATCH 3/5] Preserve 16 bytes on the top of the kernel stack.
- From: Jan Klötzke
- [haiku-development] [PATCH 4/5] Add virtual 8086 mode support.
- From: Jan Klötzke
- [haiku-development] [PATCH 5/5] Invalidate IO permission bitmap.
- From: Jan Klötzke
- [haiku-development] Re: Virtual 8086 mode support
- From: Axel Dörfler
- [haiku-development] Re: Virtual 8086 mode support
- From: Gerald Zajac
- [haiku-development] Re: Virtual 8086 mode support
- From: Ingo Weinhold
- [haiku-development] Re: Virtual 8086 mode support
- From: Jan Klötzke
Other related posts:
- » [haiku-development] Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- » [haiku-development] Re: Virtual 8086 mode support
- [haiku-development] [PATCH 1/5] Allow areas in the lower 1Mb for x86 for vm86 mode.
- From: Jan Klötzke
- [haiku-development] [PATCH 2/5] Replace all checks to USER_CODE_SEG by IFRAME_IS_USER macro.
- From: Jan Klötzke
- [haiku-development] [PATCH 3/5] Preserve 16 bytes on the top of the kernel stack.
- From: Jan Klötzke
- [haiku-development] [PATCH 4/5] Add virtual 8086 mode support.
- From: Jan Klötzke
- [haiku-development] [PATCH 5/5] Invalidate IO permission bitmap.
- From: Jan Klötzke
- [haiku-development] Re: Virtual 8086 mode support
- From: Axel Dörfler
- [haiku-development] Re: Virtual 8086 mode support
- From: Gerald Zajac
- [haiku-development] Re: Virtual 8086 mode support
- From: Ingo Weinhold
- [haiku-development] Re: Virtual 8086 mode support
- From: Jan Klötzke