Re: [RFC] Virtual 8086 mode support for kernel drivers

Jan Klötzke <[email protected]> Tue, 29 Apr 2008 23:42:30 +0200
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <[email protected]>
Am Dienstag, 29. April 2008 schrieb Ingo Weinhold:
> On 2008-04-29 at 00:45:53 [+0200], Jan Klötzke <[email protected]> 
wrote:
> > I picked up Ingo's suggestion for a "page_fault_callback" to catch
> > unhandled page faults in vm86 mode. See the last patch in the series for
> > the details.
>
> I was actually thinking of just reusing the thread::fault_handler field.
> Its use is currently only defined for page faults in kernel mode, so there
> wouldn't be any collisions (it is nesting anyway, since one is usually
> required to reset it to its previous value). One could also use a
> (nameless) union to avoid casting.

I also understood your proposal that way. But as a generic facility it could 
be used by other drivers as well (even though I have no other usecase 
yet ;-) ). If a driver/module registers a page_fault_callback for longer 
times (e.g. across syscalls) and a unhandled page fault happes in the kernel 
then the page_fault_callback address would be used in the old fault_handler 
address sense and would not lead to a panic. Therefore I chose to make it 
explicit...

> BTW, I believe it is preferrable to add only *.cpp files in the kernel. We
> have a few headers that are quite messy, since they actually use C++
> features, but are included by *.c files. We are (very slowly) renaming *.c
> files to *.cpp, and I was hoping we would be able to clean up the headers
> one day.

Ok. Then maybe it's also an option to merge the struct vm86_state and the vm_* 
functions into a class? What's the direction Haiku is heading in this 
respect?

/Jan

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone