DeviceCleanup: DEFINITIONS = BEGIN Reason: TYPE = MACHINE DEPENDENT { turnOff(0) , -- stop fetches to memory other than to controller status block turnOn, -- inverse of turnOff disconnect, -- release resources e.g. special real memory in preparation for booting new system kill, -- prepare for demise of controller microcode (255) }; Item: TYPE [2]; Linkage: PRIVATE TYPE = RECORD [ Await: PROC [POINTER TO Item] RETURNS [Reason], Perform: PROC [Reason] ]; linkage: PRIVATE Linkage; Await: PROC [pItem: POINTER TO Item] RETURNS [Reason] = INLINE { RETURN[linkage.Await[pItem]] }; Perform: PROC [reason: Reason] = INLINE { linkage.Perform[reason] }; InitializeDeviceCleanup: PRIVATE PROC; -- called early on from DebugNub END. ^DeviceCleanup.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Andrew Birrell May 25, 1983 6:18 pm Russ Atkinson (RRA) January 29, 1985 0:42:02 am PST Doug Wyatt, February 26, 1985 5:18:32 pm PST Provides the mechanism for turning devices on/off across germ swaps. The following example illustrates how to use this interface: InitializeSampleCleanup: PROC [] = { item: DeviceCleanup.Item; reason: DeviceCleanup.Reason; Following code loops forever - must not call other procedures except INLINE, fixed frame DO reason _ DeviceCleanup.Await[@item]; SELECT reason FROM turnOff => ; turnOn => ; disconnect => ; kill => ; ENDCASE => NULL ENDLOOP }; Wait until next execution of Perform Execute each waiting cleanup procedure, passing given reason. Interrupts should have been previously disabled. Κ˜codešœ™Kšœ Οmœ1™