-- Space.mesa (last edited by: Levin on: August 25, 1982 9:55 am) DIRECTORY Environment USING [PageCount, PageNumber, PageOffset, wordsPerPage], File USING [Capability, nullCapability, PageNumber], Transaction USING [Handle, nullHandle]; Space: DEFINITIONS IMPORTS Transaction = BEGIN -- Spaces and space handles wordsPerPage: CARDINAL = Environment.wordsPerPage; PageCount: TYPE = Environment.PageCount; PageNumber: TYPE = Environment.PageNumber; PageOffset: TYPE = Environment.PageOffset; Handle: TYPE [2]; nullHandle: READONLY Handle; mds: READONLY Handle; virtualMemory: READONLY Handle; -- Creating and deleting spaces defaultBase: PageOffset = LAST[PageOffset]; Create: PROC [size: PageCount, parent: Handle, base: PageOffset ← defaultBase] RETURNS [newSpace: Handle]; CreateUniformSwapUnits: PROC [size: PageCount ← 1, parent: Handle]; Delete: PROC [space: Handle]; DeleteSwapUnits: PROC [space: Handle]; -- Mapping spaces WindowOrigin: TYPE = RECORD [file: File.Capability, base: File.PageNumber]; defaultWindow: WindowOrigin = [File.nullCapability, 0]; CopyIn: PROC [ space: Handle, window: WindowOrigin, transaction: Transaction.Handle ← Transaction.nullHandle]; CopyOut: PROC [ space: Handle, window: WindowOrigin, transaction: Transaction.Handle ← Transaction.nullHandle]; MakeReadOnly: PROC [ space: Handle, transaction: Transaction.Handle ← Transaction.nullHandle]; MakeWritable: PROC [ space: Handle, file: File.Capability, transaction: Transaction.Handle ← Transaction.nullHandle]; Map: PROC [space: Handle, window: WindowOrigin ← defaultWindow, transaction: Transaction.Handle ← Transaction.nullHandle]; Remap: PROC [space: Handle, window: WindowOrigin ← defaultWindow, transaction: Transaction.Handle ← Transaction.nullHandle]; Unmap: PROC [space: Handle]; -- Swapping commands Activate: SAFE PROC [space: Handle]; Deactivate: SAFE PROC [space: Handle]; ForceOut: PROC [space: Handle]; Kill: PROC [space: Handle]; -- Miscellaneous operations GetAttributes: SAFE PROC [space: Handle] RETURNS [ parent, lowestChild, nextSibling: Handle, base: PageOffset, size: PageCount, mapped: BOOLEAN]; GetHandle: SAFE PROC [page: PageNumber] RETURNS [Handle]; GetWindow: SAFE PROC [space: Handle] RETURNS [WindowOrigin]; LongPointer: SAFE PROC [space: Handle] RETURNS [LONG POINTER]; LongPointerFromPage: SAFE PROC [page: PageNumber] RETURNS [LONG POINTER]; MDS: SAFE PROC RETURNS [Handle] = CHECKED INLINE {RETURN[mds]}; PageFromLongPointer: SAFE PROC [lp: LONG POINTER] RETURNS [page: PageNumber]; Pointer: SAFE PROC [space: Handle] RETURNS [POINTER]; VMPageNumber: SAFE PROC [space: Handle] RETURNS [PageNumber]; -- Signals and errors Error: ERROR [type: ErrorType]; ErrorType: TYPE = { invalidHandle, invalidMappingOperation, invalidParameters, invalidWindow, noWindow, notApplicableToSwapUnit, spaceNotUnitary, spaceTreeTooDeep, writeProtected}; InsufficientSpace: ERROR [available: PageCount]; END. LOG Time: March 15, 1978 10:06 AM By: McJones Action: Created file Time: September 14, 1978 10:46 AM By: Lauer Action: Added LongPointerFromPage, PageFromLongPointer Time: March 7, 1979 10:16 AM By: McJones Action: Eliminated dependence on SpaceInternal; added MakeReadOnly, defaults Time: July 19, 1979 11:03 AM By: McJones Action: Added uniform swap units; deleted AddressFault, InsufficientPermissions Time: January 25, 1980 1:27 PM By: Knutsen Action: Added ErrorType[spaceNotUnitary, writeProtected] Time: March 31, 1980 4:25 PM By: Gobbel Action: Added transaction machinery Time: August 5, 1980 11:41 AM By: McJones Action: Modified transaction machinery Time: August 25, 1982 9:55 am By: Levin Action: Make things SAFE.