Subject: Re: Access to m68k SR from userland?
To: John P. Wittkoski <jpw@insoft.com>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 06/12/1996 11:23:14
> > I am trying polled data transfers on the SWIM and have to block all
> > interrupts while reading.
> 
> One thing I found useful when I started trying to write code for the ADB
> support that uses the hardware directly: Do the initial work in MacOS. From
> there, you are in supervisor mode all the time and have access to all the
> hardware. The big drawback: Sometimes your code interfers with the MacOS
> itself, which may be  writing to the same chip at the same time if you 
> aren't careful.

Another thing which might work (which I think the early serial port driver
did) is to make a rudimentry driver, probably a new block device driver,
which only impliments (for now) ioctl's (well, plus enough of the
other commands, like open and close, to make the ioctl's work). One
ioctl would write stuff to a register (you pass the data and the address).
Another would read data from a register. You probably could add a pair
which would raise and lower the interrupt level, but that might be dangerous
as the whole interveening time other IO might crap out. Maybe a simple
engine where you pass it a program; write this, wait for that, raise
interrupt levels, restore interrupt levels, etc.

Or maybe an LKM would be good. Run the system in insecure mode (I have
code from current-users which will do this). Load a LKM with your driver.
Have the driver do things. If the machine doesn't crash, but you want
to change the driver, unload the driver, recompile another one, and
reload it.

Take care,

Bill