Google
 

Trailing-Edge - PDP-10 Archives - CFS_TSU04_19910205_1of1 - update/ietsrc/minint.p11
There are 8 other files named minint.p11 in the archive. Click here to see a list.
	.SBTTL	MININT - miscelaneous interrupts and strange functions

; this section contains the minor interrupts
;  (parity error, bus trap, illegal instruction, 
;  iot instruction, emt instruction, trace trap (bpt 
;  instruction and t-bit), clock, power fail and unknown).
;  this section also contains the code to record trace
;  information, which is driven by the trace interrupt
;  or by the trace macro.  the chunk ownership recording
;  subroutines and the kg11-a simulator have been
;  included here for lack of any
;  obviously better place to put them.

.REPT 0


                          COPYRIGHT (c) 1982,1981,1980, 1979
            DIGITAL EQUIPMENT CORPORATION, maynard, mass.

THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE
INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER
COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
TRANSFERRED.

THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE
AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT
CORPORATION.

DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS
SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

.ENDR
;	REVISION HISTORY

; 3(001) BS	MODIFIED TO SAVE REGISTERS ON STOPCODE WITH DEBUG OFF
;
; 3(002) 06-FEB-81 RLS	modified TRCSBR to allow block traces

; 3(003) 24-Feb-81 RLS	add call to TSKTIK in CLKINT - counts task timers where
;			they should be.
;			Also calls to once/tick routines DSPDQT,DSPDLT.

; 3(004) 10-MAR-81 RLS	Remove loop detector stopcd from CLKINT - who cares?

; 3(005) 05-oct-81 rls	Move call to DSPDLS from DSPIDL to CLKINT

VMINNT=005


VEDIT=VEDIT+VMINNT
; COME HERE FOR VARIOUS TRAPS.  BUS ERROR TRAP WITH THE DL10
;  DISABLED CAUSES A SPECIAL EXIT.  ALL OTHER TRAPS ARE
;  FATAL.

; HERE ON PARITY ERROR INTERRUPT.

MP.INT:	MOV	MP.REG,MEMERR	;SAVE FOR INTERESTED PARTIES
	STOPCD	MEM		;HALT.
PARSTP:	0			;provide mnemonic trap address

; HERE ON BUS TIMEOUT.

	.ENABL	LSB
NXMINT:	MOV	(SP)+,NXMPC	;RECORD PC OF BUS TRAP
	MOV	NXMGO,-(SP)	;REPLACE WITH SPECIFIED PC
	RTI			; GO THERE, RESTORING INTERRUPTS

; NORMALLY, BUS TRAPS COME HERE.

NXMNRM:	TST	DLGONE		;DO WE ALREADY KNOW THE DL10 IS GONE?
	BEQ	11$		;NO, SPECIAL EXIT.
	STOPCD	NXM		;YES, MUST BE FATAL ERROR.
NXMGON:	0			;provide mnemonic trap address

; HERE ON BUS ERROR TRAP AND THE DL10 IS DISABLED.  DO SPECIAL
; BRANCH IF REQUESTED.

11$:	TST	NXMSP		;ANY SPECIAL EXIT SPECIFIED?
	BEQ	12$		;NO.
	MOV	#-1,DLGONE	;YES, NOTE DL10 IS NOW GONE.
	CLR	DLGNTM		;WAIT A WHILE BEFORE TRYING TO RESTART IT
	MOV	NXMSP,SP	;LOAD STACK POINTER
	CLR	NXMSP		;ONLY DO THIS ONCE
	SEC			;SET "C" AS A FLAG
	RETURN

; HERE IF NO SPECIAL EXIT SPECIFIED

12$:	STOPCD	NXM		;HALT.
NXMSTP:	0			;provide mnemonic trap address
	.DSABL	LSB
; HERE ON ILLEGAL INSTRUCTION, IOT, EMT AND RANDOM
; INTERRUPT.

ILSINT:	MOV	#ILSINT,ILSTYP	;set trap type = illegal instruction
	BR	ERRINT		;go process the trap

IOTINT:	MOV	#IOTINT,ILSTYP	;set trap type = IOT
	BR	ERRINT		;go process the trap

EMTINT:	JMP	SKED		;scheduler call

ERRINT:	MOV	(SP)+,ILSERR	;SAVE TRAP INFO
	MOV	(SP)+,ILSERR+2	;IN CASE ANYBODY IS INTERESTED
	STOPCD	ILS		;HALT.
