BootStartListImpl.mesa
last edited by Levin on June 20, 1983 4:52 pm
Last edited by Andrew Birrell on April 20, 1983 6:41 pm
DIRECTORY
BootStartList USING [
Base, Entry, EntryPointer, Index, IndexToEntryPointer, IndexToSpaceEntryPointer, Proc, SpaceEntryPointer, startIndex],
PrincOps USING [PageCount, PageNumber],
PrincOpsUtils USING [AddressToPageNumber];
BootStartListImpl: PROGRAM
IMPORTS BootStartList, PrincOpsUtils
EXPORTS BootStartList =
BEGIN
Exports to BootStartList
h: PUBLIC BootStartList.Base;
StartListHasBeenDestroyed: PUBLIC ERROR = CODE;
Enumerate: PUBLIC PROC [proc: BootStartList.Proc] = {
OPEN BootStartList;
index: Index;
size: CARDINAL;
IF h = NIL THEN ERROR StartListHasBeenDestroyed;
FOR index ← startIndex, index + size UNTIL h[index].option = stop DO
IF proc[index] THEN EXIT;
WITH h[index] SELECT FROM
space => size ← SIZE[space Entry];
swapUnit => size ← SIZE[swapUnit Entry];
ENDCASE;
ENDLOOP;
};
Destroy: PUBLIC PROC RETURNS [page: PrincOps.PageNumber, count: PrincOps.PageCount] = {
OPEN BootStartList;
FindSwapUnit: Proc = {
entry: EntryPointer = IndexToEntryPointer[index];
WITH e: entry SELECT FROM
space => NULL;
swapUnit => {
parent: SpaceEntryPointer = IndexToSpaceEntryPointer[e.parent];
IF page = parent.vmPage + e.base THEN
{count ← e.pages; RETURN[TRUE]};
};
ENDCASE;
};
IF h = NIL THEN RETURN;
page ← PrincOpsUtils.AddressToPageNumber[h];
Enumerate[FindSwapUnit];
h ← NIL;
};
Initialization
Initialize: PUBLIC PROC [header: BootStartList.Base] = {
h ← header;
};
END.