[Prev][Next][Index][Thread]

Re: more newbie questions...



Lo and Behold, Ramon van Handel said:
> 
> Have you ever considered porting VSTA drivers ?

   I wasn't actually around when the decision was made about which
sets of drivers to borrow from.  Someone else may have a clue here.

> Though not always as effieicnt as linux/*BSD drivers, I do
> often find them inspiring if I need some example driver
> code beside specs, and don't feel like wading though tremendous
> piles of unreadable linux driver code (I'm very tempted to say
> 'mess' :)).
> For a floppy, I guess performance wouldn't matter very much
> anyway...

  Probably not.

> I'd be willing to have a go at it, but I've never actually
> written anything that works with the OSKit.  What does porting
> a driver to the OSKit involve ?

   Basically, you have to write glue code in two directions for it.
The driver is going to expect a certain environment in which to
execute.  This environment will include things like how to manage
interrupts, get memory, access hardware, etc.  We call this the
"osenv".  You need to write glue code that maps the driver's native
calls (say, "kmalloc") into standard oskit calls like
osenv_mem_alloc(...).  Then, you need to write glue code which turns
standard osenv calls, like oskit_stream_read(...).

   Much of this is discussed in chapter 2, "Execution Environments."
You can also look at the code in places like freebsd/net to see
examples of glue code we've written.

   If you incorporate a driver from a source where we've already done
some encapsulation, you'd likely have to write less glue code, *but*
that depends on the assumptions made by the driver in question.  Some
components, like the FreeBSD network stack, are relatively easy to
encapsulate.  Others, like some of the disk device drivers which Kevin 
managed, took a great deal more work because they had some pretty firm 
assumptions about their interrupt environment/etc.

   For more information on this, you may want to dig up some of the
papers we've published, or read through the docs extensively.  The
list of Flux group papers can be found at:

  http://www.cs.utah.edu/projects/flux/

  (look for some of Kevin and Bryan's papers about user-mode device
drivers for an example of a hard encapsulation job. :-).

   If you haven't really used the oskit yet, then starting out porting 
the floppy driver could be an experience.  I'd get more familiar with
the internal oskit osenv_* functions and the COM interfaces used by
the oskit before jumping head-first, but that's just me.

   -Dave

-- 
work: danderse@cs.utah.edu                     me:  angio@pobox.com
      University of Utah CS Department         http://www.angio.net/
   "If you haul a geek up a crack, you will bloody their fingers for a day...
    If you teach a geek to climb, you will bloody their fingers for life."

Follow-Ups: References: