MBStorageImpl.mesa
Edited by Levin on May 13, 1983 4:58 pm
DIRECTORY
MBStorage USING [],
PrincOpsUtils USING [WordsToPages],
Space USING [
Create, Delete, GetHandle, Handle, LongPointer, Map, mds, PageFromLongPointer, Pointer, virtualMemory];
MBStorageImpl: PROGRAM
IMPORTS Space, PrincOpsUtils
EXPORTS MBStorage =
BEGIN
Pages: PUBLIC PROC [npages: CARDINAL] RETURNS [base: LONG POINTER] = {
space: Space.Handle = Space.Create[npages, Space.virtualMemory];
Space.Map[space];
RETURN[Space.LongPointer[space]]
};
MDSPages: PUBLIC PROC [npages: CARDINAL] RETURNS [base: POINTER] = {
space: Space.Handle = Space.Create[npages, Space.mds];
Space.Map[space];
RETURN[Space.Pointer[space]]
};
Words: PUBLIC PROC [nwords: CARDINAL] RETURNS [base: LONG POINTER] =
{RETURN[Pages[PrincOpsUtils.WordsToPages[nwords]]]};
MDSWords: PUBLIC PROC [nwords: CARDINAL] RETURNS [base: LONG POINTER] =
{RETURN[MDSPages[PrincOpsUtils.WordsToPages[nwords]]]};
FreePages: PUBLIC PROC [base: LONG POINTER] =
{IF base ~= NIL THEN Space.Delete[Space.GetHandle[Space.PageFromLongPointer[base]]]};
FreeMDSPages: PUBLIC PROC [base: POINTER] = {FreePages[LONG[base]]};
FreeWords: PUBLIC PROC [base: LONG POINTER] = {FreePages[base]};
FreeMDSWords: PUBLIC PROC [base: POINTER] = {FreeMDSPages[base]};
END.