Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!eacj From: eacj@batcomputer.tn.cornell.edu (Julian Vrieslander) Newsgroups: comp.sys.mac.programmer Subject: If Apple implements user mode, how will we do uninterrupted I/O? Keywords: user mode interrupt Message-ID: <8538@batcomputer.tn.cornell.edu> Date: 2 Aug 89 02:11:22 GMT Reply-To: eacj@tcgould.tn.cornell.edu (Julian Vrieslander) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 45 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." This may be putting me in a real quandary, and it may be bad news for a lot of other people who are writing hardware interfacing code. 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. It may be impossible to implement these routines with interrupt-driven code, since the interval between service requests could be as little as 5 microseconds. And an interrupt by someone else's code (like a VBL task) could cause me to miss some data. Note that the applications that I am working on (waveform synthesis and precision event timing) are quite common jobs for laboratory microcomputers. And remember that general purpose data acquistion boards do not have much buffering or on-card intelligence. So there are lots of other folks out there who are writing code that temporarily disables interrupts. The following questions should be of interest to all of them: What does Apple really mean when they say that the interrupt mask may become inaccessible in some future System version, or on some future Mac? My reading of the Motorola manuals indicates that applications running in user mode will not be able to directly modify the interrupt mask in the status register of a 680xx CPU. If applications must run in user mode, will Apple provide a trap (or another mechanism) that will allow an application to disable interrupts? 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). But this hardware is quite machine dependent - different Mac models have either 1 or 2 VIA chips, in different memory locations, and with different register bit mappings. So the code would have to special case each computer that it runs on, and might break on a future model. Perhaps I am overlooking something obvious (wouldn't be the first time), but I don't see a clean solution to this problem. -- Julian Vrieslander Neurobiology & Behavior, W250 Mudd Hall, Cornell University, Ithaca NY 14853 UUCP: {cmcl2,decvax,rochester,uw-beaver}!cornell!batcomputer!eacj INTERNET: eacj@tcgould.tn.cornell.edu BITNET: eacj@CRNLTHRY