Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/syserr.mac
There are 64 other files named syserr.mac in the archive. Click here to see a list.
;<3.SM10-RELEASE-3>SYSERR.MAC.1, 24-Oct-77 17:13:08, EDIT BY MURPHY
;CALL GAPRID
;<3-MONITOR>SYSERR.MAC.35, 13-Oct-77 14:22:23, EDIT BY MILLER
;IF SYERR FAILS ON CALL TO ALCSEB, DO AN OKSKED
;<3-MONITOR>SYSERR.MAC.34, 12-Oct-77 14:14:57, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>SYSERR.MAC.33, 29-Sep-77 16:53:25, EDIT BY MILLER
;STORE ENTIRE APRID WORD IN SYSERR HEADER
;<3-MONITOR>SYSERR.MAC.32, 19-Jul-77 17:59:23, EDIT BY HURLEY
;<3-MONITOR>SYSERR.MAC.31, 28-Mar-77 15:15:41, Edit by MCLEAN
;FIX TYPO IN ALCSE3
;<3-MONITOR>SYSERR.MAC.30, 26-Mar-77 23:05:37, Edit by MCLEAN
;FIX EXTENDED ADDRESSING BUG AT ALCSE3
;<3-MONITOR>SYSERR.MAC.29,  2-Feb-77 16:50:09, Edit by MCLEAN
;<3-MONITOR>SYSERR.MAC.28, 23-Jan-77 23:15:23, Edit by MCLEAN
;<3-MONITOR>SYSERR.MAC.27, 17-Jan-77 14:47:56, Edit by MCLEAN
;<3-MONITOR>SYSERR.MAC.26, 27-Dec-76 17:37:19, EDIT BY HURLEY
;<3-MONITOR>SYSERR.MAC.25, 26-Nov-76 03:49:09, Edit by MCLEAN
;TCO 1669 EXTENDED ADDRESSING
;<2-MONITOR>SYSERR.MAC.23,  4-Oct-76 15:54:50, EDIT BY HURLEY
;PUT 775 IN BITS 0-8 OF FIRST WORD OF BLOCK
;<2-MONITOR>SYSERR.MAC.22, 24-Aug-76 16:39:39, EDIT BY MURPHY
;TCO #1502 - FIX RELSEB
;<1B-MONITOR>SYSERR.MAC.21, 16-Jun-76 16:20:48, EDIT BY BOSACK
;TCO 1434 - REMOVE BUGHLT IF JFNOFN FAILS
;<2MONITOR>SYSERR.MAC.20, 23-DEC-75 13:11:44, EDIT BY LEWINE

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1977 BY DIGITAL EQUIPMENT CORPORATION

	SEARCH PROLOG
	TTITLE SYSERR

;STRUCTURE OF BLOCK
; WORD 0 - HEADER

DEFSTR SEBCDR,,35,18		;PTR TO NEXT IN LIST
DEFSTR SEBSIZ,0,17,12		;SIZE OF THIS BLOCK (INCLUDING HEADER)
DEFSTR SEBCOD,0,5,3		;STATE CODE

;BLOCK STATE CODES

SBCFRE==0			;ON FREE LIST
SBCREL==1			;RELEASED
SBCACT==2			;ACTIVE

; WORD 1 - LOCAL USAGE

DEFSTR SEBFN,1,35,18		;FUNCTION TO CALL IN JOB 0
DEFSTR SEBSOF,1,17,12		;OFFSET TO FREE STRING SPACE

SEBHED==:2			;FIRST REGULAR HEADER WORD

; WORD 2-5 - SYSERR HEADER

DEFSTR SEHCOD,SEBHED,8,9		;EVENT CODE
DEFSTR SEHLEN,SEBHED,35,9		;LENGTH OF BLOCK
DEFSTR SEHTAD,SEBHED+1,35,36		;DATE AND TIME
DEFSTR SEHUTM,SEBHED+2,35,36		;UPTIME
DEFSTR SEHSER,SEBHED+3,35,36		;APRID WORD

SEBDAT==:SEBHED+4			;FIRST DATA WORD
SBSMAX==400			;MAX SIZE, JSYS CALL
SEHWD0==1B17+1B23+4B26		;STANDARD BITS, HEADER WORD
SEBBLK==200			;SIZE OF LOGICAL BLOCK IN SYSERR FILE

;INITIALIZATION

	RESCD

SEBINI::MOVEI T1,SEBBFR		;SETUP FREE AND END-FREE PTRS
	MOVEM T1,SEBFRE
	MOVEM T1,SEBEFE
	MOVEI T1,SEBBSZ		;INIT FREE COUNT
	MOVEM T1,SEBFCT
	MOVEI T1,SEBQOU		;INIT QUEUE
	MOVEM T1,SEBQIN
	SETZM SEBQOU		;INIT OUTPUT POINTER ALSO
	RET
