Device Driver For Developers and Hackers

John Macdonald jmm at eci386.uucp
Thu Feb 14 00:46:40 AEST 1991


In article <1991Feb1.184009.2624 at tc.fluke.COM> vince at tc.fluke.COM (Craig Johnson) writes:
 [...]
|By the way, can anyone tell me the purpose of the subyte() and fubyte()
|calls in the vidram driver?  They appear to simply move a byte at a time
|in/out of the "u" user structure.  Why can't the data in the user
|structure be accessed directly like the other elements of the structure?

I apologize if I'm telling people something they already know,
especially since I haven't ever looked at the vidram driver or
any other 3b1 driver, but here goes anyway.  In other Unix kernels
that I have worked on, fubyte and subyte are used to fetch and
store a byte of data from/to the user address space.  They are
provided as routines (possibly macros) to allow enclosing the
access in protection code that will catch addressing faults without
causing a kernel panic.  Usually the user structure does not need
such protection however, unless it gets paged out to the swap area
along with the rest of the process's data (I think that this is
handled differently in different Unix implementations).  If the
driver is responding to an interrupt, then it has to allow for
the possibility that the process that it is working for might have
been swapped out.
-- 
Cure the common code...                      | John Macdonald
...Ban Basic      - Christine Linge          |   jmm at eci386



More information about the Comp.sys.3b1 mailing list