ProcessorFaceImpl.mesa
Copyright Ó 1985, 1986, 1991 by Xerox Corporation. All rights reserved.
JKF August 24, 1988 5:16:16 pm PDT
Carl Hauser, September 6, 1988 4:33:06 pm PDT
Willie-s, August 1, 1991 5:19 pm PDT
DIRECTORY
AtomPrivate USING [UnsafeMakeAtomFromString],
ProcessorFace USING [ProcessorID, ProcessorType];
ProcessorFaceImpl: CEDAR PROGRAM
IMPORTS AtomPrivate
EXPORTS ProcessorFace
= BEGIN
Processor ID
At any moment in time, no two processors will have the same processor id. The processor id remains constant as long as a system element remains running, but may change across system restarts. Programs should make no assumptions about the structure of a processor id.
processorID: PUBLIC ProcessorFace.ProcessorID = GetProcessorID[];
Note: processorID=NullProcessorID indicates that the processor has not had a unique processor id assigned. This is likely to prevent many client systems (e.g. Pilot) from running.
GetProcessorID: PRIVATE PROC RETURNS [processorID: ProcessorFace.ProcessorID]
~ TRUSTED {
GetProcessorIDInner: PROC [pid: POINTER TO ProcessorFace.ProcessorID] =
TRUSTED MACHINE CODE {
"+extern void XR←getxnshostid();.XR←getxnshostid"
};
GetProcessorIDInner[@processorID];
};
GetProcessorType: PUBLIC PROC RETURNS [ProcessorFace.ProcessorType] = TRUSTED {
Doit: PROC [] RETURNS [ProcessorFace.ProcessorType] ~ TRUSTED MACHINE CODE {
"XR←GetProcessorType"
};
RETURN[ Doit[] ];
};
decAtom, rs6000Atom, sun3Atom, sun4Atom, unknownAtom: ATOM;
lastProcessorType: ProcessorFace.ProcessorType ~ decstation;
GetProcessorTypeName: PUBLIC PROC [type: ProcessorFace.ProcessorType]
RETURNS [ATOM] = {
SELECT type FROM
sun3 => RETURN [sun3Atom];
sun4 => RETURN [sun4Atom];
rs6000 => RETURN [rs6000Atom];
decstation => RETURN [decAtom];
ENDCASE => RETURN [unknownAtom];
};
ProcessorTypeFromName: PUBLIC PROC [name: ATOM] RETURNS [ProcessorFace.ProcessorType] = {
SELECT name FROM
sun3Atom => RETURN [sun3];
sun4Atom => RETURN [sun4];
rs6000Atom => RETURN [rs6000];
decAtom => RETURN [decstation];
ENDCASE => RETURN [LAST[ProcessorFace.ProcessorType]];
};
LastProcessorType: PUBLIC PROC RETURNS[ProcessorFace.ProcessorType] ~
{ RETURN[lastProcessorType] };
TRUSTED {
decAtom ¬ AtomPrivate.UnsafeMakeAtomFromString["decstation"];
rs6000Atom ¬ AtomPrivate.UnsafeMakeAtomFromString["rs6000"];
sun3Atom ¬ AtomPrivate.UnsafeMakeAtomFromString["sun3"];
sun4Atom ¬ AtomPrivate.UnsafeMakeAtomFromString["sun4"];
unknownAtom ¬ AtomPrivate.UnsafeMakeAtomFromString["unknown"];
};
END.