;<PUP>PUPEND.MAC;5    13-JAN-83 14:19:09    EDIT BY TAFT
; Change ASSIGN to .ASSIGN
;<PUP>PUPEND.MAC;4     2-SEP-79 15:59:20    EDIT BY TAFT
;<PUP>PUPEND.MAC;3    18-MAR-77 17:44:14    EDIT BY TAFT
; SEARCH PSVDEF

; Copyright 1979 by Xerox Corporation

	TITLE PUPEND -- CHECK FOR STORAGE OVERLAP IN PUPSRV
	SUBTTL E. A. Taft / June, 1976

	SEARCH PUPDEF,PSVDEF,STENEX


.ASSIGN EGSVAR,GSVAR,0	; End of global storage
.ASSIGN EGSPVR,GSPVAR,0	; End of global page storage
.ASSIGN ETOPVR,TOPVAR,0	; End of top fork local storage
.ASSIGN ETOPPV,TOPPVR,0	; End of top fork local page storage
.ASSIGN EFTPVR,FTPVAR,0	; End of FTP local storage
.ASSIGN EFTPPV,FTPPVR,0	; End of FTP local page storage



; Check for storage overlap
; Returns +1 normally
; Does not return if error

CKOVLP::SETZ D,			; Init error count

	HRRZ A,.JBSYM##		; Get start of symbol table
	HLRE B,.JBSYM##		; Compute end
	SUB A,B
	SUBI A,IGSLOC		; Check for overlap
	JUMPLE A,.+3
	TYPE <Symbols overlap global storage by %1O%/>
	ADDI D,1		; Increment error count

	MOVEI A,EGSVAR
	SUBI A,IGSPLC
	JUMPLE A,.+3		; Jump if no overlap
	TYPE <Global storage overlaps global page storage by %1O%/>
	ADDI D,1		; Increment error count

	MOVEI A,EGSPVR
	SUBI A,ILSPLC
	JUMPLE A,.+3		; Jump if no overlap
	TYPE <Global page storage overlaps local storage by %1O%/>
	ADDI D,1		; Increment error count

	MOVEI A,ETOPVR
	SUBI A,ILSPLC
	JUMPLE A,.+3		; Jump if no overlap
	TYPE <Top fork local storage overlaps local page storage by %1O%/>
	ADDI D,1		; Increment error count

	MOVEI A,EFTPVR
	SUBI A,ILSPLC
	JUMPLE A,.+3		; Jump if no overlap
	TYPE <FTP fork local storage overlaps local page storage by %1O%/>
	ADDI D,1		; Increment error count

	JUMPE D,CPOPJ##		; Return if no errors
	TYPE <**** Fatal error -- PUPSRV must be reassembled%/>
	HALTF
	JRST .-1

	END