;ALLOCATE SYSERR BLOCK
; T1/ SIZE (NOT INCLUDING HEADER AND LOCAL DATA)
; T2/ OFFSET TO STRING STORAGE (I.E. SIZE OF HEADER AND DATA)
;	CALL ALCSEB
; RETURN +1: FAILURE, NO BUFFER SPACE AVAILABLE
; RETURN +2: SUCCESS, T1/ PTR TO BLOCK

;THIS ROUTINE MAY BE CALLED AT ANY PI LEVEL.  IT TURNS THE PI SYSTEM
;OFF WHILE MANIPULATING LISTS, BUT WAS DESIGNED TO MINIMIZE THE
;DURATION OF PI DISABLING.  THE FIRST TWO WORDS OF THE RETURNED BLOCK
;ARE USED FOR LOCAL PURPOSES AS DEFINED ABOVE.  THE ACTUAL SYSERR
;DATA BEGINS IN THE THIRD WORD AND CONSTITUTES THE REMAINDER OF THE BLOCK.

ALCSEB::CONSZ PI,PIPION		;PI NOW ON?
	SKIPA T3,[PION]		;YES
	MOVX T3,<JFCL>		;NO, REMEMBER STATE
	ADDI T1,SEBDAT		;INCLUDE SPACE FOR HEADER
	ASUBR <ARG1,ARG2,PIF>
ALCSE1:	MOVN T2,T1		;GET NEGATIVE OF DESIRED SIZE
	MOVEI T3,SEBBFR		;SETUP IN CASE WRAPAROUND
	MOVNI T4,SEBBFR+SEBBSZ	; "
	PIOFF			;INTO THE TUNNEL....
	CAMLE T1,SEBFCT		;ENOUGH SPACE FOR REQUEST?
	JRST ALCSEX		;DEFINITELY NOT
	ADD T1,SEBFRE		;COMPUTE END OF BLOCK
	CAIL T1,SEBBFR+SEBBSZ	;ENOUGH SPACE BEFORE END?
	JRST ALCSE2		;NO
	ADDM T2,SEBFCT		;UPDATE FREE COUNT
	EXCH T1,SEBFRE		;UPDATE FREE POINTER
	XCT PIF			;RESTORE PI
ALCSE3:	HRLZ T2,T1		;CLEAR BLOCK--SOURCE
	HRRZS T1			;CLEAR SECTION NUMBER
	HRRI T2,1(T1)
	HRRZ T3,T1
	ADD T3,ARG1		;SIZE
	SETZM 0(T1)
	BLT T2,-1(T3)
	MOVE T2,ARG1		;GET SIZE
	STOR T2,SEBSIZ,(T1)	;PUT IN BLOCK
	MOVX T2,SBCACT		;SET CODE TO ACTIVE
	STOR T2,SEBCOD,(T1)
	MOVE T2,ARG2		;INIT STRING STG PTR
	ADDI T2,SEBDAT		;MAKE RELATIVE TO BLOCK ORIGIN
	STOR T2,SEBSOF,(T1)
	RETSKP			;DONE
;HERE IF SPACE TO END OF BUFFER INSUFFICIENT FOR CURRENT REQUEST

ALCSE2:	ADD T4,SEBFRE		;COMPUTE (NEG) SPACE TO END OF BUFFER
	ADDM T4,SEBFCT		;ASSIGN IT
	EXCH T3,SEBFRE		;WRAPAROUND FREE POINTER
	XCT PIF			;RESTORE PI
	MOVN T4,T4		;GET POS COUNT
	CAMN T4,ARG1		;EQUAL TO REQUEST?
	JRST [	MOVE T1,T3	;YES, CAN USE BLOCK JUST ASSIGNED
		JRST ALCSE3]
	STOR T4,SEBSIZ,(T3)	;SET SIZE OF BLOCK
	PIOFF
	EXCH T3,SEBRLQ		;PUT BLOCK ON LIST TO BE RELEASED
	STOR T3,SEBCDR,@SEBRLQ
	XCT PIF			;RESTORE PI
	AOS SECHKF		;WAKEUP JOB 0 FOR RELEASE
	MOVE T1,ARG1		;GET ORIG REQUEST.  HAVE DONE WRAPAROUND
	JRST ALCSE1		; OF BUFFER, GO TRY REQUEST AGAIN

;HERE IF INSUFFICIENT SPACE IN BUFFER FOR REQUESTED BLOCK

ALCSEX:	XCT PIF			;RESTORE PI
	RET
;RELEASE SYSERR BLOCK
; T1/ PTR TO BLOCK
;	CALL RELSEB
; RETURN +1 ALWAYS, BLOCK RELEASED

	SWAPCD

