Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: If Apple implements user mode, how will we do uninterrupted I/O? Message-ID: <8213@hoptoad.uucp> Date: 2 Aug 89 20:55:04 GMT References: <8538@batcomputer.tn.cornell.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 42 In article <8538@batcomputer.tn.cornell.edu> eacj@tcgould.tn.cornell.edu (Julian Vrieslander) writes: >Tech Note #85 says that we should not disable interrupts from within an >application. There is an ominous admonition that "there will come a time >... when you won't be able to change the interrupt mask because the >processor is running in user mode." > >I have been writing software to drive a data acquisition card sitting on >the Nubus in a Mac II. But my application requires the CPU to do high >speed uninterrupted polling of the card, sometimes for several seconds at >a time. I'm sure drivers will not be made to run in user mode; they will run in supervisor mode. Only applications (and possibly the user-interface drivers known as desk accessories) will be moved into user mode. Drivers need to have direct access to the hardware, device registers, interrupt mask, and all. So the answer to your problem is to move your i/o code out of your application and move it into a driver which is called by your application. This is a cleaner and more modular design anyway. Probably this should be in your Read routine, but possibly that won't be general enough for your needs. If so, you can always put it into your Control routine. >If applications must run in user mode, >will Apple provide a trap (or another mechanism) that will allow an >application to disable interrupts? Almost certainly not. >If not, what is the recommended way of doing uninterrupted I/O? I believe >that it is possible to turn off individual interrupt sources by flipping >bits in the Interrupt Enable registers of the VIA chip(s). A user-mode OS will likely also be a memory-protected OS, and user mode software will not have the device addressing spaces mapped into their address spaces. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Jesus died for somebody's sins, but not mine." -- Patti Smith