ERRSTP:				;provide a mnemonic for ddt

; HERE ON POWER FAIL.  NO ATTEMPT IS MADE TO RECOVER, SINCE
;  IT IS PRUDENT TO RUN CHK11 AFTER A POWER FAILURE.

PWFINT:
.IIF NDF,FT2020, HALT			;POWER FAILURE.
.IIF DF,FT2020, BR	.		;DON'T HALT FOR 2020s
	.BLKW	20.
TRPSTK:	.WORD	0		;SP AT TRAP TIME GOES HERE

TRPPS:	.WORD	0		;PS AT STOPCD

TRPTRP:	MOV	SP,#0		;trap within trap processing
	MOV	R0,#0
	MOV	R1,#0
	MOV	R2,#0
	MOV	R3,#0
	MOV	R4,#0
	MOV	R5,#0
	HALT

; HERE ON TRAP INSTRUCTION.  THIS IS USED ONLY BY THE STOPCD
; MACRO.

TRPINT:	TST	TRPERR		;check if already been here
	BNE	TRPTRP		;ugh!
	MOV	(SP)+,TRPERR	;SAVE TRAP INFO
	TST	(SP)+		;we already stored condition codes
	MOV	TRPPS,TRPERR+2

	MOV	R0,STOPR0	;SAVE THE ACS
	MOV	R1,STOPR1	;FOR DEBUGGING
	MOV	R2,STOPR2
	MOV	R3,STOPR3
	MOV	R4,STOPR4
	MOV	R5,STOPR5
	MOV	(SP)+,STOPSP	;SAVE STACK POINTER, TOO.

.IF EQ,FTKG11			;IF WE HAVE A KG11-A...
	MOV	@#KG.STS,STOPKG	;SAVE KG11-A REGISTERS
	MOV	@#KG.BCC,STOPKG+2
	MOV	@#KG.DTA,STOPKG+4
.ENDC ;.IF EQ,FTKG11
	CLR	R5		;LINE NUMBER*2
11$:	MOV	LINTBL(R5),R4	;GET LINE CONTROL BLOCK
	BEQ	12$		;NONE
	TST	LB.TRP(R4)	;be paranoid
	BEQ	12$
	CALL	@LB.TRP(R4)	;store the device registers in the lcb
12$:	ADD	#2,R5		;GO TO NEXT LINE
	CMP	#NLINES*2,R5	;DONE ENOUGH?
	BNE	11$		;NO, DO ANOTHER.
.IF NE,FT.KDP
	CALL	TRAPMD		;STOP THE KMC11S [1A(731)]
.ENDC ;.IF NE,FT.KDP
	MOV	TRPERR,R0	;GET OLD PC
	SUB	#2,R0		;POINT TO TRAP INSTR
	MOVB	(R0),TRPCOD	;GET TRAP CODE
	BNE	13$		;BRANCH IF VALID CODE
.IIF NDF,FT2020, HALT			;NOT--SOMETHING VERY WRONG!
.IIF DF,FT2020, BR	.	;DON'T HALT ON A 2020

13$:	MOV	TRPCOD,R1	;FETCH STOP CODE
	CALL	DLSTCS		;STORE STOP CODE SO PDP-10 CAN SEE IT.
14$:	MOV	TRPCOD,R0	;SHOW STOP CODE IN LIGHTS (11/40)
.IF NDF,FT2020 ;IF NOT ON A 2020
	HALT			;ALL DONE.
	BR	14$		;DON'T ALLOW "CONTINUE".
.ENDC ;END IF NDF,FT2020
.IIF DF,FT2020, BR	.	;DON'T HALT ON A 2020

;general debugging stopcode - "CALL" it
;	intended for patching in via DDT11.

BUGHLT:	STOPCD	BUG
BUGSTP:	BR	BUGHLT
	.SBTTL		CLOCK INTERRUPTS - ONCE A JIFFIE FROM THE KW11-L

CLKINT:	INTSKD	NOTRACE
	CLKOFF			;turn off clock so it can't reinterrupt if at low level
	MTPS	#PR.CLK*40	;set the clock service level

	SAVE	<R0,R1,R2,R3,R4,R5>
	INC	JIFCLK		;INCREMENT JIFFIE CLOCK
	BIT	#77,JIFCLK	;HAVE A MULT. OF 64 JIFFIES PAST?
	BNE	10$		;NO.
	CLR	BSYSEC		;yes - reset previous second counters
	CLR	IDLSEC
	BIT	#7777,JIFCLK	;check 4096 jiffies
	BNE	10$
	CLR	BSYMIN		;yes - reset 1 minute counters
	CLR	IDLMIN

