[haiku-development] Re: Virtual 8086 mode support

  • From: Jan Klötzke <jan.kloetzke@xxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 26 Apr 2008 19:02:50 +0200

Am Samstag, 26. April 2008 schrieb Axel Dörfler:
> I'm not sure why there should be any page faults inside a vm86 call -
> wouldn't it be an appropriate requirement to only operate on locked in
> memory there?
> Or is there something we might not be able to control?

Normally working on some locked pages should be sufficient. But the BIOS might 
go wild ;-) or the caller might forget to initialize a pointer where the BIOS 
writes back data. The other option would be to create an area which covers 
the whole lower 640kb range (upper 384kb are always identity mapped). But 
then we waste 640k of (locked!) memory where we would need only one or two 
pages and I would rather like to detect such pointer errors.

> In any case, the vm_page_fault() can always handle the problem - it
> will either panic or crash the app in question if there is a more sever
> problem. You could also use vm_soft_fault() instead of vm_page_fault()
> if you need more control over this.

The problem is that vm_page_fault() will just send a SIGSEGV but the vm86 mode 
is not interrupted due to signals. In this case we end up in a deadlock 
because making vm86 (BIOS) calls interruptable doesn't seem to be a good 
option eighther.

Anyway, using vm_soft_fault() specifically for the vm86 case looks like a 
viable option. I haven't tried it yet because it's declared "static" in 
vm.cpp.

Thanks,

/Jan

Other related posts: