You can follow the current code development at //depot/user/nsouch/kgi6/src/sys/...
News are available at http://www.freebsd.org/~nsouch/kgi4BSD/news.html
We use the concept of condvar(9) with mutex(9) to implement something like the wait_event I found in KGI. I wonder why the condvar API is not part of the mutex one since a cv is nothing else than a mutex with a waitqueue. So I decided to merge FreeBSD condvar and mutexes in the KgiMutex implementation.
In KgiLinux code, page mapping is performed for a set of pages and not only on pagefault occurence. I have to check whether this is also possible with FreeBSD VM. This is certainly possible using something like vm_fault_additional_pages() which is currently bypassed when getting OBJT_DEVICE or OBJT_KGI pages.
For KgiAccel, we have to change the protection of pages to provoke pagefaults on them. But pagefaults on resident pages is only expected to happen on COW pages. getpages is only used to allocation non resident pages and no flag in the prototype of getpages allow passing some flag. Faults on resident pages shall occur typically when a process being not mapped anymore attempts to access an KgiMmio or KgiAccel. By the way, pages must not be FICTITIOUS otherwise they have no corresponding PTE and thus the MMU entries can't be release by any means other than through pmaps! Currently I use my own page allocator and don't use the paging one. FreeBSD VM implementation seems completly inappropriate to alternative VM policies other than the paging one
What about adding a new method to pagers: .pgo_checkpages to handle faults on resident pages?
About SMP, I think excluding concurrent access to the kgi device structure could be a first attempt. Especially to manage atomic map / unmap of devices.
I'm wondering how to block a process performing graphics on a device that is umapped. I'm not happy with any signal scheme and would really prefer a blocking thread. This implies some programming style, threading oriented with for example a thread for drawing (I mean accessing the HW resources) and others do the rest of the application. The main drawback is that programmers may not be aware of this and existing applications may not fit...
To be Done
suppress the STRICT_ANSI in types.h
- remove the kgi_s_t and kgi_u_t types??