10$:	TST	DSPTCB		;sample busy/idleness
	BNE	11$		;currently busy
	INC	IDLMIN		;currently idle
	INC	IDLSEC
	BR	12$

11$:	INC	BSYMIN
	INC	BSYSEC

12$:	CALL	DSPDQT		;DO ONCE-A-TICK DQ11(line driver) CODE
	CALL	DSPDLT		;DO ONCE-A-TICK DTE(10 interface device) CODE
	CALL	TSKTIK		;decrement all the task timers

	DEC	SECCLK		;count down  the second timer
	BGT	20$		;not yet
	MOV	#JIFSEC,SECCLK	;reset the timer
	CALL	DSPDLS		;do the once per second 10 interface function
20$:
	RESTOR	<R5,R4,R3,R2,R1,R0>
	CLKON			;turn the clock back on
	RTI			; AND EXIT THE INTERRUPT.

CLRALR:	SAVE	R4		;flush line alarm
	MOV	TCLCB(R5),R4	;get lcb
	CLR	LB.ALR(R4)	;clear timer - now no flags can be set
	BIC	#EBALR*400+EBALR,(R5);clear any flags that might have been set
	RESTOR	R4
	RETURN


DSPDQT:	MOV	#LINTBL,R2	;do once per tick code for all lines
	MOV	NSLINS,R1
10$:	MOV	(R2)+,R4	;get line block
	TST	LB.TIK(R4)	;be paranoid
	BEQ	20$
	SAVE	<R1,R2>
	CALL	@LB.TIK(R4)	;do it
	RESTOR	<R2,R1>
20$:	SOB	R1,10$
	RETURN
	.SBTTL		TRACE TRAP INTERRUPTS

; HERE ON TRACE INTERRUPTS, CAUSED BY BIT 4 IN THE PS.
;  RECORD THE CURRENT PC AND PS FOR DEBUGGING.

.IF NE,FTRACE
.IFT
BPTINT:	MOV	R0,-(SP)	;SAVE R0
	TST	TRCBTS		;ARE WE DOING EVENT TRACING?
	BNE	12$		;YES, DONT DO INSTRUCTION TRACING
	MOV	TRCPTR,R0	;NO, GET CURRENT POINTER
	CMP	#TRCTBE,R0	;REACHED END OF TABLE?
	BNE	11$		;NO.
	MOV	#TRCTBS,R0	;YES, SET TO BEGINNING
11$:	MOV	2(SP),(R0)+	;STORE PC IN TABLE
	MOV	4(SP),(R0)+	;STORE PS IN TABLE
	MOV	R0,TRCPTR	;STORE UPDATED POINTER

; THIS IS A GOOD PLACE TO PUT AD-HOCK DEBUGGING CODE, FOR EXAMPLE,
;  TO CHECK FOR A LOCATION BEING WIPED OUT.

12$:
.IF NE,DEBUG
	BR	14$		;NO SPECIAL CHECKS RIGHT NOW

; HERE ON FAILURE.

13$:	MOV	(SP)+,R0	;RESTORE R0
	STOPCD	DBG		;DEBUG STOP !!

; HERE ON NO FAILURE

14$:
.ENDC ;.IF NE,DEBUG
	MOV	(SP)+,R0	;RESTORE R0
	RTT			;DISMISS TRACE TRAP
.IFF
BPTINT:	STOPCD	ILS		;ILL INSTR IF NOT TRACING
.ENDC ;.IF NE,FTRACE
	.SBTTL		TRCSBR,TRCSBB - trace functions called by TRACE macro

; SUBROUTINE TO RECORD AN EVENT IN THE TRACE TABLE.  CALLED
;  BY THE "TRACE" MACRO.

.IF NE,FTRACE
	.ENABL	LSB
TRCSBR:				;entry for single variable trace
	MOV	(SP),-(SP)	;map into block form
	MOV	#1,2(SP)	;block of 1

TRCSBB:				;entry for stack block traces
				;SP/ret
				;SP+2/n = #variables to trace
				;SP+4/last arg
				;...
				;SP+4+2*n-2/1st arg
	MFPS	-(SP)		;save interrupt level
	MTPS	#BR7		;disable interrupts
	MOV	(SP)+,TRCSVP
	MOV	R0,TRCSV0	;save R0,R1
	MOV	R1,TRCSV1
	MOV	TRCPTR,R1	;get trace table pointer
	MOV	(SP),(R1)+	;trace caller
	CMP	#TRCTBE,R1	;check wrap
	BHI	4$
	MOV	#TRCTBS,R1
