(FILECREATED "18-Nov-85 17:08:04" {ERIS}<LISPCORE>DOVE>VMEMSIZEPATCH.;8 6562   

      changes to:  (VARS VMEMSIZEPATCHCOMS)
		   (FNS \Dove.FixVMemSize \Dove.GetBootFileDescriptor \PV.DiskFileIDOfBootFile 
			\PV.LVDescFromDiskAddress \PV.ReadPVRootPage \PV.DiskPageNumber 
			\PV.MapSubVolumes \Dove.GetVMemSize VMemSizePatchEventFN)

      previous date: " 8-Nov-85 11:47:34" {ERIS}<LISPCORE>DOVE>VMEMSIZEPATCH.;7)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT VMEMSIZEPATCHCOMS)

(RPAQQ VMEMSIZEPATCHCOMS ((DECLARE: DONTCOPY (FILES (LOADCOMP)
						      <LISPCORE>SOURCES>LOCALFILE 
						      <LISPCORE>DOVE>LISPOTHELLO)
				      (MACROS \PV.SubVolumeDescFromVol#))
			    [INITVARS (\LispOthello.PhysicalVolumeRootPage (NCREATE (QUOTE VMEMPAGEP))
									   )
				      (\LispOthello.FileDescriptor (NCREATE (QUOTE FileDescriptor)))
				      (\LispOthello.Label (NCREATE (QUOTE VMEMPAGEP]
			    (GLOBALVARS \LispOthello.PhysicalVolumeRootPage 
					\LispOthello.FileDescriptor \LispOthello.Label)
			    (FNS \Dove.FixVMemSize \Dove.GetBootFileDescriptor 
				 \PV.DiskFileIDOfBootFile \PV.LVDescFromDiskAddress 
				 \PV.ReadPVRootPage \PV.DiskPageNumber \PV.MapSubVolumes 
				 \Dove.GetVMemSize VMemSizePatchEventFN)
			    (P (\Dove.FixVMemSize))
			    (ADDVARS (AROUNDEXITFNS VMemSizePatchEventFN))))
(DECLARE: DONTCOPY 
(FILESLOAD (LOADCOMP)
	   <LISPCORE>SOURCES>LOCALFILE <LISPCORE>DOVE>LISPOTHELLO)

(DECLARE: EVAL@COMPILE 
[DEFMACRO \PV.SubVolumeDescFromVol# (vol#)
	  (BQUOTE (\ADDBASE (fetch (PhysicalVolumeDescriptor subVolumes)
				   of \LispOthello.PhysicalVolumeRootPage)
			    (TIMES , vol# (MESASIZE SubVolumeDesc]
)
)

(RPAQ? \LispOthello.PhysicalVolumeRootPage (NCREATE (QUOTE VMEMPAGEP)))

(RPAQ? \LispOthello.FileDescriptor (NCREATE (QUOTE FileDescriptor)))

(RPAQ? \LispOthello.Label (NCREATE (QUOTE VMEMPAGEP)))
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS \LispOthello.PhysicalVolumeRootPage \LispOthello.FileDescriptor \LispOthello.Label)
)
(DEFINEQ

(\Dove.FixVMemSize
  [LAMBDA NIL                                                (* edited: " 5-Nov-85 19:40")
    (COND
      ((EQ (MACHINETYPE)
	     (QUOTE DOVE))
	(replace (IFPAGE DLLastVmemPage) of \InterfacePage with (IDIFFERENCE (
										\Dove.GetVMemSize)
										     2])

(\Dove.GetBootFileDescriptor
  [LAMBDA (BootFileType)                                     (* edited: " 5-Nov-85 18:13")

          (* * Find the logical volume of the boot file of type BootFileType. Return the leader page for that file)


    (LET* [(DiskFileID (\PV.DiskFileIDOfBootFile BootFileType))
	   (FileID (\GETBASE DiskFileID 0))
	   (PilotDiskAddress (fetch (DiskFileID da) of DiskFileID))
	   [LVDesc (COND
		     ((NEQ PilotDiskAddress 0)
		       (\PV.LVDescFromDiskAddress PilotDiskAddress]
	   (vol# (COND
		   (LVDesc (GETHASH LVDesc \DFSLogicalVolumeHash]
          (COND
	    (vol# (replace (FileDescriptor fileID) of \LispOthello.FileDescriptor with FileID)
		  (replace (FileDescriptor volNum) of \LispOthello.FileDescriptor with vol#)
		  (replace (FileDescriptor type) of \LispOthello.FileDescriptor with 
									     tDiagnosticMicrocode)
		  \LispOthello.FileDescriptor])

(\PV.DiskFileIDOfBootFile
  [LAMBDA (N)                                                (* ejs: "10-Sep-85 01:16")
    (\ADDBASE (fetch (PhysicalVolumeDescriptor bootingInfo) of 
							      \LispOthello.PhysicalVolumeRootPage)
		(ITIMES N (MESASIZE DiskFileID])

(\PV.LVDescFromDiskAddress
  [LAMBDA (PilotDiskAddress)                                 (* ejs: " 9-Sep-85 23:38")
    (LET ((DiskPageNumber (\PV.DiskPageNumber PilotDiskAddress)))
         (\PV.MapSubVolumes (FUNCTION (LAMBDA (SVDesc LVDesc)
				  (LET* [(FirstPage (fetch (SubVolumeDesc pvPage) of SVDesc))
					 (LastPage (IPLUS FirstPage (fetch (SubVolumeDesc nPages)
									 of SVDesc]
				        (COND
					  ((AND (IGEQ DiskPageNumber FirstPage)
						  (ILEQ DiskPageNumber LastPage))
					    (RETFROM (QUOTE \PV.LVDescFromDiskAddress)
						       LVDesc])

(\PV.ReadPVRootPage
  [LAMBDA NIL                                                (* ejs: "10-Sep-85 23:49")
    (\PFTransferPage 0 \LispOthello.PhysicalVolumeRootPage (QUOTE VRR)
		       \LispOthello.Label)
    (COND
      ((NEQ (fetch (PhysicalVolumeDescriptor seal) of \LispOthello.PhysicalVolumeRootPage)
	      \PV.RootSeal)
	(ERROR "Physical volume root page seal is invalid!" (fetch (PhysicalVolumeDescriptor
									 seal)
								 of 
							      \LispOthello.PhysicalVolumeRootPage)))
      (T \LispOthello.PhysicalVolumeRootPage])

(\PV.DiskPageNumber
  [LAMBDA (PilotDiskAddress)                                 (* ejs: " 9-Sep-85 23:03")

          (* * Returns the disk page number for the Pilot disk address)


    (IPLUS (ITIMES (fetch (PilotDiskAddress Cylinder) of PilotDiskAddress)
		       \DLDISKSHAPE.SECTORSPERCYLINDER)
	     (ITIMES (fetch (PilotDiskAddress Head) of PilotDiskAddress)
		       \DLDISKSHAPE.SECTORSPERHEAD)
	     (fetch (PilotDiskAddress Sector) of PilotDiskAddress])

(\PV.MapSubVolumes
  [LAMBDA (FUNCTION)                                       (* ejs: "10-Sep-85 17:32")
    (bind SVDesc for SVIndex from 0 to (SUB1 (fetch (PhysicalVolumeDescriptor 
										   subVolumeCount)
							  of \LispOthello.PhysicalVolumeRootPage))
       eachtime (SETQ SVDesc (\PV.SubVolumeDescFromVol# SVIndex)) do (APPLY* FUNCTION SVDesc
										     (ELT 
									       \DFSLogicalVolumes 
											  SVIndex)
										     SVIndex])

(\Dove.GetVMemSize
  [LAMBDA NIL                                                (* edited: " 5-Nov-85 19:03")
    (\PV.ReadPVRootPage)
    (\PFFindFileSize (\Dove.GetBootFileDescriptor 2])

(VMemSizePatchEventFN
  [LAMBDA (EVENT)                                            (* amd "18-Nov-85 17:07")
    (SELECTQ EVENT
	       ((AFTERSYSOUT AFTERLOGOUT AFTERSAVEVM AFTERMAKESYS)
		 (\PFEnsureInitialized)
		 (\Dove.FixVMemSize))
	       NIL])
)
(\Dove.FixVMemSize)

(ADDTOVAR AROUNDEXITFNS VMemSizePatchEventFN)
(PUTPROPS VMEMSIZEPATCH COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2045 6407 (\Dove.FixVMemSize 2055 . 2387) (\Dove.GetBootFileDescriptor 2389 . 3375) (
\PV.DiskFileIDOfBootFile 3377 . 3663) (\PV.LVDescFromDiskAddress 3665 . 4298) (\PV.ReadPVRootPage 4300
 . 4887) (\PV.DiskPageNumber 4889 . 5401) (\PV.MapSubVolumes 5403 . 5922) (\Dove.GetVMemSize 5924 . 
6132) (VMemSizePatchEventFN 6134 . 6405)))))
STOP