(FILECREATED "29-JUL-83 16:18:37" {PHYLUM}<LISPCORE>SOURCES>DLFIXINIT.;5 42566Q changes to: (FNS INSTALLDOMINO.DIRECT INSTALLNEWDOMINO) (VARS DLFIXINITCOMS) previous date: "15-APR-83 09:17:51" {PHYLUM}<LISPCORE>SOURCES>DLFIXINIT.;1) (* Copyright (c) 1983 by Xerox Corporation) (PRETTYCOMPRINT DLFIXINITCOMS) (RPAQQ DLFIXINITCOMS [(FNS DLFIXINIT DLSORTSYSOUTPAGES DLNEXTFP DLCOPYPAGEMAP DLCOPYVMPAGE DLADDPAGEMAPENTRIES ASSIGNFILEPAGE ASSIGNFILEPAGERANGE DLDUMPSYSOUT DLSETBOOTPTR DLDUMPARRAY DLMARKASDUMPED DLDUMPVMEMPAGE INSTALLDOMINO INSTALLDOMINO.DIRECT INSTALLNEWDOMINO) (FNS DLPRINTFPTOVP PRINTPRIMARYMAP DLREADPAGEOFWORDS SETDIF) (CONSTANTS \RP.MISCLOCKED \NO.PAGE.ASSIGNED MAXVMSEGMENT) (GLOBALVARS DLPRIMARYMAP DLSECONDARYMAP DLIFPAGE DLNEXTPM DLPAGEMAPFP FPTOVP NEWFPFROMOLD) (DECLARE: DONTEVAL@LOAD EVAL@COMPILE DONTCOPY (FILES (LOADCOMP) READSYS LLFAULT) (P (CHECKIMPORTS (QUOTE (MODARITH LLPARAMS)) T]) (DEFINEQ (DLFIXINIT [LAMBDA (SYSOUTFILE DLBOOTFILE DBFILE #UCODEPAGES) (* lmm "15-APR-83 09:15") [COND ((NOT DLBOOTFILE) (SETQ DLBOOTFILE (PACKFILENAME (QUOTE EXTENSION) (QUOTE DLINIT) (QUOTE BODY) SYSOUTFILE] (FILESLOAD (SYSLOAD) READSYS RDSYS) (RESETLST (SETQ DBFILE (OPENFILE (OR DBFILE (QUOTE {PHYLUM}<LISPCORE>FUGUE>DLISPDOMINO.DB)) (QUOTE INPUT))) (RESETSAVE NIL (LIST (QUOTE CLOSEF) DBFILE)) (PROG ((DBPAGES (IPLUS (FOLDHI (GETFILEINFO DBFILE (QUOTE LENGTH)) BYTESPERPAGE) 2)) #NEWFILEPAGES #OLDFILEPAGES #ADDEDFILEPAGES DLFILEX) (DECLARE (SPECVARS #NEWFILEPAGES #OLDFILEPAGES #ADDEDFILEPAGES DLFILEX)) (* Plus 2 is to allow for interface page and copy of page 0) (COND ((NOT #UCODEPAGES) (SETQ #UCODEPAGES (IQUOTIENT (ITIMES DBPAGES 5) 4)) (printout T " Assuming " .P2 #UCODEPAGES " pages of uCode/Domino" T)) ((ILESSP #UCODEPAGES DBPAGES) (printout T "Not enough space for Domino; raising it to " .P2 (SETQ #UCODEPAGES DBPAGES) " pages" T))) (READSYS SYSOUTFILE) (DLCOPYPAGEMAP) (SETQ NEWFPFROMOLD (ARRAY (SETQ #OLDFILEPAGES (FOLDHI (GETFILEINFO VMEMFILE (QUOTE LENGTH)) BYTESPERPAGE)) (QUOTE WORD) \NO.PAGE.ASSIGNED 1)) (SETQ FPTOVP (ARRAY (SETQ #NEWFILEPAGES (IPLUS (SUB1 #OLDFILEPAGES) #ADDEDFILEPAGES (SUB1 #UCODEPAGES))) (QUOTE WORD) \NO.VMEM.PAGE 1)) (DLSORTSYSOUTPAGES) (DLDUMPSYSOUT) (INSTALLDOMINO DBFILE) (RETURN DLBOOTFILE]) (DLSORTSYSOUTPAGES [LAMBDA NIL (* bvm: "30-MAR-83 10:57") (DECLARE (USEDFREE FPSIZE NEWFPFROMOLD FPTOVPSIZE FPTOVP PGTAB) (SPECVARS LASTFP)) (PROG (LASTFP) (ASSIGNFILEPAGE \FP.IFPAGE \VP.IFPAGE (SUB1 \FP.IFPAGE) T) (* SUB1 because old FP's are zero-based! See VMEM structures) (ASSIGNFILEPAGERANGE \VP.DISPLAY \NP.DISPLAY (DLFPFROMRP \RP.TEMPDISPLAY)) (ASSIGNFILEPAGERANGE \VP.STACK PAGESPERSEGMENT (DLFPFROMRP \RP.STACK) T) (ASSIGNFILEPAGERANGE \VP.TYPETABLE \NP.TYPETABLE (DLFPFROMRP \RP.TYPETABLE)) (ASSIGNFILEPAGERANGE \VP.GCTABLE \NP.GCTABLE (DLFPFROMRP \RP.GCTABLE)) (ASSIGNFILEPAGERANGE \VP.GCOVERFLOW \NP.GCOVERFLOW (DLFPFROMRP \RP.GCOVERFLOW)) (ASSIGNFILEPAGERANGE \VP.FPTOVP \NP.FPTOVP (DLFPFROMRP \RP.FPTOVP)) (replace (IFPAGE FPTOVPStart) of DLIFPAGE with (DLFPFROMRP \RP.FPTOVP)) (replace (IFPAGE LastDominoFilePage) of DLIFPAGE with (SETQ DLLASTDOMINOPAGE #UCODEPAGES)) [SETQ LASTFP (SUB1 (SETQ DLPAGEMAPFP (DLFPFROMRP \RP.MISCLOCKED] (* Assign next the pagemap pages, since we have to know where they live (some are new) and it is very convenient for them to be contiguous) (for J from 0 to (SUB1 \NumPMTpages) do (ASSIGNFILEPAGE (DLNEXTFP) (IPLUS J (PAGELOC \PageMapTBL)) NIL T)) (replace (IFPAGE filePnPMT0) of DLIFPAGE with DLPAGEMAPFP) (replace (IFPAGE filePnPMP0) of DLIFPAGE with (IPLUS DLPAGEMAPFP \NumPMTpages)) (for J from 0 to (SUB1 (FOLDHI DLNEXTPM WORDSPERPAGE)) do (ASSIGNFILEPAGE (DLNEXTFP) (IPLUS J (PAGELOC \PAGEMAP)) NIL T)) [for IFLOCKED in (QUOTE (T NIL)) do (for VPSEG from 0 to MAXVMSEGMENT bind PGTAB2 when (NEQ (SETQ PGTAB2 (FASTELT PGTAB VPSEG)) PGEMPTY) do (for I from 0 to (SUB1 PAGESPERSEGMENT) bind (VPBASE ←(UNFOLD VPSEG PAGESPERSEGMENT)) OLDFP when (AND [NOT (ZEROP (SETQ OLDFP (FASTELTN PGTAB2 I] (COND ((ZEROP (LOGAND \PAGEMAPLOCKBIT OLDFP)) (NOT IFLOCKED)) (IFLOCKED (SETQ OLDFP (LOGXOR \PAGEMAPLOCKBIT OLDFP)) T)) (EQ (FASTELTN NEWFPFROMOLD OLDFP) \NO.PAGE.ASSIGNED)) do (ASSIGNFILEPAGE (DLNEXTFP) (IPLUS VPBASE I) OLDFP IFLOCKED))) (COND (IFLOCKED (replace (IFPAGE LastLockedFilePage) of DLIFPAGE with LASTFP) (SETQ LASTFP DLLASTDOMINOPAGE] (replace (IFPAGE NDirtyPages) of DLIFPAGE with (replace (IFPAGE NActivePages) of DLIFPAGE with #NEWFILEPAGES]) (DLNEXTFP [LAMBDA NIL (* bvm: "29-MAR-83 11:46") (do (add LASTFP 1) repeatuntil (EQ (FASTELTN FPTOVP LASTFP) \NO.VMEM.PAGE)) LASTFP]) (DLCOPYPAGEMAP [LAMBDA NIL (* bvm: "27-MAR-83 16:24") (PROG NIL [SETQ DLIFPAGE (DLCOPYVMPAGE (PAGELOC \InterfacePage) (NCREATE (QUOTE VMEMPAGEP] (* Install interface page by magic) (SETQ DLPRIMARYMAP (ARRAY (UNFOLD \NumPMTpages WORDSPERPAGE) (QUOTE WORD) 0 0)) (* Primary map table) [for J from 0 to (SUB1 \NumPMTpages) do (DLCOPYVMPAGE (IPLUS J (PAGELOC \PageMapTBL)) (\ADDBASE (fetch (ARRAYP BASE) of DLPRIMARYMAP) (UNFOLD J WORDSPERPAGE] (SETQ DLNEXTPM (fetch (IFPAGE NxtPMAddr) of DLIFPAGE)) (* First free offset in secondary map) (SETQ #ADDEDFILEPAGES \NP.FPTOVP) (DLADDPAGEMAPENTRIES \VP.FPTOVP \NP.FPTOVP) (COND ((NOT (VMPAGEP \VP.DISPLAY)) (DLADDPAGEMAPENTRIES \VP.DISPLAY \NP.DISPLAY) (add #ADDEDFILEPAGES \NP.DISPLAY))) (SETQ DLSECONDARYMAP (ARRAY (IPLUS DLNEXTPM #ADDEDFILEPAGES) (QUOTE WORD) 0 0)) (* Allocate enough space to accomodate existing secondary map plus anything we add. This figure is an overestimate, since some of the added pages might have entries already allocated but empty) (replace (IFPAGE NxtPMAddr) of DLIFPAGE with DLNEXTPM]) (DLCOPYVMPAGE [LAMBDA (VP BASE) (* bvm: "27-MAR-83 18:14") (* Reads page VP from VMEMFILE into BASE, returning BASE) (SETVMPTR (UNFOLD VP WORDSPERPAGE)) (\BINS VMEMFILE BASE 0 BYTESPERPAGE) BASE]) (DLADDPAGEMAPENTRIES [LAMBDA (VP NPAGES) (* bvm: "27-MAR-83 17:53") (to NPAGES do [COND ((IEQ (FASTELTN DLPRIMARYMAP (fetch (VP PRIMARYKEY) of VP)) \EmptyPMTEntry) (COND ((EVENP DLNEXTPM WORDSPERPAGE) (* must add a new page map page) (add #ADDEDFILEPAGES 1))) (FASTSETAN DLPRIMARYMAP (fetch (VP PRIMARYKEY) of VP) DLNEXTPM) (SETQ DLNEXTPM (IPLUS DLNEXTPM \PMblockSize] (add VP 1]) (ASSIGNFILEPAGE [LAMBDA (FP VP OLDFP LOCKED) (* bvm: "30-MAR-83 10:56") (* Assign VP to live in FP (and hence a related real page); OLDFP is where VP lives in the old sysout) (COND ([NOT (ZEROP (OR OLDFP (SETQ OLDFP (LOGAND (FASTELTN (FASTELT PGTAB (LRSH VP 10Q)) (LOGAND VP 377Q)) 77777Q] (FASTSETAN NEWFPFROMOLD OLDFP FP))) (FASTSETAN FPTOVP FP (COND (LOCKED (LOGOR VP \PAGEMAPLOCKBIT)) (T VP))) (PROG [(SECONDARY (FASTELTN DLPRIMARYMAP (fetch (VP PRIMARYKEY) of VP] (* Update pagemap to point to the new FP) (COND ((IEQ SECONDARY \EmptyPMTEntry) (HELP VP "has no primary map entry")) (T (FASTSETAN DLSECONDARYMAP (IPLUS SECONDARY (fetch (VP SECONDARYKEY) of VP)) (COND (LOCKED (LOGOR FP \PAGEMAPLOCKBIT)) (T FP]) (ASSIGNFILEPAGERANGE [LAMBDA (VPSTART NPAGES FPSTART ONLYIFTHERE) (* bvm: "25-MAR-83 12:44") (for I from 0 to (SUB1 NPAGES) unless [AND ONLYIFTHERE (NOT (VMPAGEP (IPLUS VPSTART I] do (ASSIGNFILEPAGE (IPLUS FPSTART I) (IPLUS VPSTART I) NIL T]) (DLDUMPSYSOUT [LAMBDA NIL (* bvm: "29-MAR-83 00:06") [RESETSAVE [SETQ DLBOOTFILE (OPENFILE DLBOOTFILE (QUOTE OUTPUT) (QUOTE NEW) 10Q (QUOTE ((TYPE BINARY] (QUOTE (PROGN (CLOSEF? OLDVALUE) (AND RESETSTATE (DELFILE OLDVALUE] (SETQ DLFILEX (GETSTREAM DLBOOTFILE)) (DLSETBOOTPTR (DLFPFROMRP \RP.FPTOVP)) (* Prepare to dump FPTOVP. We have to explicitly dump everything that we built ourselves; old vmem pages can just be copied) (\WOUT DLFILEX \NO.VMEM.PAGE) (* Filepages are one-based, but FPTOVP in the sysout is zero-based for convenience. Hence, first entry (page zero) is dummy) (DLDUMPARRAY FPTOVP #NEWFILEPAGES) (RPTQ (IDIFFERENCE (UNFOLD \NP.FPTOVP WORDSPERPAGE) (ADD1 #NEWFILEPAGES)) (\WOUT DLFILEX \NO.VMEM.PAGE)) (* Fill out rest of FPTOVP with no such page) (DLMARKASDUMPED (DLFPFROMRP \RP.FPTOVP) \NP.FPTOVP) (* Mark FPTOVOP as dumped) (DLSETBOOTPTR DLPAGEMAPFP) (DLDUMPARRAY DLPRIMARYMAP (UNFOLD \NumPMTpages WORDSPERPAGE)) (* Dump primary map) (DLDUMPARRAY DLSECONDARYMAP (CEIL DLNEXTPM WORDSPERPAGE)) (* Dump secondary map) (DLMARKASDUMPED DLPAGEMAPFP (IPLUS \NumPMTpages (FOLDHI DLNEXTPM WORDSPERPAGE))) (* Mark pagemaps as dumped) (DLSETBOOTPTR \FP.IFPAGE) (\BOUTS DLFILEX DLIFPAGE 0 BYTESPERPAGE) (for FP from DLLASTDOMINOPAGE to #NEWFILEPAGES bind VP when (NEQ (SETQ VP (FASTELTN FPTOVP FP)) \NO.VMEM.PAGE) do (DLDUMPVMEMPAGE FP (fetch FILEPAGEONLY of VP) (fetch LOCKEDP of VP]) (DLSETBOOTPTR [LAMBDA (FP) (* bvm: "27-MAR-83 17:39") (printout T "[" .P2 FP "]") (SETFILEPTR DLFILEX (UNFOLD (SUB1 FP) BYTESPERPAGE]) (DLDUMPARRAY [LAMBDA (ARR NWORDS) (* bvm: "27-MAR-83 17:42") (\BOUTS DLFILEX (fetch (ARRAYP BASE) of ARR) 0 (UNFOLD NWORDS BYTESPERWORD]) (DLMARKASDUMPED [LAMBDA (FIRSTFP NPAGES) (* bvm: "27-MAR-83 17:35") (for I from FIRSTFP to (IPLUS FIRSTFP NPAGES -1) do (FASTSETAN FPTOVP I \NO.VMEM.PAGE]) (DLDUMPVMEMPAGE [LAMBDA (NEWFP VP LOCKEDP) (* bvm: "28-MAR-83 12:11") (COND ((VMPAGEP VP) (SETVMPTR (UNFOLD VP WORDSPERPAGE)) [PROG ((DESTINATIONBYTE (UNFOLD (SUB1 NEWFP) BYTESPERPAGE))) (COND ((NOT (IEQP (\GETFILEPTR DLFILEX) DESTINATIONBYTE)) (printout T "[" .P2 NEWFP "]") (SETFILEPTR DLFILEX DESTINATIONBYTE] (COPYBYTES VMEMFILE DLFILEX BYTESPERPAGE) (PRIN1 (COND (LOCKEDP (QUOTE $)) (T (QUOTE *))) T)) (T (PRIN1 (QUOTE x) T]) (INSTALLDOMINO [LAMBDA (DBFILE) (* edited: "14-APR-83 12:00") (DLSETBOOTPTR 1) (COPYBYTES DBFILE DLFILEX 0 BYTESPERPAGE) (DLSETBOOTPTR (ADD1 \FP.IFPAGE)) (* Skip over InterfacePage) (COPYBYTES DBFILE DLFILEX) (* Copy rest of Domino) (DLSETBOOTPTR DLLASTDOMINOPAGE) (SETFILEPTR DBFILE 0) (* Copy first DB page into scratch at end of Domino reserved space so that SYSOUT can get it (Dolphin and Dorado smash first page of vmem)) (COPYBYTES DBFILE DLFILEX 0 BYTESPERPAGE]) (INSTALLDOMINO.DIRECT [LAMBDA (DBFILE) (* bvm: "29-JUL-83 16:16") (PROG [(BUFFER (COND ((IGREATERP \#SWAPBUFFERS 1) (RESETSAVE \EMUSWAPBUFFERS (\ADDBASE \EMUSWAPBUFFERS WORDSPERPAGE)) (RESETSAVE \#SWAPBUFFERS (SUB1 \#SWAPBUFFERS)) \EMUSWAPBUFFERS) (T (RESETSAVE \EMUDISKBUFFERS (\ADDBASE \EMUDISKBUFFERS WORDSPERPAGE)) (RESETSAVE \#DISKBUFFERS (SUB1 \#DISKBUFFERS)) \EMUDISKBUFFERS] (replace ENDOFSTREAMOP of DBFILE with (FUNCTION ZERO)) (\BINS DBFILE BUFFER 0 BYTESPERPAGE) (COND ((EQ \MACHINETYPE \DANDELION) (\ACTONVMEMFILE 1 BUFFER 1 T))) (\BINS DBFILE BUFFER 0 BYTESPERPAGE) (* Skip over InterfacePage) (for I from (ADD1 \FP.IFPAGE) until (\EOFP DBFILE) do (\BINS DBFILE BUFFER 0 BYTESPERPAGE) (\ACTONVMEMFILE I BUFFER 1 T)) (* Copy rest of Domino) ]) (INSTALLNEWDOMINO [LAMBDA (SYSOUTFILE DBFILE) (* bvm: "29-JUL-83 16:08") (RESETLST (SETQ DBFILE (GETSTREAM (OPENFILE (OR DBFILE (INFILEP (QUOTE {DSK}DLISPDOMINO.DB)) (QUOTE {PHYLUM}<LISPCORE>DLION>BASICS>DLISPDOMINO.DB)) (QUOTE INPUT)) (QUOTE INPUT))) (RESETSAVE NIL (LIST (QUOTE CLOSEF) DBFILE)) (PROG ((DBPAGES (IPLUS (FOLDHI (GETFILEINFO DBFILE (QUOTE LENGTH)) BYTESPERPAGE) 2)) #UCODEPAGES DLFILEX) (DECLARE (SPECVARS DLFILEX)) [COND [SYSOUTFILE [RESETSAVE NIL (LIST (QUOTE CLOSEF) (SETQ SYSOUTFILE (OPENFILE SYSOUTFILE (QUOTE INPUT] (SETQ #UCODEPAGES (SETQ DLLASTDOMINOPAGE (fetch (IFPAGE LastDominoFilePage) of (\MAPPAGE 1 (GETSTREAM SYSOUTFILE] ((ASKUSER NIL NIL (LIST "Shall I install" (fetch FULLFILENAME of DBFILE) "directly into the vmem file")) (SETQ #UCODEPAGES (SETQ DLLASTDOMINOPAGE (fetch (IFPAGE LastDominoFilePage) of \InterfacePage] (COND ((ILESSP #UCODEPAGES DBPAGES) (RETURN "Not enough space for Domino"))) (COND (SYSOUTFILE (OPENFILE (CLOSEF SYSOUTFILE) (QUOTE BOTH)) (SETQ DLFILEX (GETSTREAM SYSOUTFILE)) (INSTALLDOMINO DBFILE)) (T (INSTALLDOMINO.DIRECT DBFILE))) (RETURN SYSOUTFILE]) ) (DEFINEQ (DLPRINTFPTOVP [LAMBDA (STREAM) (* bvm: "28-MAR-83 12:42") (\PRINTFPTOVP (\ADDBASE (fetch (ARRAYP BASE) of FPTOVP) -1) (fetch (IFPAGE NActivePages) of DLIFPAGE) STREAM]) (PRINTPRIMARYMAP [LAMBDA NIL (* bvm: "28-MAR-83 23:25") (for I from 0 to 77Q do (printout T I ": " 10Q) [for J from 0 to 7 bind PMPE do (COND ((EQ [SETQ PMPE (ELT DLPRIMARYMAP (PLUS J (TIMES I 10Q] 177777Q) (printout T " -----")) (T (printout T .I6.8 PMPE] (TERPRI T) unless (for J from 0 to 7 always (EQ (ELT DLPRIMARYMAP (PLUS J (TIMES I 10Q))) 177777Q]) (DLREADPAGEOFWORDS [LAMBDA (STREAM) (* bvm: "29-MAR-83 00:03") (to WORDSPERPAGE collect (\WIN STREAM]) (SETDIF [LAMBDA (X Y) (* bvm: "28-MAR-83 15:28") (for EL in X collect EL unless (FMEMB EL Y]) ) (DECLARE: EVAL@COMPILE (RPAQQ \RP.MISCLOCKED 2153Q) (RPAQQ \NO.PAGE.ASSIGNED 0) (RPAQQ MAXVMSEGMENT 77Q) (CONSTANTS \RP.MISCLOCKED \NO.PAGE.ASSIGNED MAXVMSEGMENT) ) (DECLARE: DOEVAL@COMPILE DONTCOPY (ADDTOVAR GLOBALVARS DLPRIMARYMAP DLSECONDARYMAP DLIFPAGE DLNEXTPM DLPAGEMAPFP FPTOVP NEWFPFROMOLD) ) (DECLARE: DONTEVAL@LOAD EVAL@COMPILE DONTCOPY (FILESLOAD (LOADCOMP) READSYS LLFAULT) (CHECKIMPORTS (QUOTE (MODARITH LLPARAMS)) T) ) (PUTPROPS DLFIXINIT COPYRIGHT ("Xerox Corporation" 3677Q)) (DECLARE: DONTCOPY (FILEMAP (NIL (1744Q 37300Q (DLFIXINIT 1756Q . 5333Q) (DLSORTSYSOUTPAGES 5335Q . 13213Q) (DLNEXTFP 13215Q . 13552Q) (DLCOPYPAGEMAP 13554Q . 16573Q) (DLCOPYVMPAGE 16575Q . 17322Q) (DLADDPAGEMAPENTRIES 17324Q . 20351Q) (ASSIGNFILEPAGE 20353Q . 22331Q) (ASSIGNFILEPAGERANGE 22333Q . 23022Q) (DLDUMPSYSOUT 23024Q . 27007Q) (DLSETBOOTPTR 27011Q . 27327Q) (DLDUMPARRAY 27331Q . 27650Q) (DLMARKASDUMPED 27652Q . 30205Q) (DLDUMPVMEMPAGE 30207Q . 31244Q) (INSTALLDOMINO 31246Q . 32456Q) (INSTALLDOMINO.DIRECT 32460Q . 34427Q) (INSTALLNEWDOMINO 34431Q . 37276Q)) (37301Q 41525Q (DLPRINTFPTOVP 37313Q . 37717Q) ( PRINTPRIMARYMAP 37721Q . 41001Q) (DLREADPAGEOFWORDS 41003Q . 41251Q) (SETDIF 41253Q . 41523Q))))) STOP