4$:	MOV	2(SP),R0	;calc ptr to 1st arg
	INC	R0
	INC	R0
	ASL	R0
	ADD	SP,R0		;R0 -> 1st arg + 2
	MOV	R0,TRCA1
	BR	6$
5$:	MOV	-(R0),(R1)+	;trace args
	CMP	#TRCTBE,R1	;check wrap
	BHI	6$
	MOV	#TRCTBS,R1
6$:	DEC	2(SP)		;count it
	BGE	5$
	MOV	R1,TRCPTR	;update trac ptr
	MOV	(SP)+,R0	;get ret loc
	MOV	TRCA1,SP	;flush all args from stack
	MOV	R0,-(SP)	;put ret on stack before turning on interrupts
	MOV	TRCSV0,R0	;restore registers
	MOV	TRCSV1,R1
	MTPS	TRCSVP		;allow the world to breathe again
	RETURN			;done

TRCBLK:				;entry to trace a memory block
				;SP/ret
				;ret/block adr
				;ret+2/block length
	MFPS	-(SP)		;save interrupt level
	MTPS	#BR7		;disable interrupts
	SAVE	<R0,R1,R2,R3>	;save the regs
	MOV	12(SP),R0	;get ret loc
	MOV	TRCPTR,R1	;get trace ptr
	MOV	R0,(R1)+	;trace caller
	CMP	#TRCTBE,R1	;check wrap
	BHI	15$
	MOV	#TRCTBS,R1
15$:	MOV	(R0)+,R2	;get trace block pointer
	MOV	(R0)+,R3	;get length
	MOV	R0,12(SP)	;update ret loc
20$:	MOV	(R2)+,(R1)+	;trace args
	CMP	#TRCTBE,R1	;check wrap
	BHI	25$
	MOV	#TRCTBS,R1
25$:	SOB	R3,20$
	MOV	R1,TRCPTR	;update trac ptr
	RESTOR	<R3,R2,R1,R0>	;restore the regs
	MTPS	(SP)+		;allow the world to breathe again
	RETURN			;done
	.DSABL	LSB

TRCSV0:	.WORD	0
TRCSV1:	.WORD	0
TRCA1:	.WORD	0
TRCSVP:	.WORD	0
.ENDC ;.IF NE,FTRACE
	.SBTTL		CHUNK OWNER RECORDING

.IF NE,CHOWNR

; SUBROUTINE TO RECORD THE OWNER OF A CHUNK FOR DEBUGGING
;  PURPOSES.
;
; R0 = CHUNK ADDRESS
; R1 = OWNER ID (BIT 0 = 0)

CHOWNG:	MOV	R0,-(SP)	;SAVE CHUNK ADDRESS
	CALL	CHOWNX		;COMPUTE INDEX INTO OWNER TABLE
	CMP	R0,#<CHOWNL*2>	;ROOM TO FIT IN TABLE?
	BHIS	11$		;NO, IGNORE IT.
	MOV	R1,CHOWNT(R0)	;YES, STORE IN TABLE
11$:	MOV	(SP)+,R0	;RESTORE CHUNK ADDRESS
	RETURN

; SUBROUTINE TO MARK A CHUNK FREE IN THE OWNER TABLE.
;  THE ID OF THE OWNER IS NOT OBLITERATED.
;
; R0 = CHUNK ADDRESS

CHOWNF:	MOV	R0,-(SP)	;SAVE CHUNK ADDRESS
	CALL	CHOWNX		;COMPUTE INDEX INTO CHUNK OWNER TABLE
	CMP	R0,#<CHOWNL*2>	;WILL THE TABLE HOLD THIS INDEX?
	BHIS	11$		;NO, IGNORE IT.
	BIT	#1,CHOWNT(R0)	;check if freeing a free chunk
	BEQ	10$		;ok
	STOPCD	BUG

10$:	BIS	#1,CHOWNT(R0)	;YES, FLAG CHUNK NOW FREE.
11$:	MOV	(SP)+,R0	;RESTORE CHUNK ADDRESS
	RETURN
; SUBROUTINE TO COMPUTE THE INDEX INTO THE OWNER TABLE.
;
; R0 = CHUNK ADDRESS
;
; ON RETURN: 
;
; R0 = INDEX INTO THE OWNER TABLE
;
; IF THE CHUNK ADDRESS IS INVALID, THIS SUBROUTINE NEVER RETURNS.

