-- file GlobalStorage
-- edited by Levin, September 8, 1980 4:37 PM
-- edited by Schroeder, August 23, 1978 2:38 PM
-- edited by Brotz, September 10, 1980 12:16 PM
-- Global Storage Division - the memory czar. This division provides the memory space
-- needed by other divisions by interfacing with the Mesa runtime storage allocator.
DIRECTORY
ControlDefs: FROM "ControlDefs",
FrameDefs: FROM "FrameDefs",
FrameOps: FROM "FrameOps",
gsD: FROM "GlobalStorageDefs",
SegmentDefs: FROM "SegmentDefs",
SystemDefs: FROM "SystemDefs";
GlobalStorage: PROGRAM
IMPORTS FrameDefs, FrameOps, SegmentDefs, SystemDefs
EXPORTS gsD
SHARES gsD =
PUBLIC BEGIN
OPEN gsD;
flusherEnabled: BOOLEAN ← TRUE;
GetMemoryPages: PROCEDURE [numPages: CARDINAL] RETURNS [mp: MemoryPagePtr] =
-- Obtains numPages contiguous memory page and returns a pointer to the start of these
-- pages to the caller.
BEGIN
mp ← SystemDefs.AllocateResidentPages[numPages];
SegmentDefs.VMtoDataSegment[mp].type ← gsD.storageType;
END; -- of GetMemoryPages --
ReturnMemoryPages: PROCEDURE [numPages: CARDINAL, page: MemoryPagePtr] =
-- Accepts the memory pages back into the storage pool.
BEGIN
SystemDefs.FreePages[page];
END; -- of ReturnMemoryPages --
FlushCodeSegments: PROCEDURE =
BEGIN
ClearItOut: PROCEDURE [gFH: ControlDefs.GlobalFrameHandle] RETURNS [BOOLEAN] =
BEGIN
IF FrameOps.CodeHandle[gFH].lock = 0 THEN FrameDefs.SwapOutCode[gFH];
RETURN [FALSE];
END; -- of ClearItOut --
IF flusherEnabled THEN [] ← FrameDefs.EnumerateGlobalFrames[ClearItOut];
END; -- FlushCodeSegments --
DisableFlusher: PROCEDURE = {flusherEnabled ← FALSE};
EnableFlusher: PROCEDURE = {flusherEnabled ← TRUE};
END. -- of GlobalStorage --