Trailing-Edge
-
PDP-10 Archives
-
BB-H348C-RM_1982
-
swskit-v21/debugging-tools/dts/dtspsi.mac
There are no other files named dtspsi.mac in the archive.
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1978 BY DIGITAL EQUIPMENT CORPORATION
;
TITLE DTSPSI - DTS PROGRAM SOFTWARE INTERRUPT MODULE
SEARCH DTSUNV,MACSYM,MONSYM
.REQUIRE SYS:MACREL
SALL
ENTRY PSIINI
ENTRY PION
ENTRY PIOFF
ENTRY SLEEP
ENTRY PSISV1,PSISV2,PSISV3
INTERN AWOKEN,TIMOUT
PDLEN==200
;THIS MODULE CONTAINS THE ROUTINES WHICH PERFORM THE INTERFACE FUNCTION
; TO THE SOFTWARE INTERRUPT SYSTEM
PAGE
SUBTTL PSIINI - INITIALIZE THE SOFTWARE INTERRUPT SYSTEM
;&PSIINI - INITIALIZE THE SOFTWARE INTERRUPT SYSTEM
;
;PSIINI - ROUTINE TO INITIALIZE THE PSI SYSTEM
;
;ACCEPTS: T1/ ADDRESS OF ARGUMENT BLOCK
;
;ARGUMENT BLOCK/ COUNT
; LEVEL#,,INTERRUPT ROUTINE ADDRESS
; .
; .
; .
;
;RETURNS +1: ALWAYS
; WITH LEFT 9 BITS OF ARGUMENT BLOCK CONTAINING CHANNEL
; NUMBER ASSIGNED
;
PSIINI: ;ENTRY
STKVAR <ARGPTR>
MOVEM T1,ARGPTR ;SAVE ARG POINTER
MOVEI T1,.FHSLF
SETOI T2,0
DIC ;DISABLE ALL CHANNELS FOR THIS PROCESS
CIS ;CLEAR THE INTERRUPT SYSTEM
CALL CLRTBL ;GO RESET CHNTAB
MOVE T1,ARGPTR ;RESTORE ARG POINTER
MOVN T2,(T1) ;GET NEGATIVE OF COUNT
HRLI T1,(T2) ;MAKE AOBJN POINTER
AOJ T1,0 ;POINT TO FIRST ENTRY
MOVEI T3,CHNTAB
HRLZI T4,(1B0) ;SET CHANNEL 0 BIT
;T1 CONTAINS CURRENT COUNT IN LEFT HALF
; AND ADDRESS OF CURRENT ENTRY IN USERS
; ARGUMENT BLOCK IN RIGHT HALF
;T3 CONTAINS ADDRESS OF CURRENT ENTRY IN
; CHNTAB
;T4 CONTAINS A BIT WHOSE POSITION REPRESENTS
; THE CURRENT CHANNEL NUMBER, I.E., BIT 5
; IS CHANNEL 5
;. . .
PAGE
;
; . . .
;
PSIIN1: ;TOP OF LOOP FOR EACH CHNTAB ENTRY
SKIPN (T3) ;CHNTAB ENTRY HERE ?
JRST PSIIN2 ;NO, MAKE NEW ENTRY
LSH T4,-1 ;YES, BUMP TO NEXT CHANNEL
AOJ T3,0 ; IN CHNTAB
JRST PSIIN1
PSIIN2: ;HERE WHEN AVAILABLE SLOT IN CHNTAB
LDB T2,[POINT 24,(T1),35] ;GET USERS LEVEL & ROUTINE ADDRESS
JUMPE T2,PSIIN3 ;IF ZERO DON'T DO ANYTHING
MOVEM T2,(T3) ;STORE IN CHNTAB
MOVEI T2,(T3) ;GET CURRENT CHNTAB ADDRESS
SUBI T2,CHNTAB ;CALCULATE OFFSET, WHICH IS CHANNEL NUMBER
DPB T2,[POINT 9,(T1),8] ;UPDATE USERS ARGUMENT BLOCK
IORM T4,ONCHAN ;UPDATE ACTIVE CHANNEL WORD
PSIIN3: ;HERE IF USERS ARG WORD NULL
AOBJN T1,PSIIN1 ;PROCESS USERS NEXT ENTRY
; FALLS THRU WHEN COUNT EXPIRES
; NOTE IF USER ENTRY WAS NULL
; IT IS JUST PASSED OVER
SETZM AWOKEN ;CLEAR WAKE-UP FLAG
MOVEI T1,.FHSLF ;THIS FORK
MOVE T2,[LEVTAB,,CHNTAB]
SIR ;SET UP LEVTAB AND CHNTAB
MOVE T2,ONCHAN ;GET MASK OF CHANNELS TO ENABLE
AIC ;ACTIVATE THE CHANNELS
EIR ;ENABLE THE PI SYSTEM FOR INTERRUPTS
RET ;DONE
PAGE
SUBTTL CLRTBL - CLEAR THE PSI DATA BASE TABLES
CLRTBL: ;ENTRY POINT
SETZM ONCHAN ;CLEAR MASK OF ACTIVE CHANNELS
SETZM CHNTAB ;CLEAR CHNTAB
MOVE T1,[CHNTAB,,CHNTAB+1]
BLT T1,CHNTAB+35
SETOM ICHAOV ;SET -1 IN RESERVED CHANNELS
SETOM ICHFOV
SETOM ICH008
SETOM ICHPOV
SETOM ICHEOF
SETOM ICHDAE
SETOM ICHQTA
SETOM ICH013
SETOM ICHTOD
SETOM ICHILI
SETOM ICHIRD
SETOM ICHIWR
SETOM ICHIEX
SETOM ICHIFT
SETOM ICHMSE
SETOM ICHTRU
SETOM ICHNXP
RET ;DONE, RETURN
PAGE
SUBTTL PIOFF/PION ROUTINES
;&PIOFF/PION ROUTINES
;
;ROUTINES TO TURN OFF AND ON THE INTERRUPT SYSTEM
;ALL ACS ARE PRESERVED
;
;
;TURN INTERRUPT SYSTEM OFF
;
PIOFF: ;ENTRY
PUSH P,T1 ;SAVE ALL ACS
MOVEI T1,.FHSLF ;THIS FORK
DIR ;DISABLE INTERRUPT SYSTEM
POP P,T1 ;RESTORE AC
RET ;AND RETURN
;
;TURN INTERRUPT SYSTEM ON
;
PION: ;ENTRY
PUSH P,T1 ;SAVE ALL ACS
MOVEI T1,.FHSLF ;THIS FORK
EIR ;ENABLE INTERRUPTS AGAIN
POP P,T1 ;RESTORE AC
RET ;AND RETURN
;
;ROUTINE TO FORCE SINR/SOUTR OUT OF MONITOR MODE IF LINK
; ABORT DETECTED IN INTERRUPT ROUTINE
;
;ACCEPTS: T1/INTERRUPT LEVEL
;
FORCUS:
MOVE T2,@LEVTAB-1(T1) ;GET CURRENT PC THIS LEVEL
MOVE T3,(T2) ;GET THE INSTRUCTION THERE
CAME T3,[SOUTR] ;IS IT SOUTR?
CAMN T3,[SINR] ;OR SINR?
JRST FORCU1 ;YES...
CAME T3,[SOUT] ;OR SOUT?
CAMN T3,[SIN] ;OR SIN?
JRST FORCU1 ;YES...
MOVE T3,-1(T2) ;NO..., GET INSTRUCTION AT PC-1
CAME T3,[SOUTR] ;IS IT SOUTR?
CAMN T3,[SINR] ;OR SINR?
JRST FORCU1 ;YES...
CAME T3,[SOUT] ;OR SOUT?
CAMN T3,[SIN] ;OR SIN?
JRST FORCU1 ;YES...
RET ;NO..., NOTHING DOING
FORCU1: ;HERE TO LOOK FURTHER
MOVE T4,SAVTAB-1(T1) ;GET ADDRESS OF AC SAVE AREA THIS LEVEL
MOVE LCBPTR,LCBPTR(T4) ;NOTE: THIS MUST BE !MOVE! TO RESTORE POINTER
LOAD T3,LCBJFN ;GET THE JFN OF LINK WE ARE WORKING ON
CAME T3,1(T4) ;IS IT THIS JFN?
RET ;NO...
LOAD T3,LCBSTS ;GET LINK STATUS
TXNE T3,MO%CON ;STILL CONNECTED?
RET ;YES...
TXON T2,PC%USR ;NO..., SET USER MODE TO FORCE JSYS
MOVEM T2,@LEVTAB-1(T1) ; BACK TO USER MODE
RET
PAGE
SUBTTL SLEEP - PUT ROUTINE TO SLEEP FOR INTERVAL OR FOREVER
;&SLEEP - PUT ROUTINE TO SLEEP FOR INTERVAL OR FOREVER
;
;SLEEP - SLEEP FOR NUMBER OF SECONDS, INDEFINITELY, OR NOT AT ALL
;
;ACCEPTS: T1/ TIME IN SECONDS TO SLEEP
; IF < 0 -- SLEEP INDEFINITELY
; IF = 0 -- DON'T SLEEP AT ALL
; IF > 0 -- SLEEP FOR NUMBER OF SECONDS
;
;
SLEEP: ;ENTRY
SETZM TIMOUT ;CLEAR TIMEOUT FLAG
SKIPN T1 ;SLEEP AT ALL ??
RET ;NO, JUST RETURN
SKIPL T1 ;TIMED SLEEP ??
IMULI T1,^D1000 ;YES, MAKE MILLISECONDS
SLP0:
SKIPE AWOKEN ;SEE IF WAKE-UP HAS OCCURED
JRST SLP1 ;YES, DON'T SLEEP
SKIPG T1 ;TIMED SLEEP ?
WAIT ;NO, SLEEP FOREVER
DISMS ;YES, SLEEP FOR A TIME
JFCL
SETOM TIMOUT ;SET FLAG TO SAY TIME EXPIRED
SLP1:
SETZM AWOKEN ;CLEAR "NEED WAKE-UP" FLAG
RET ;DONE, RETURN
;
;THE CORRESPONDING WAKEUP ROUTINE
;
;ACCEPTS: T1/INTERRUPT LEVEL
WAKEUP: ;ENTRY
SETOM AWOKEN ;TURN ON WAKEUP FLAG
MOVEI T2,SLP1 ;ADDRESS TO WHERE WAKEUP
HRRZ T3,@LEVTAB-1(T1) ;GET CURRENT PC THIS LEVEL
CAIL T3,SLP0 ;SLEEPING ??
CAILE T3,SLP1
SKIPA ;NO, JUST RETURN
HRRM T2,@LEVTAB-1(T1) ;YES, ALTER CURRENT PC
RET
PAGE
SUBTTL PSISVn - SAVE REGISTERS AND PROVIDE CO-ROUTINE FOR RETURN
PSISV1: ;LEVEL 1 INTERRUPT SAVE ROUTINE
JFCL ;OVERLAID BY JSR PC
MOVEM 0,SAVAL1 ;SAVE AC 0
MOVE 0,[XWD 1,SAVAL1+1] ;BLT POINTER TO SAVE REST OF AC'S
BLT 0,SAVAL1+17 ;SAVE AC'S
MOVE P,[IOWD PDLEN,L1PDL] ;SETUP PDL FOR INTERRUPT LEVEL
PUSH P,[DBRK1] ;SET UP CO-ROUTINE RETURN
JRST @PSISV1 ;RETURN TO USER
DBRK1:
MOVEI T1,1 ;WAKEUP LEVEL 1
CALL WAKEUP
MOVEI T1,1 ;FORCE USER MODE FOR LEVEL 1
CALL FORCUS ; IF DOING NETWORK JSYS
MOVE P,[XWD SAVAL1,0] ;RESTORE AC'S
BLT P,17
DEBRK
PSISV2: ;LEVEL 2 INTERRUPT SAVE ROUTINE
JFCL ;OVERLAID BY JSR PC
MOVEM 0,SAVAL2 ;SAVE AC 0
MOVE 0,[XWD 1,SAVAL2+1] ;BLT POINTER TO SAVE REST OF AC'S
BLT 0,SAVAL2+17 ;SAVE AC'S
MOVE P,[IOWD PDLEN,L2PDL] ;SETUP PDL FOR INTERRUPT LEVEL
PUSH P,[DBRK2] ;SET UP CO-ROUTINE RETURN
JRST @PSISV2 ;RETURN TO USER
DBRK2:
MOVEI T1,2 ;WAKEUP LEVEL 2
CALL WAKEUP
MOVEI T1,2 ;FORCE USER MODE FOR LEVEL 2
CALL FORCUS ; IF DOING NETWORK JSYS
MOVE P,[XWD SAVAL2,0] ;RESTORE AC'S
BLT P,17
DEBRK
PSISV3: ;LEVEL 3 INTERRUPT SAVE ROUTINE
JFCL ;OVERLAID BY JSR PC
MOVEM 0,SAVAL3 ;SAVE AC 0
MOVE 0,[XWD 1,SAVAL3+1] ;BLT POINTER TO SAVE REST OF AC'S
BLT 0,SAVAL3+17 ;SAVE AC'S
MOVE P,[IOWD PDLEN,L3PDL] ;SETUP PDL FOR INTERRUPT LEVEL
PUSH P,[DBRK3] ;SET UP CO-ROUTINE RETURN
JRST @PSISV3 ;RETURN TO USER
DBRK3:
MOVEI T1,3 ;WAKEUP LEVEL 3
CALL WAKEUP
MOVEI T1,3 ;FORCE USER MODE FOR LEVEL 3
CALL FORCUS ; IF DOING NETWORK JSYS
MOVE P,[XWD SAVAL3,0] ;RESTORE AC'S
BLT P,17
DEBRK
PAGE
SUBTTL LITERAL POOL AND CONSTANTS
;&LITERAL POOL AND CONSTANTS
LTPOOL: LIT ;BEGINNING OF LITERAL POOL
LIST
PAGE
;
;INTERRUPT CHANNEL TABLES
;
ONCHAN: BLOCK 1 ;MASK OF ACTIVE CHANNELS
CHNTAB:
ICH000: BLOCK 1 ;ASSIGNABLE CHANNEL 0
ICH001: BLOCK 1 ;ASSIGNABLE CHANNEL 1
ICH002: BLOCK 1 ;ASSIGNABLE CHANNEL 2
ICH003: BLOCK 1 ;ASSIGNABLE CHANNEL 3
ICH004: BLOCK 1 ;ASSIGNABLE CHANNEL 4
ICH005: BLOCK 1 ;ASSIGNABLE CHANNEL 5
ICHAOV: BLOCK 1 ;ARITHMETIC OVERFLOW
ICHFOV: BLOCK 1 ;FLOATING OVERFLOW
ICH008: BLOCK 1 ;RESERVED
ICHPOV: BLOCK 1 ;PDL OVERFLOW
ICHEOF: BLOCK 1 ;END OF FILE
ICHDAE: BLOCK 1 ;DATA ERROR
ICHQTA: BLOCK 1 ;QUOTA EXCEEDED
ICH013: BLOCK 1 ;RESERVED
ICHTOD: BLOCK 1 ;TIME OF DAY (RESERVED)
ICHILI: BLOCK 1 ;ILLEG INSTRUCTION
ICHIRD: BLOCK 1 ;ILLEGAL READ
ICHIWR: BLOCK 1 ;ILLEGAL WRITE
ICHIEX: BLOCK 1 ;ILLEGAL EXECUTE (RESERVED)
ICHIFT: BLOCK 1 ;INFERIOR FORK TERMINATION
ICHMSE: BLOCK 1 ;MACHINE SIZE EXCEEDED
ICHTRU: BLOCK 1 ;TRAP TO USER (RESERVED)
ICHNXP: BLOCK 1 ;NONEXISTENT PAGE REFERENCED
ICH023: BLOCK 1 ;ASSIGNABLE CHANNEL 23
ICH024: BLOCK 1 ;ASSIGNABLE CHANNEL 24
ICH025: BLOCK 1 ;ASSIGNABLE CHANNEL 25
ICH026: BLOCK 1 ;ASSIGNABLE CHANNEL 26
ICH027: BLOCK 1 ;ASSIGNABLE CHANNEL 27
ICH028: BLOCK 1 ;ASSIGNABLE CHANNEL 28
ICH029: BLOCK 1 ;ASSIGNABLE CHANNEL 29
ICH030: BLOCK 1 ;ASSIGNABLE CHANNEL 30
ICH031: BLOCK 1 ;ASSIGNABLE CHANNEL 31
ICH032: BLOCK 1 ;ASSIGNABLE CHANNEL 32
ICH033: BLOCK 1 ;ASSIGNABLE CHANNEL 33
ICH034: BLOCK 1 ;ASSIGNABLE CHANNEL 34
ICH035: BLOCK 1 ;ASSIGNABLE CHANNEL 35
PAGE
SUBTTL VARIABLE DATA STORAGE
VAR
AWOKEN: BLOCK 1 ;WAKE-UP FLAG FOR SLEEP ROUTINE
TIMOUT: BLOCK 1 ;TIME EXPIRED FLAG
LEVTAB: LEV1PC ;LEVEL 1 PC
LEV2PC ;LEVEL 2 PC
LEV3PC ;LEVEL 3 PC
LEV1PC: BLOCK 1 ;PC AT ENTRY TO LEVEL 1 INTERRUPT CODE
LEV2PC: BLOCK 1 ;PC AT ENTRY TO LEVEL 2 INTERRUPT CODE
LEV3PC: BLOCK 1 ;PC AT ENTRY TO LEVEL 3 INTERRUPT CODE
SAVTAB: SAVAL1 ;LEVEL 1 AC SAVE AREA
SAVAL2 ;LEVEL 2 AC SAVE AREA
SAVAL3 ;LEVEL 3 AC SAVE AREA
L1PDL: BLOCK PDLEN ;PUSHDOWN LIST FOR LEVEL 1 INTERRUPT CODE
SAVAL1: BLOCK 20 ;SAVE AREA FOR AC'S LEVEL 1
L2PDL: BLOCK PDLEN ;PUSHDOWN LIST FOR LEVEL 2 INTERRUPT CODE
SAVAL2: BLOCK 20 ;SAVE AREA FOR AC'S LEVEL 2
L3PDL: BLOCK PDLEN ;PUSHDOWN LIST FOR LEVEL 3 INTERRUPT CODE
SAVAL3: BLOCK 20 ;SAVE AREA FOR AC'S LEVEL 3
END