DIRECTORY Atom, Basics, IO, RefTab, Rope, SoftcardDataExch, SoftcardRemoteCall, SparcSoftcardLoaderOps; SoftcardRemoteCallImpl: CEDAR MONITOR IMPORTS Atom, IO, RefTab, SoftcardDataExch, SparcSoftcardLoaderOps EXPORTS SoftcardRemoteCall ~ BEGIN QUIT: CARD32 _ SoftcardDataExch.QUIT; -- 0 is the type which stops the watch procedure of the SPARC RCALL: CARD32 = SoftcardRemoteCall.RCALL; RREGISTER: CARD32 = SoftcardRemoteCall.RREGISTER; ProcId: TYPE ~ SoftcardRemoteCall.ProcId; ProcDesc: TYPE ~ REF ProcDescRec; ProcDescRec: TYPE ~ RECORD[ad, private: CARD32]; waitForAnswer: BOOLEAN _ FALSE; answerReceived: CONDITION; ReleaseLock: ENTRY PROC ~ { ENABLE UNWIND => NULL; waitForAnswer _ FALSE; BROADCAST answerReceived; }; TakeLock: PROC ~ { WaitForLock[]; waitForAnswer _ TRUE; }; WaitForLock: ENTRY PROC ~ { ENABLE UNWIND => NULL; WHILE waitForAnswer DO WAIT answerReceived ENDLOOP; }; ActionRegister: SoftcardDataExch.ActionProc ~ { keyName: Rope.ROPE; key: ProcId; IF ub.count=0 THEN keyName _ "SoftcardProc" ELSE { ros: IO.STREAM _ IO.ROS[]; IO.UnsafePutBlock[ros, ub]; keyName _ IO.RopeFromROS[ros]; }; key _ Atom.MakeAtom[pName: keyName]; [] _ RefTab.Store[procTable, key, NEW[ProcDescRec _ [ad: data1, private: data2]]] }; ActionCall: SoftcardDataExch.ActionProc ~ { IF data1#pendingRequest THEN Error; result _ data2; ReleaseLock[]; }; UnknownProc: PUBLIC ERROR ~ CODE; Error: ERROR ~ CODE; --probably an unconsistency between the SPARC and 6085 sides CallRProc: PUBLIC PROC[procId: ProcId, argsByteSize: CARD32, putArgs: PROC [ub: Basics.UnsafeBlock] _ NIL] RETURNS [r: CARD32] ~ { DoPutArgs: SoftcardDataExch.PutProc ~ { putArgs[ub]; RETURN[ub.count]; }; addr: CARD32 _ NARROW[RefTab.Fetch[procTable, procId].val, ProcDesc].ad; TakeLock[]; pendingRequest _ pendingRequest+1; SoftcardDataExch.PutPacket[RCALL, addr, pendingRequest, argsByteSize, DoPutArgs]; WaitForLock[]; RETURN[result]; }; RopeFromUnsafeBlock: PUBLIC PROC[ub: Basics.UnsafeBlock] RETURNS [r: Rope.ROPE] ~ { ros: IO.STREAM _ IO.ROS[]; IO.UnsafePutBlock[ros, ub]; r _ IO.RopeFromROS[ros]; }; Reset: PROC[inputFile: IO.STREAM] ~ { procTable _ RefTab.Create[]; ReleaseLock[]; }; procTable: RefTab.Ref; pendingRequest: CARD32; result: CARD32; SoftcardDataExch.Register[RCALL, ActionCall]; SoftcardDataExch.Register[RREGISTER, ActionRegister]; SparcSoftcardLoaderOps.RegisterStartProc[$SparcRemoteCall, Reset]; END. vSoftcardRemoteCallImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. written by Ch. Le Cocq, August 4, 1988 Christian Le Cocq December 5, 1988 4:22:47 pm PST Christophe Cuenod September 12, 1988 5:59:56 pm PDT Description of what this module does. Utilities ActionProcs PROC[ub: Basics.UnsafeBlock, type, data1, data2: CARD32]; Public Procs Κ˜code•Mark outsideHeaderšœ™Kšœ<™