CHOWNX:	SAVE	<R1,R2>
	SUB	CHLOW,R0	;CONVERT CHUNK ADDRESS TO RELATIVE
	BLO	20$
	CLR	R1		;COMPARISON ADDRESS
	CLR	R2		;INDEX
11$:	CMP	R0,R1		;HAVE WE REACHED THE CHUNK?
	BLOS	12$		;YES, R2 HAS THE INDEX.
	ADD	#CHSIZE,R1	;NO, INCREASE COMPARISION ADDRESS
	ADD	#2,R2		; AND KEEP INDEX IN PARALLEL
	BR	11$		;SEE IF WE HAVE REACHED IT.

; HERE IF WE HAVE REACHED THE CHUNK ADDRESS

12$:	BLO	20$
	MOV	R2,R0		;PUT INDEX INTO R0
	RESTOR	<R2,R1>
	RETURN

20$:	STOPCD	BAF

.ENDC ;.IF NE,CHOWNR
	.SBTTL		KG11-A SIMULATION SUBROUTINE

; SUBROUTINE TO ACCUMULATE A CHARACTER INTO THE BCC.
;
; CALL:
;	MOV	ARG,-(SP)	;PUT ARG ON STACK
;	CALL	KGSIMA	;ACCUMULATE BCC
;
; ALL REGISTERS ARE PRESERVED.

.IF NE,FTKG11

KGSIMA:	MOV	R0,-(SP)	;SAVE R0
	MOV	4(SP),R0	;GET ARGUMENT CHARACTER
	MOV	R1,-(SP)	;SAVE R1
	MOV	R2,-(SP)	;SAVE R2
	MOV	KGSIMW,R1	;R1 = ACCUMULATED CRC
	XOR	R1,R0		;EXCLUSIVE OR BYTE WITH OLD CRC
	MOV	R0,R2		;SAVE A COPY OF RESULT
	BIC	#177760,R0	;EXTRACT LOW 4 BITS
	ASL	R0		;BYTE ADDRESS , WORD INDEX
	MOV	KGTBL(R0),R0	;GET FIRST MODIFIER WORD
	BIC	#177417,R2	;NOW EXTRACT HIGH FOUR BITS
	ASR	R2		;SET UP TO ENTER SECOND HALF
	ASR	R2		;AGAIN BYTE ADDRESS TO
	ASR	R2		;WORD INDEX
	MOV	KGTBL+32.(R2),R2 ;GET SECOND MODIFIER WORD
	XOR	R2,R0		;EXCLUSIVE OR MODIFIER VALUES
	CLRB	R1		;CLEAR LOW BYTE OF OLD CRC
	SWAB	R1		;NOW WORK ON UPPER BYTE
	XOR	R0,R1		;PRODUCE UPDATED CRC
	MOV	R1,KGSIMW	;SAVE NEW VALUE OF CRC REGISTER
	MOV	(SP)+,R2	;RESTORE R2
	MOV	(SP)+,R1	;RESTORE R1
	MOV	(SP)+,R0	;RESTORE R0
	MOV	(SP)+,(SP)	;REMOVE ARGUMENT FROM STACK
	RETURN
; THIS TABLE IS USED BY THE KG11-A SIMULATOR TO FORM
;  A BCC.  THE FIRST HALF OF THE TABLE IS INDEXED BY THE
;  LOW FOUR BITS, THE SECOND HALF BY THE HIGH FOUR BITS.

KGTBL:	.WORD	0		;FIRST HALF OF TABLE
	.WORD	140301
	.WORD	140601
	.WORD	500
	.WORD	141401
	.WORD	1700
	.WORD	1200
	.WORD	141101
	.WORD	143001
	.WORD	3300
	.WORD	3600
	.WORD	143501
	.WORD	2400
	.WORD	142701
	.WORD	142201
	.WORD	2100

	.WORD	0		;SECOND HALF OF TABLE
	.WORD	146001
	.WORD	154001
	.WORD	12000
	.WORD	170001
	.WORD	36000
	.WORD	24000
	.WORD	162001
	.WORD	120001
	.WORD	66000
	.WORD	74000
	.WORD	132001
	.WORD 	50000
	.WORD	116001
	.WORD	104001
	.WORD	42000

.ENDC ;.IF NE,FTKG11
; TTY ROUTINES FOR CHK11

	.CKTTS