BEGIN
Basic parameters and types:
wordsPerPage: CARDINAL = VM.wordsPerPage;
PageNumber: TYPE = VM.PageNumber;
PageCount: TYPE = VM.PageCount;
PageOffset: TYPE = VM.PageCount;
Interval: TYPE = RECORD [pointer: LONG POINTER, count: VM.PageCount];
nullInterval: Interval = [pointer: NIL, count: 0];
Access: TYPE = {readWrite, readOnly};
Life: TYPE = {alive, dead};
Usage: TYPE = [0..2048);
unknownUsage: Usage = 0;
ScratchMap:
PROCEDURE [count: VM.PageCount, usage: Usage ← unknownUsage]
RETURNS [pointer:
LONG
POINTER];
Unmap:
PROCEDURE [pointer:
LONG
POINTER, returnWait: ReturnWait ← wait]
RETURNS [nil: LONG POINTER];
ReturnWait: TYPE = {return, wait};
Swapping commands:
Activate: PROCEDURE [interval: Interval];
ActivateProc: PROCEDURE [proc: --GENERIC-- PROCEDURE];
Deactivate: PROCEDURE [interval: Interval];
DeactivateProc: PROCEDURE [proc: --GENERIC-- PROCEDURE];
ForceOut: PROCEDURE [interval: Interval];
Kill: PROCEDURE [interval: Interval];
Access control:
SetAccess: PROCEDURE [interval: Interval, access: Access];
MakeReadOnly:
PROCEDURE [interval: Interval] =
INLINE {
SetAccess[interval, readOnly]};
MakeWritable:
PROCEDURE [interval: Interval] =
INLINE {
SetAccess[interval, readWrite]};
Explicit virtual memory allocation and management:
Allocate: PROCEDURE [count: VM.PageCount] RETURNS [interval: Interval];
Deallocate: PROCEDURE [interval: Interval];
Miscellaneous operations:
LongPointerFromPage:
PROCEDURE [page: VM.PageNumber]
RETURNS [LONG POINTER] = INLINE {
RETURN[VM.AddressForPageNumber[page]]};
PageFromLongPointer:
PROCEDURE [pointer:
LONG
POINTER]
RETURNS [VM.PageNumber] = INLINE {
RETURN[VM.PageNumberForAddress[pointer]]};
PagesFromWords:
PROCEDURE [wordCount:
LONG
CARDINAL]
RETURNS [pageCount: VM.PageCount] = INLINE {
RETURN[
VM.PagesForWords[wordCount]]};
Signals and errors:
Error: ERROR [type: ErrorType];
ErrorType:
TYPE = {
alreadyAllocated, alreadyDeallocated, incompleteSwapUnits, invalidParameters,
invalidProcedure, invalidSwapUnitSize, invalidWindow, stillMapped,
notAllocated, notMapped, noWindow, pointerPastEndOfMemory, readOnly};
InsufficientSpace: ERROR [available: VM.PageCount];
IOError: ERROR [page: VM.PageNumber];
Not provided in Cedar version: Window, Map Class, SwapUnitOption, defaultSwapUnitOption, SwapUnitType, SwapUnitSize, defaultSwapUnitSize, GetMapUnitAttributes, GetSwapUnitAttributes, CopyIn, CopyOut, MDS, defaultBase, MapAt, UnmapAt, Pointer, PointerFromPage
END.
17-Mar-82 17:11:48 DKnutsen Created file from Space.mesa of 8-Aug-81.
12-Aug-82 9:46:08 DKnutsen Twiddles.
23-Aug-82 11:43:17 Luniewski Mods for long page numbers and counts.
24-Nov-82 19:45:02 Luniewski Window.file => File.File.