-- RTOS.Mesa: An internal Cedar system interface
-- last edited January 12, 1983 2:34 pm by Paul Rovner
DIRECTORY
File USING[Capability],
Inline USING[HighHalf],
Mopcodes USING[zLADRB],
PrincOps USING[GlobalFrameHandle, FrameHandle, EPRange],
ProcessOperations USING[HandleToIndex, ReadPSB],
PSB USING[PsbIndex],
RTBasic USING[Address],
RTQuanta USING[QuantumCount, QuantumIndex],
Space USING[Handle];
RTOS: DEFINITIONS IMPORTS Inline, ProcessOperations
= BEGIN OPEN PrincOps, RTQuanta;
-- TYPEs
EVRange: TYPE = [0..4*EPRange);
-- SIGNALs
InsufficientVM: SIGNAL;
FrameCopySpaceTooSmall: SIGNAL;
TooManyCedarProcesses: SIGNAL;
-- variables
PermanentPageZone: UNCOUNTED ZONE;
-- use instead of GetPermanentDataPages if ZONE syntax is desired
FreeableSpaceZone: UNCOUNTED ZONE;
-- use instead of GetDataPagesFromNewSpace if ZONE syntax is desired
PrivateHeapZone: UNCOUNTED ZONE;
-- PROCs for the conservative scan
SnapshotTheFrameHeap: PROC;
AllocateFrameBodyBuffer: PROC[nPages: CARDINAL];
MapRCFrameBodies: PROC[conservativeScanner:
PROC[pa: LONG POINTER TO RTBasic.Address,
nWords: CARDINAL]];
RegisterFrameChains: PROC[d: DESCRIPTOR FOR ARRAY OF POINTER TO FrameHandle];
UnregisterFrameChains: PROC[d: DESCRIPTOR FOR ARRAY OF POINTER TO FrameHandle];
-- PROCs for module replacement
CheckForModuleReplacement: PROC[gfh: GlobalFrameHandle] RETURNS[ok: BOOLEAN];
-- PROCs for wholesale space management
GetPermanentDataPages: PROC[nPages: CARDINAL, createUniformSwapUnits: BOOLEAN ← TRUE]
RETURNS[LONG POINTER];
GetCollectibleQuanta: PROC[desired, needed: QuantumCount]
RETURNS[qi: QuantumIndex, qc: QuantumCount];
GetDataPagesFromNewSpace: PROC[nPages: CARDINAL,
createUniformSwapUnits: BOOLEAN ← TRUE]
RETURNS[LONG POINTER];
GetQuantaFromNewSpace: PROC[nQ: QuantumCount,
createUniformSwapUnits: BOOLEAN ← TRUE]
RETURNS[QuantumIndex];
GetDataPagesForGCTables: PROC RETURNS[LONG POINTER];
SpaceInCedarVM: PROC[sh: Space.Handle] RETURNS[BOOLEAN];
EstablishCedarVMFile: PROC[fc: File.Capability];
DeleteSpace: PROC[space: Space.Handle];
UnRavelUSUs: PROC[space: Space.Handle] RETURNS[Space.Handle];
-- PROCs for startup
NotifyAllocatorReady: PROC;
IsAllocatorReady: PROC RETURNS[BOOLEAN];
RTProcessStarted: PROC;
-- PROCs for dealing with frames
EnumerateGlobalFrames: PROC[proc: PROC[GlobalFrameHandle] RETURNS[BOOLEAN]]
RETURNS[GlobalFrameHandle];
FindEnclosingGFH: PROC[ptr: POINTER] RETURNS[GlobalFrameHandle];
-- PROCs for dealing with processes
End: PROC; -- modified version from Processes, for Cedar process registration.
UnregisterCedarProcess: PROC[psbi: PSB.PsbIndex];
RegisterCedarProcess: PROC[psbi: PSB.PsbIndex];
-- Engine room goodies
MyLocalFrame: PROC RETURNS[FrameHandle] = MACHINE CODE{Mopcodes.zLADRB, 0};
InMDS: PROC[p: RTBasic.Address] RETURNS[BOOLEAN] =
INLINE {i: CARDINAL; -- dummy for use with @ to get the MDS address
RETURN[(p=0) OR (Inline.HighHalf[p] = Inline.HighHalf[LONG[@i]])]};
SameCode: PROC [f1, f2: GlobalFrameHandle] RETURNS [cm: CodeMatch];
CodeMatch: TYPE = {identical, same, different};
GetCurrent: PROC RETURNS[PSB.PsbIndex] =
INLINE {RETURN[ProcessOperations.HandleToIndex[ProcessOperations.ReadPSB[]]]};
END.