*----------------------------------------------------------- Title[PilotBoot.mc...October 24, 1983 5:35 PM...Taft]; * Pilot Germ boot sequence *----------------------------------------------------------- TopLevel; DontKnowRBase; Set[XTask, IP[EMU]]; *----------------------------------------------------------- * Data structures *----------------------------------------------------------- * Germ conventions: MC[baseGerm, 1000]; * = BootSwap.countSkip * wordsPerPage * pRequest: POINTER TO Request = LOOPHOLE[1360B]; MC[pRequest, 1360]; * Request: TYPE = MACHINE DEPENDENT RECORD [ MC[Req.action, 0]; * action: Action, MC[Req.deviceType, 1]; * deviceType: Device.type, MC[Req.deviceOrdinal, 2]; * deviceOrdinal: CARDINAL, MC[Req.vp, 3]; * vp: SELECT OVERLAID * FROM * disk => [diskFileID: DiskFileID], * ethernet => [bfn, net, host: CARDINAL]; * Device.Type: TYPE = {diablo31, sa800, sa1000, sa4000, cdc9730, ethernet}; MC[DType.sa4000, 3]; * Actually, Dorado Trident disk MC[DType.ethernet, 5]; * Action: TYPE = {inLoad, outLoad, bootPhysicalVolume, teleDebug, noOp}; MC[Act.bootPhysicalVolume, 2]; * pSwitches: POINTER TO ARRAY [0..2] OF CARDINAL = LOOPHOLE[1242B]; MC[pSwitches, 1242]; *----------------------------------------------------------- * Entry conditions: * Real memory has been mapped contiguously at the bottom of virtual * memory, and zeroed. Base registers have been set up. * I/O devices have been initialized and are quiescent. * Exit conditions: * Germ loaded into memory and Mesa emulator started executing it. *----------------------------------------------------------- GermBoot: RBase_ RBase[BTemp0]; MemBase_ IOBR; BootDataPtr_ baseGerm; * Where to load it BTemp2_ Desc.bi.germ, SCall[DiskBootSoft]; * What to load GermBootFailed: Breakpoint, Branch[.]; * +1: boot failed * Store into the Germ the magic values that tell it what to do. T_ And[pRequest!, 177400]C; * Set up the Request T_ T OR (And[pRequest!, 377]C); T_ (Store_ T)+1, DBuf_ Act.bootPhysicalVolume; T_ (Store_ T)+1, DBuf_ DType.sa4000; Store_ T, DBuf_ 0C; T_ And[pSwitches!, 177400]C; * Set up the Switches -- all zeroes T_ T OR (And[pSwitches!, 377]C); Cnt_ 2S; T_ (Store_ T)+1, DBuf_ 0C, Branch[., Cnt#0&-1]; * We ought to be able to remap the Germ into MDS 76 simply by exchanging map * entries in MDSs 0 and 76 for those pages into which the Germ was read. * However, that would leave a hole (vacant pages) in MDS 0, and apparently * the Germ can't cope with that. So instead we steal some pages from the * end of mapped virtual memory, remap them into MDS 76, and copy the Germ. * Note that BootDataPtr points to start of the page after the Germ. T_ BootDataPtr, RBase_ RBase[RTemp0]; RTemp3_ T; * Save it in 2 places RTemp5_ T; RTemp2_ A0; FindEndMappedVM: T_ RTemp2, Call[SetBRForPage]; * Returns RTemp0=0 RMap_ RTemp0, SCall[TranslateMapEntry]; Branch[GermRemapLpE]; * +1: found first vacant page RTemp2_ (RTemp2)+1, Branch[FindEndMappedVM]; * +2: not vacant GermRemapLp: RTemp3_ (RTemp3)-(400C), * RTemp3_ VA of page to do Branch[GermRemapDone, ALU=0]; T_ RTemp2_ (RTemp2)-1; * T_ last mapped virtual page Call[SetBRForPage]; * Returns RTemp0=0 RMap_ RTemp0, Call[TranslateMapEntry]; * Read and translate map entry RTemp4_ T, DispTable[1, 1, 1]; * Always return here from TranslateMapPage T_ 60000C, Call[WriteMapPage]; * Make it vacant T_ RSH[RTemp3, 10]; * T_ Germ page number to do T_ T+(LShift[PilotMDSHi!, 10]C); * T_ that page # in the Germ's MDS Call[SetBRForPage]; T_ RTemp4, Call[WriteMapPage]; * Put stolen page into the map GermRemapLpE: PD_ (RTemp3)-(baseGerm), Branch[GermRemapLp]; * See if done all pages * At this point, LPtr points to the base of where the Germ will go in MDS 76. * RTemp5 still has the VA of the first page after where the Germ is now in MDS 0. GermRemapDone: T_ (RTemp5)-(baseGerm); * Not the world's fastest BLT loop, but who cares? RTemp5_ (RTemp5)-1, MemBase_ IOBR; Fetch_ RTemp5; T_ T-1, MemBase_ LPtr; Store_ T, DBuf_ MD, Branch[.-3, ALU#0]; Branch[MGo]; * Go start it up!