Cedar Nucleus: Layout of bootfiles.
BootFile.mesa
Andrew Birrell April 29, 1983 4:11 pm
DIRECTORY
PrincOps USING [ControlLink, FrameHandle, InterimPageState, PageCount--, PageNumber--],
DiskFace USING [FileID, Type, DontCare, wordsPerPage];
BootFile: DEFINITIONS =
BEGIN
currentVersion: CARDINAL = 101;
for boot files written using these definitions (see Header below)
Location: TYPE = MACHINE DEPENDENT RECORD[
deviceType(0): DiskFace.Type,
deviceOrdinal(1): CARDINAL,
vp(2): SELECT OVERLAID * FROM
disk => [ diskFileID(2): DiskFileID],
ethernet => [bootFileNumber(2): CARDINAL, net(3), host(4): CARDINAL ← 0],
any => [ a(2), b(3), c(4), d(5), e(6), f(7), g(10B), h(11B): UNSPECIFIED ],
ENDCASE
];
DiskFileID: TYPE = MACHINE DEPENDENT RECORD[
Identification of a boot file for loading it.
fID: DiskFace.FileID,-- for disk label --
firstPage: INT,-- for disk label --
firstLink: DiskFace.DontCare--initial boot chain link--
];
nullLink: DiskFace.DontCare = LOOPHOLE[LONG[0]];
Commentary:
A boot file is intended to capture the state of real memory and the relevant processor registers, most notably the map. It consists of a Header page followed by one or more data pages, followed by zero or more groups each consisting of a Trailer page followed by one or more data pages. Each Header or Trailer page assigns virtual and real addresses and flag bits to the accompanying data pages. The Header page contains some additional global state.
Assertion: if Entry[p, v] precedes Entry[p', v'] in a boot file, then p is less than (and not equal to) p'.
If a boot file does NOT contain an entry for a given page, that page is understood to be vacant.
There are two variations of boot files, corresponding to whether the captured state is a snapshot of a running program or has been fabricated with "bit tweezers". In the former case (resumptive Continuation), some process is waiting on the BootSwap.pMon.condResponse condition variable. In the latter case (initial Continuation), a distinguished PSB is made ready to xfer to a given control link and the BootSwapGerm waits.
There is an additional distinction depending on whether the inLoadMode of a boot file is load or resume.
An inLoadMode=load signifies that the program captured in the boot file does not care into which real pages it is loaded. In this case InLoad expects all real memory to be mapped to an initial prefix of virtual memory; it leaves all excess real memory mapped immediately following the last virtual page it loads. (Thus those virtual pages between ones which are loaded are set vacant.)
An inLoadMode=restore signifies that the program captured in the boot file expects to be reloaded into the real pages specified in the boot file.
With either inLoadMode, the flags (W, D, R) of the loaded pages are set to the values specified in the boot file.
To be distributed via the current ethernet boot servers, one of these boot files would have to be "encapsulated" by preceding it with a dummy page containing an appropriate timestamp.
Header: TYPE = MACHINE DEPENDENT RECORD [ -- first page of boot file
version(0): CARDINAL ← currentVersion,
creationDate(1): LONG CARDINAL, -- System.GreenwichMeanTime
pStartListHeader(3): POINTER, -- when continuation kind=initial (relative to that mds)
inLoadMode(4): InLoadMode,
continuation(5): Continuation,
countData(7): CARDINAL, -- number of nonvacant pages (not counting germ)
entries(10B): ARRAY [0..0) OF Entry];
Trailer: TYPE = MACHINE DEPENDENT RECORD [ -- entry table after exhausting "Header"
version(0): CARDINAL ← currentVersion,
entries(1): ARRAY [0..0) OF Entry];
InLoadMode: TYPE = {load, restore};
Continuation: TYPE = MACHINE DEPENDENT RECORD [
vp(0): SELECT kind(0:0..7): ContinuationKind FROM
initial => [
mdsi(0:8..15): MDSIndex,
destination(1): PrincOps.ControlLink],
resumptive => [
mdsi(0:8..15): MDSIndex -- for WriteMDS hack --,
resumee(1): PrincOps.FrameHandle],
ENDCASE];
ContinuationKind: TYPE = {initial, resumptive};
Entry: TYPE = MACHINE DEPENDENT RECORD [
page (0): CARDINAL--PrincOps.PageNumber--,
value (1): PrincOps.InterimPageState];
MDSIndex: TYPE = RECORD [index: [0..256)]; -- high order bits of MDS base pointer
MemorySizeToFileSize: PROCEDURE [countReal: PrincOps.PageCount] RETURNS [INT] =
Calculate upper bound on file pages for boot file as function of real memory size.
INLINE BEGIN
RETURN[
countReal -- total data pages
+1 -- header page
+(MAX[countReal, maxEntriesPerHeader]-maxEntriesPerHeader+maxEntriesPerTrailer-1)
/maxEntriesPerTrailer -- trailer pages
]
END;
maxEntriesPerHeader: CARDINAL = (DiskFace.wordsPerPage-SIZE[Header])/SIZE[Entry];
maxEntriesPerTrailer: CARDINAL = (DiskFace.wordsPerPage-SIZE[Trailer])/SIZE[Entry];
END.