RELSEB::CAME T1,SEBEFE		;RELEASING CONTIGUOUS BLOCK?
	JRST [	MOVX T2,SBCREL	;NO, SET CODE TO RELEASED
		STOR T2,SEBCOD,(T1) ;LEAVE BLOCK TO BE PICKED UP LATER
		RET]
RELSE1:	MOVX T2,SBCFRE		;SET CODE TO FREE
	STOR T2,SEBCOD,(T1)
	LOAD T2,SEBSIZ,(T1)	;GET SIZE
	ADD T1,T2		;COMPUTE END ADR OF BLOCK
	CAIN T1,SEBBFR+SEBBSZ	;END OF BUFFER?
	MOVEI T1,SEBBFR		;YES, WRAPAROUND
	MOVEM T1,SEBEFE		;UPDATE END-FREE POINTER
	ADDM T2,SEBFCT		;UPDATE FREE COUNT
	LOAD T2,SEBCOD,(T1)	;CHECK CODE OF NEXT BLOCK
	CAME T1,SEBFRE
	CAIE T2,SBCREL		;RELEASED?
	RET			;NO, DONE
	JRST RELSE1		;YES, APPEND IT TO FREE LIST

;JOB 0 FUNCTION TO RELEASE BLOCKS ON RELEASE QUEUE

SEBRBB:	SKIPN SEBRLQ		;ANYTHING ON QUEUE?
	RET			;NO
	PIOFF
	LOAD T1,SEBCDR,@SEBRLQ	;GET NEXT ITEM
	EXCH T1,SEBRLQ
	PION
	CALL RELSEB		;RELEASE IT
	JRST SEBRBB		;DO ALL ITEMS
;QUEUE SYSERR BLOCK FOR JOB 0.
; T1/ PTR TO BLOCK
;	CALL QUESEB
; RETURN +1 ALWAYS, BLOCK QUEUED
;MAY BE CALLED AT ANY PI LEVEL.

	RESCD

QUESEB::CONI PI,T2		;SAVE PI STATE
	SETZRO SEBCDR,(T1)	;MARK NEW END OF LIST
	PIOFF
	STOR T1,SEBCDR,@SEBQIN	;APPEND TO END OF QUEUE
	MOVEM T1,SEBQIN		;UPDATE END PTR
	TXNE T2,PIPION		;PI WAS ON?
	PION			;YES, RESTORE IT
	AOS SECHKF		;FIRE UP JOB 0
	RET

;UNQUEUE NEXT ITEM FROM SYSERR JOB 0 QUEUE
;	CALL UNQSEB
; RETURN +1: NOTHING LEFT ON QUEUE
; RETURN +2: SUCCESS, T1/ PTR TO BLOCK

	SWAPCD

UNQSEB::SKIPN T1,SEBQOU		;ANYTHING IN QUEUE?
	RET			;NO
	PIOFF
	LOAD T1,SEBCDR,(T1)	;YES, GET CDR
	JUMPN T1,.+3		;QUEUE BECOMING EMPTY?
	MOVEI T2,SEBQOU		;YES, FIX IN PTR
	MOVEM T2,SEBQIN
	EXCH T1,SEBQOU
	PION
	RETSKP
;COPY DATA AND STRINGS INTO SYSERR BLOCK
; T1/ POINTER TO BLOCK
; T2/ -N,,ADR	- PTR TO LIST OF ITEMS
;	CALL SEBCPY
; RETURN +1: FAILURE (NO CASES AT PRESENT)
; RETURN +2: SUCCESS
;THIS ROUTINE MOVES DATA INTO THE SYSERR BLOCK AND ALLOCATES STRING
;STORAGE AS NEEDED.

	RESCD

SEBCPY::SAVEQ
	DMOVEM T1,Q1		;KEEP BLK PTR, LIST PTR IN Q1, Q2
SEBCP1:	LOAD T4,SEBOFS,(Q2)	;GET OFFSET FOR NEXT ITEM
	ADDI T4,SEBDAT(Q1)	;MAKE POINTER TO ACTUAL WORD
	MOVEI T3,@0(Q2)		;GET POINTER TO DATA
	LOAD T1,SEBTYP,(Q2)	;GET DATA TYPE
	CAIGE T1,NSBTTB		;LEGAL?
	JRST @SBTTB(T1)		;DISPATCH
	LOAD T4,SEHCOD,(Q1)	;GET EVENT CODE INTO T4
	BUG(CHK,SEBUDT,<SEBCPY-UNKNOWN DATA TYPE>,<T1,T4>)
SEBCP9:	AOBJN Q2,SEBCP1		;LOOP FOR ALL IT