-- StartList.mesa Modified by: Sandman, February 23, 1981 11:02 AM

-- The boot file is composed of a sequence of Spaces. Each Space may be unused ("empty"), or may contain code and/or data. A non-empty Space may be tiled with swap units - small Spaces which define the units of swapping - and is called a "family", or it may be unitary ("space"). Unitary Spaces and swap units may be pinned into memory ("resident"), may require that their Space and Region Descriptors be pinned into their caches ("residentDescriptor"), or may be unrestricted ("swappable"). In addition, any unitary Space or swap unit may be in the set loaded by the Pilot Boot Loader ("bootLoaded").

StartList: DEFINITIONS =
BEGIN

VersionID: CARDINAL = 23021;

Limit: CARDINAL = 37777B;
Base: TYPE = BASE POINTER TO Header;
Index: TYPE = Base RELATIVE POINTER [0..Limit] TO Entry;
StartIndex: Index = LOOPHOLE[SIZE[Header]];
NullIndex: Index = FIRST[Index];
SpaceIndex: TYPE = Base RELATIVE POINTER [0..Limit] TO space Entry;
NullSpaceIndex: SpaceIndex = LOOPHOLE[NullIndex];
SwapUnitIndex: TYPE = Base RELATIVE POINTER [0..Limit] TO swapUnit Entry;
NullSwapUnitIndex: SwapUnitIndex = LOOPHOLE[NullIndex];

Switches: TYPE = RECORD [a,b,c,d: CARDINAL];

StateVectorCounts: TYPE = ARRAY --Process.Priority-- [0..8) OF CARDINAL;

BootLocation: TYPE = --Boot.Location-- ARRAY [0..11) OF WORD;

Header: TYPE = MACHINE DEPENDENT RECORD [
version(0): CARDINAL,
table(1): Base,
-- origin of the script table
loadState(2): SwapUnitIndex,
initLoadState(3): SwapUnitIndex,
mdsBase(4): --Environment.PageNumber-- CARDINAL,
pdaBase(5): --Environment.PageNumber-- CARDINAL,
pdaPages(6): --Environment.PageCount-- CARDINAL,
lastVMPage(7): --Environment.PageNumber-- CARDINAL,
lastBootLoadedPage(10B): --Environment.PageNumber-- CARDINAL,
stateVectorCounts(11B): StateVectorCounts,
switches(21B): Switches,
locDebuggerMicrocode(25B): BootLocation,
locDebuggerGerm(40B): BootLocation,
locDebugger(53B): BootLocation,
locDebuggee(66B): BootLocation,
stateVectorSize(101B): CARDINAL,
nProcesses(102B): CARDINAL];

EntryType: TYPE = {space, swapUnit, stop};
SpaceClass: TYPE = {empty, unitary, family};
SwapUnitState: TYPE = {resident, residentDescriptor, swappable};

SwapUnitInfo: TYPE = MACHINE DEPENDENT RECORD [
readOnly(0:0..0): BOOLEAN,
state(0:1..2): SwapUnitState];

SpaceType: TYPE = MACHINE DEPENDENT RECORD [
body(0): SELECT class(0:0..1): SpaceClass FROM
empty => [fill(0:2..17B): Index ← NullIndex], -- an unused Space
unitary => -- a Space with no swap units.
[swapUnit(0:2..17B): SwapUnitIndex], -- (only swapUnit.info is significant.)
family => [ -- a Space tiled with swap units.
anyResidentChildren(0:2..2): BOOLEAN,
anyResidentDescriptorChildren(0:3..3): BOOLEAN,
anySwappableChildren(0:4..4): BOOLEAN,
allResidentChildren(0:5..5): BOOLEAN,
allResidentDescriptorChildren(0:6..6): BOOLEAN,
allSwappableChildren(0:7..17B): BOOLEAN],
ENDCASE];

BackingLocation: TYPE = {null, self};
SHandle: TYPE[2];

Entry: TYPE = MACHINE DEPENDENT RECORD [
body(0): SELECT option(0:0..1): EntryType FROM
space => [
readOnly(0:2..2): BOOLEAN,
bootLoaded(0:3..16B): BOOLEAN,
backingStore(0:17B..17B): BackingLocation,
type(1): SpaceType,
pages(2): --Environment.PageCount-- CARDINAL,
vmpage(3): --Environment.PageNumber-- CARDINAL,
backingPage(4): --LowHalf[File.PageNumber]-- CARDINAL,
handle(5): SHandle], -- this uninitialized field is provided for Pilot’s convenience.
swapUnit => [
info(0:2..17B): SwapUnitInfo,
parent(1): SpaceIndex,
base(2): --Environment.PageOffset-- CARDINAL, -- relative to parent.vmpage.
pages(3): --Environment.PageCount-- CARDINAL],
stop => [fill(0:2..17B): Index ← NullIndex], -- terminates the Start List.
ENDCASE];

END..