ProcessorFace.mesa
last edited by Levin on April 21, 1983 11:29 am
Last Edited by: Andrew Birrell, August 8, 1983 10:12 am
DIRECTORY
PrincOps USING [aRCLK, aSETMP, PageCount, PageNumber, zMISC];
ProcessorFace: CEDAR DEFINITIONS =
BEGIN
Initialization
Go: PROC;
Initialize the implementation of ProcessorFace. After Go has been called, all variables in this interface are defined.
InitializeCleanup: PROC;
Tells the implementation of ProcessorFace to use the DeviceCleanup mechanism. In particular, this may cause the GreenwichMeanTime clock to revert to unset when devices get turned off (if there is no hardware one-second clock, for example)
Maintenance panel
SetMP: PROC [CARDINAL] = TRUSTED MACHINE CODE {PrincOps.zMISC, PrincOps.aSETMP};
Set maintenance panel display to given value.
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: TYPE = PRIVATE RECORD [a, b, c: UNSPECIFIED];
processorID: READONLY ProcessorID;
Note: processorID=[0, 0, 0] 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.
Real memory configuration
Some processors may have dedicated real memory not placed in virtual memory at initialization. Various device face implementations will use, and perhaps place into client-provided virtual memory, this real memory.
dedicatedRealMemory: READONLY PrincOps.PageCount;
Amount of dedicated real memory, if any. This may be useful, for example, in allocating secondary storage to hold a snapshot of the processor state. Note: dedicatedRealMemory remains constant independent of whether the dedicated memory is in use or not.
Virtual memory layout
GetNextAvailableVM: PROC [page: PrincOps.PageNumber]
RETURNS [firstPage: PrincOps.PageNumber, count: PrincOps.PageCount];
Return next area of virtual memory, beginning at or after given page, which is available on this processor. Return a count of zero if no such available area exists. The available areas exclude pages used by device face implementations and unimplemented page map entries but not pages allocated in the Principles of Operation (e.g. process data area, AV, SD, GFT).
Greenwich mean time
The Pilot standard is as follows. We adhere to it in the ProcessorFace for compatibility with existing heads or hardware. This is not necessarily the same representation as is used by higher level software. A Greenwich mean time t represents the time which is t-gmtEpoch (mod 2^32) seconds after midnight, 1 January 1968, where gmtEpoch (defined below) is the number of seconds between midnight, 1 January 1968, and midnight, 1 January 1901. This representation was chosen because it assigns the same bit pattern to times as does the Alto time standard for times between 1968 and 2037 but provides an additional 67 years of range. Before operating on Greenwich mean times (e.g. converting to external representation, comparing for other than equality), it is best to convert them to "seconds since epoch", by subtracting gmtEpoch (and disabling any overflow/underflow detection).
GreenwichMeanTime: TYPE = LONG CARDINAL;
gmtEpoch: LONG CARDINAL = 2114294400;
(67years*365daysPerYear+16leapDays)*24hoursPerDay*60minutesPerHour*60secondsPerMinute
GetGreenwichMeanTime: PROC RETURNS [GreenwichMeanTime];
Return the current value of the system's Greenwich mean time clock. This clock runs continuously and, once set, maintains reasonable accuracy. The client is responsible for mutual exclusion on parallel calls of this procedure.
NOTE: If the clock has not been set, GetGreenwichMeanTime returns gmtEpoch.
SetGreenwichMeanTime: PROC [GreenwichMeanTime];
Set the system's Greenwich mean time clock to the given value.
Interval time
The interval timer is 32 bits long, and is incremented by one at a constant rate, but this rate may vary from processor to processor. It should be somewhere between 104/second and 106/second, so that reasonable assumptions about precision and period may be made by timing software. The interval timer is considered to be unsigned, so one may measure an interval up to 2^32 pulses simply by subtracting initial from final timer reading, disabling any overflow/underflow detection.
GetClockPulses: PROC RETURNS [LONG CARDINAL] = TRUSTED MACHINE CODE
{PrincOps.zMISC, PrincOps.aRCLK};
Return the current value of the interval timer.
microsecondsPerHundredPulses: READONLY CARDINAL; -- max error is .33%
Naked notifies
reservedNakedNotifyMask: READONLY WORD;
A bit-mask with a one in each position corresponding to a naked-notify "channel" used for some private purpose below the Principles of Operation and therefore not available to normal programs.
Condition variable time
A timeout value may be specified for any condition variable, in units of "ticks". The size of a tick should be between about 15 and 50 milliseconds.
millisecondsPerTick: READONLY CARDINAL;
Booting and power control
BootButton: PROC;
Simulate pressing the processor "boot button".
PowerOff: PROC;
If the processor is suitably equipped, turn off electrical power to the system. On processors not equipped with a power control relay, this may be implemented as disabling interrupts, turning off devices using DeviceCleanup.Perform[turnOff], and spinning.
SetAutomaticPowerOn: PROC [gmt: GreenwichMeanTime, externalEvent: BOOLEAN];
If the processor is suitably equipped, cause system electrical power to be turned on at or after the given time: if externalEvent is FALSE, turn power on at the given time; if externalEvent is TRUE, turn power on in response to the first external event occurring after the given time. On processors not equipped with an independently powered alarm clock connected to a power control relay, this may be implemented by causing a subsequent PowerOff to wait for the appropriate condition and then execute BootButton.
ResetAutomaticPowerOn: PROC;
Cancel a previous SetAutomaticPowerOn.
END.