Trailing-Edge
-
PDP-10 Archives
-
AP-4178E-RM
-
swskit-sources/diag.mac
There are 50 other files named diag.mac in the archive. Click here to see a list.
;<3A.MONITOR>DIAG.MAC.8, 13-Jul-78 13:45:52, EDIT BY MILLER
;CHECK FOR "RESIDENT" PAGE AT DGEXR1. DON'T CALL MULKCR IF SO
;<1BOSACK>DIAG.MAC.1000, 5-Jun-78 19:03:55, EDIT BY BOSACK
;<3A.MONITOR>DIAG.MAC.6, 24-May-78 12:59:23, EDIT BY MILLER
;REQUIRE EXCLUSIVE ACCESS IF ANY UNIT ON CHANNEL IS IN ANY STRUCTURE
;<3A.MONITOR>DIAG.MAC.5, 5-Feb-78 14:14:12, EDIT BY MILLER
;CALL UNWEPT IN "RELEASE MEM" FUNCTION
;<3A.MONITOR>DIAG.MAC.4, 23-Jan-78 20:51:15, EDIT BY MILLER
;ADD MEM CONTROL FUNCTIONS FOR TGHA
;<3-MONITOR>DIAG.MAC.9, 8-Nov-77 20:32:04, EDIT BY MILLER
;MAINTAIN PNSKDC
;<3.SM10-RELEASE-3>DIAG.MAC.2, 1-Nov-77 00:42:37, Edit by MCLEAN
;ADD SEARCH OF PROKL
;<3-MONITOR>DIAG.MAC.7, 21-Oct-77 14:59:23, EDIT BY BOSACK
;CODE SHOULD BE RESIDENT, CALL LOWER LEVEL IN SEC0
;<3-MONITOR>DIAG.MAC.6, 10-Oct-77 10:09:35, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>DIAG.MAC.5, 10-May-77 20:07:45, EDIT BY BOSACK
;MOVE STORAGE TO STG
;<3-MONITOR>DIAG.MAC.4, 24-Mar-77 01:54:59, Edit by MCLEAN
;<3-MONITOR>DIAG.MAC.3, 24-Mar-77 01:26:42, Edit by MCLEAN
;<3-MONITOR>DIAG.MAC.2, 24-Mar-77 00:37:59, Edit by MCLEAN
;<3-MONITOR>DIAG.MAC.1, 24-Mar-77 00:36:08, Edit by MCLEAN
;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,PHYPAR,SERCOD,PROKL
TTITLE DIAG
; CODE TO SUPPORT THE DIAG JSYS FOR THE KL10
SUBTTL DIAG JSYS
EXTERN TODCLK
EXTERN MAPPV,SETCST,MTRON,MTROFF,WATEPT,UNWEPT,MONCOR
;DIAG-THIS ROUTINE IS CALLED TO PERFORM SEVERAL DIAGNOSTIC FUNCTIONS
;THE CURRENTLY IMPLEMENTED ONES DO THE FOLLOWING:
;
; 1.RESERVE A CHANNEL FOR USE BY A DIAGNOSTIC
; 2.RELEASE THE CHANNEL FROM USE
; 3.SETUP A CHANNEL PROGRAM
; 4.GET CHANNEL STATUS
;
;CALL FORMAT:
; 1/-# OF WORDS IN ARGLIST,,ARGLIST ADDRESS
;
; DIAG
;RETURN
; +1 ;ERROR RETURN,WRONG STATE,ILLEGAL ADDRESS,BAD FORMAT
; +2 ;NORMAL RETURN
;
; ACCUMULATOR DEFINITIONS
;
; P4= ARGUMENT LIST POINTER
; Q1= FUNCTION CODE + FLAGS
; Q2= DEVICE ADDRESS
.DIAG:: MCENT
MOVX T1,SC%WHL!SC%OPR!SC%MNT ;CHECK FOR SUFFICIENT PRIVLEDGE
TDNN T1,CAPENB ;AGAINST ENABLED CAPABILITIES
RETERR(WHELX1) ;NOT GOOD ENOUGH
UMOVE P4,1 ;GET THE ARGUMENT LIST(#ARGUMENTS,,LIST ADDRESS)
UMOVE Q1,(P4) ;GET FUNCTION CODE
HRRZ T1,Q1 ;GET JUST FUNCTION CODE
CAIL T1,.DGACU ;RANGE CHECK FUNCTION CODE
CAILE T1,.DGGCS ; ...
JRST [ CAIL T1,.DGGEM ;no. is it a mem control function
CAILE T1,.DGREM ;""
RETERR (DIAGX1) ;no. error
SUBI Q1,.DGGEM-.DGGCS-1 ;GET INDEX INTO DISPATCH
JRST DIAG11] ;GO DO IT
AOBJN P4,DIAG1 ;UPDATE COUNT FIELD AND CHECK IF LEGAL
RETERR (DIAGX3) ;ARGUMENT COUNT FIELD WAS TOO SMALL
DIAG1: UMOVE Q2,(P4) ;GET DEVICE ADDRESS
LOAD T1,DG%ADT,Q2 ;GET ADDRESS TYPE
SKIPE T1 ;LEGAL?
RETERR (DIAGX4) ;ILLEGAL TYPE CODE SPECIFIED
LOAD P1,DG%DVC,Q2 ;GET DEVICE CODE
CAIL P1,.DGRH0 ;CHECK RANGE
CAILE P1,.DGRH7 ; ...
RETERR(DIAGX8) ;ILLEGAL
SUBI P1,.DGRH0 ;CONVERT TO INDEX
SKIPN P1,CHNTAB(P1) ; ...
RETERR(DIAGX8) ;NO SUCH CHANNEL
DIAG11: HRRZ T4,Q1 ;GET ADDRESS ONLY
CALL @DIAGFT-1(T4) ;GO PERFORM SPECIFIC FUNCTION
SMRETN ;SKIP RETURN TO USER
;DISPATCH TABLE FOR FUNCTIONS-FUNCTION CODE INDEX #
DIAGFT: IFIW!DGASDV ;ASSIGN CHANNEL-DEVICE MODE(TIMED)
IFIW!DGASCU ;ASSIGN CHANNEL-CONTROLLER MODE(UNTIMED)
IFIW!DGRLCH ;RELEASE THE CHANNEL
IFIW!DGSTPG ;SETUP CHANNEL PROGRAM
IFIW!DGRLPG ;RELEASE THE CHANNEL PROGRAM
IFIW!DGGTST ;GET THE CHANNEL LOGGED OUT STATUS
;end of channel-specific functions. define mem control functions
IFIW!DGMEM ;GET MEMORY
IFIW!DGMEM0 ;RELEASE MEMORY
;ASSIGN THE CHANNEL FOR USE BY THE CALLER
;
DGASDV: AOBJN P4,DGAS1 ;UPDATE POINTER
RETERR (DIAGX3) ;COUNT FIELD BAD
DGAS1: CALL DGUGET ;GET UDB FOR THIS REQUEST
CALL DGUVAL ;VALIDATE ACCESS
CALL DGLOCK ;SIEZE DIAG INTERLOCK, GO NOINT
CALL DGEXAC ;LOCK PROGRAM AND GO NOSKED IF REQUESTED
MOVE T1,JOBNO ;GET JOB NUMBER OF REQUESTOR
SETONE DIAFL,(T1) ;REMEMBER HE HAS A RESOURCE
CALL DGUASN ;SET MAINTENANCE MODE, BLOCK IF NEEDED
CALL DGCASN ;ASSIGN CHANNEL
UMOVE T1,(P4) ;GET TIME FIELD
ADD T1,TODCLK ;AS OFFSET FROM CURRENT TIME
MOVEM T1,UDBODT(P3) ;SET AS OVERDUE TIMER
DGUIOX: MOVX T1,UIOF ;SET USER IOT IN PC
IORM T1,-1(P) ;OF JSYS CALLER
OKINT ;NOINT DONE IN DGLOCK
RET
;ASSIGN CHANNEL IN CONTROLLER MODE-UNTIMED REQUEST
DGASCU: CALL DGUMAP ;MAP NEXT INSTRUCTION ONTO ALL UDB
CALL DGUVAL ;VALIDATE ACCESS
CALL DGLOCK ;SIEZE DIAG LOCK, GO NOINT
CALL DGEXAC ;DO EXCLUSIVE ACCESS IF REQUESTED
MOVE T1,JOBNO ;GET JOB NUMBER OF REQUESTOR
SETONE DIAFL,(T1) ;REMEMBER HE HAS A RESOURCE
CALL DGUMAP ;NOW ASSIGN
CALL DGUASN ;...
CALL DGCASN ;ASSIGN CHANNEL
JRST DGUIOX ;RETURN SETTING IOT USER
;HERE TO RELEASE A CHANNEL AND ALL DEVICES
DGRLCH::SAVEQ
CALL DGCCHK ;VERIFY CHANNEL IN MAINTENANCE MODE
CALL DGUMAP ;MAP ONTO ALL UDBS
CALL [ MOVSI T1,(US.MAI!US.MRQ) ;CHECK FOR MAINTENANCE MODE
TDNN T1,UDBSTS(P3) ; ...
RET ;NOT IN MAINTENANCE
CALLRET DGUREL] ;RELEASE
CALL DGRLPG ;RELEASE CHANNEL PROGRAM
MOVSI T1,(CS.MAI!CS.MRQ) ;AND NOW RELEASE CHANNEL
ANDCAM T1,CDBSTS(P1) ; ...
HLLOS CDBONR(P1) ; ...
SETZM CDBODT(P1) ; ...
MOVEI T1,0 ;DO CHANNEL ONLY RESET
HRRZ T2,CDBDSP(P1) ;GET CHANNEL DISPATCH
SE0ENT ;LOWER LEVEL RUNS IN SEC0
NOSKED
IOPIOF
CALL CDSRST(T2) ;RESET CHANNEL PIA, ETC.
CALL RSTSEK ;RESTART SEEKS
CALL SCHXFR ;AND ANY TRANSFER
IOPION
OKSKED
SE1CAL ;BACK TO SEC1
CALL DGEXRL ;RELEASE EXCLUSIVE ACCESS IF ACQUIRED
MOVX T1,UIOF ;CLEAR IOT USER
ANDCAM T1,-5(P) ;IN JSYS CALLERS PC
CALL DGUNLK ;CLEAR DIAG LOCK
RET
;UNLOCK ANY LOCKED PAGES
DGRLPG: SAVEQ
CALL DGCCHK ;CHECK CHANNEL IN MAINTENANCE MODE
HRRZ T1,CDBICP(P1) ;GET ICCW
LDB T2,[POINT 22,(T1),35] ;GET CORE ADDRESS
SETZM (T1) ;CLEAR ICCW
LSH T2,-PGSFT ;CONVERT TO PAGE NUMBER
SKIPE T1,T2 ;COPY ARGUMENT, SKIP CALL IF NONE
CALL MULKCR ;UNLOCK IF ANY
RET
;SETUP CHANNEL PROGRAM(USE JUST ONE CCW)
;RH20 SPECIFIC BITS
CHXFR==1B0 ;TRANSFER DATA
CHLST==1B1 ;LAST TRANSFER
CHREV==1B2 ;REVERSE
DGSTPG: CALL DGCCHK ;CHECK CHANNEL IN MAINTENANCE MODE
CALL DGRLPG ;FIRST RELEASE OLD CCW LIST
AOBJN P4,DGST1 ;UPDATE FETCH POINTER
RETERR (DIAGX3) ;ARGUMENT LIST WAS TOO SHORT
DGST1: UMOVE T1,(P4) ;PICKUP CCW
SKIPL T1 ;SKIP IF IT'S A XFER CCW
RETERR (DIAGX6) ;CALLER USED ILLEGAL CHANNEL COMMAND
LDB T2,[POINT 11,T1,13] ;GET BYTE COUNT
SOJL T2,DGST2 ;ALLOW EITHER 0 OR EXACTLY ONE PAGE
MOVE T3,T1 ;COPY CCW
ANDI T3,777 ;GET ADDRESS WITHIN PAGE
TLNE T1,(CHREV) ;BACKWARDS?
MOVNS T2 ;YES, NEGATE COUNT
ADD T3,T2 ;DETERMINE TERMINATING WORD
SKIPL T3 ;WITHIN PAGE?
CAIL T3,1000 ; ???
RETERR (DIAGX7) ;CCW WILL OVERFLOW CURRENT I/O PAGE
DGST2: LDB T1,[POINT 18,T1,35] ;GET THE VIRTUAL ADDRESS IN AC1
TLO T1,(1B0) ;SET BIT 0 TO INDICATE LOCKING
UMOVE T2,(T1) ;REFERENCE THE VIRTUAL PAGE TO CREATE IT
CALL MLKMA ;LOCK THE PAGE INTO CORE
UMOVE T2,(P4) ;GET USERS CCW AGAIN
DPB T1,[POINT 13,T2,26] ;STORE PHYSICAL PAGE IN IT
TLO T2,(CHXFR!CHLST) ;FORCE LAST TRANSFER AND TRANSFER
HRRZ T1,CDBICP(P1) ;GET ICCW ADDRESS
MOVEM T2,(T1) ;STORE CCW
SETZM 1(T1) ;CLEAR LOGOUT
SETZM 2(T1) ; ...
RET
;GET THE CURRENT CHANNEL STATUS FOR THE USER
DGGTST: MOVEI T3,1(P4) ;GET USER DESTINATION
ADD P4,BHC+3 ;INCREMENT POINTER TO TEST LENGTH
AOBJN P4,DGGT1 ;UPDATE STORE POINTER
RETERR (DIAGX3) ;POINTER WASN'T LONG ENOUGH
DGGT1: HRRZ T2,CDBICP(P1) ;GET ICCW ADDRESS
MOVEI T1,3 ;3 WORD XFER
CALL BLTMU ;TRANSFER WD0-WD2 TO USER SPACE
RET
;UTILITIES
;HERE TO CHECK THAT A CHANNEL IS IN MAINTENANCE MODE
DGCCHK: MOVSI T1,(CS.MAI) ;MAINTENANCE FLAG
TDNN T1,CDBSTS(P1) ; ...
RETERR(DIAGX2) ;NO - RETURN ERROR
RET ;ALL OK
;HERE TO VALIDATE ACCESS TO A UNIT
DGUVAL: RET ;**TEMP**
; MOVSI T1,(US.MAL) ;MAINTENANCE MODE ALLOWED?
; TDNN T1,UDBSTS(P3) ; ??
; RETERR(DIAGX5) ; NO
; RET ;YES
;HERE TO ASSIGN A CHANNEL
;ASSUMES ALL UNITS ALREADY IN MAINTENANCE MODE, THEREFORE NEVER NEEDS TO BLOCK
DGCASN: MOVSI T1,(CS.MRQ) ;SET MAINTENANCE REQUEST BIT
IORM T1,CDBSTS(P1) ; ...
CALL DGUMAP ;MAP OVER ALL UNITS
CALL DGCAS1
MOVSI T1,(CS.MAI) ;ALL UNITS IDLE, SET MAINT
IORM T1,CDBSTS(P1) ; ...
MOVSI T1,(CS.MRQ) ;CLEAR REQUEST
ANDCAM T1,CDBSTS(P1) ; ...
SETZM CDBODT(P1) ;CLEAR OVERDUE TIME
HRRZ T1,FORKX ;SETUP OWNING FORK
HRRM T1,CDBONR(P1) ; ...
HRRZ T1,CDBICP(P1) ;AND CLEAR ICCW
SETZM (T1) ; ...
RET
DGCAS1: MOVSI T1,(US.ACT!US.REW) ;UNIT IDLE?
TDNN T1,UDBSTS(P3) ;?
RET ;YES
MOVS T1,P3 ;NO - MUST BLOCK
HRRI T1,DGUIDL ;WAIT FOR IDLE
PDISMS
JRST DGCAS1 ;CHECK AGAIN
;SCHEDULER TEST ROUTINE TO WAIT FOR UNIT IDLE
DGUIDL: MOVSI T2,(US.ACT!US.REW) ;UNIT IDLE?
TDNE T2,UDBSTS(T1) ; ...
JRST 0(T4)
JRST 1(T4) ;NO - UNBLOCK
;HERE TO ASSIGN A UNIT
DGUASN: MOVSI T1,(US.MRQ) ;SET REQUEST BIT
IORM T1,UDBSTS(P3) ; ...
DGUAS1: MOVSI T2,(US.ACT) ;SETUP BITS FOR PIOFF TESTS
MOVSI T3,(US.MAI) ; ...
NOSKED
IOPIOF
TDNE T2,UDBSTS(P3) ;ACTIVE?
JRST DGUAS2 ;YES - MUST BLOCK
IORM T3,UDBSTS(P3) ;NO - SET MAINTENANCE IMMEDIATELY
IOPION
OKSKED
ANDCAM T1,UDBSTS(P3) ;CLEAR MAINTENANCE REQUEST
SETZM UDBODT(P3) ;AND OVERDUE TIMER
HRRZ T1,FORKX ;SETUP OWNING FORK
HRRM T2,UDBONR(P3) ; ...
RET
DGUAS2: IOPION ;RE-ENABLE INTERRUPTS
OKSKED
MOVEI T1,DGUTST ;SCHEDULER TEST ROUTINE FOR UDB BLOCK
HRL T1,P3 ;SETUP UDB
PDISMS ;WAIT FOR BIT TO SET
MOVSI T1,(US.MRQ) ;BIT TO CLEAR
JRST DGUAS1 ;JOIN ABOVE
;SCHEDULER TEST FOR UDB IN MAINTENANCE MODE
DGUTST: MOVSI T2,(US.MAI) ;TEST MAINTENANCE BIT
TDNN T2,UDBSTS(T1) ;IN UDB
JRST 0(T4) ;NOT ON YET
JRST 1(T4) ;ON, UNBLOCK
;HERE TO RELEASE A UNIT
DGUREL: MOVSI T1,(US.MAI!US.MRQ) ;CLEAR MAINTENANCE BIT
ANDCAM T1,UDBSTS(P3) ; ...
SETZM UDBODT(P3) ;CLEAR OVERDUE TIME
HLLOS UDBONR(P3) ;RESET OWNING FORK
RET
;HERE TO GET THE UDB POINTED TO BY THE ADDRESS IN Q2
DGUGET: LDB P3,[POINT 6,Q2,29] ;GET UNIT ADDRESS
HLRE T1,CDBIUN(P1) ;WITHIN BOUNDS?
MOVNS T1
CAIL P3,(T1) ; ??
RETERR(DIAGX9) ;NO
ADDI P3,CDBUDB(P1) ;INDEX INTO UDB TABLE
SKIPN P3,(P3) ;ANYTHING THERE?
RETERR(DIAGX9) ;NO
LDB T1,USYTYP ;YES - GET UNIT TYPE
CAIE T1,.UTTM2 ;KDB?
RET ;NO - DONE
MOVE P2,P3 ;COPY
LDB P3,[POINT 6,Q2,35] ;GET SUBUNIT NUMBER
HLRE T1,KDBIUN(P2) ;BOUNDS CHECK
MOVNS T1
CAIL P3,(T1)
RETERR(DIAGX9) ;NOT LEGAL
ADDI P3,KDBUDB(P2) ;INDEX INTO KDB UDB TABLE
SKIPN P3,(P3) ;UDB PRESENT?
RETERR(DIAG10) ;NO
RET ;YES - ALL OK
;HERE TO CHECK IF EXCLUSIVE ACCESS (LOCK AND NOSKED) IS REQUIRED
;FOR THIS DIAG REQUEST
DGEXCK: CALL DGUMAP ;CHECK ALL UNITS ON THIS CHAN
CALL DGEXC1
RET
DGEXC1: SKIPL UDBSTR(P3) ;IS UNIT IN A STR?
TLO Q1,(1B0) ;SET SIGN BIT - NEED EXCLUSIVE ACCESS
RET
;HERE TO ACQUIRE EXCLUSIVE ACCESS IF REQUESTED
DGEXAC: CALL DGEXCK ;CHECK IF EXCLUSIVE ACCESS NEEDED
JUMPGE Q1,R ;NOT NEEDED, RETURN
DGEXCA: SAVEP ;YES - SAVE REGISTERS
CALL ASGPAG ;GET FREE PAGE
RETERR(MONX02) ;INSUFFICIENT RESOURCES
MOVE P2,T1 ;COPY SCRATCH PAGE ADDRESS
SETOM (T1) ;SET PAGE TO ALL ONES
HRLZ T2,T1 ;BUILD BLT POINTER
HRRI T2,1(T1) ; ...
BLT T2,PGSIZ-1(T1) ;CLEAR PAGE TO ONES
CALL MLKMA ;LOCK IN MEMORY
CALL DGEXNS ;DO NOSKED, SPECIAL TRAP ACTIONS
MOVSI P1,-PGSIZ ;LOOP OVER USER ADDRESS SPACE
DGEXA1: SKIPN UPTPGA(P1) ;USER PAGE EXIST?
JRST DGEXA2 ;NO - KEEP LOOKING
HRRZ T1,P1 ;YES - LOCK IT DOWN
LSH T1,PGSFT ;BUILD ADDRESS
TLO T1,(1B0) ;MARK USER ADDRESS
CALL MLKMA ;LOCK
MOVE T2,P2 ;BUILD INDEX INTO LOCKED PAGE LIST
ADDI T2,(P1) ; ...
MOVEM T1,(T2) ;SAVE ADDRESS
DGEXA2: AOBJN P1,DGEXA1 ;LOOP
HRLM P2,DIAGFK ;STORE TEMP PAGE ADDRESS TO RELEASE
RET
;HERE TO GO NOSKED
DGEXNS: NOSKED ;LOCK UP THE PROCESSOR
AOS PNSKDC ;SAY HAVE A NOSKED BECAUSE OF DIAG
;******SHOULD CONSIDER TRAPPING JSYS AND TRAPS HERE
RET ;DONE
;HERE TO RELEASE EXCLUSIVE ACCESS
DGEXRL: HLRZ T1,DIAGFK ;ANYTHING TO UNLOCK?
JUMPE T1,R ;NO - EXIT
SAVEP ;SAVE REGISTERS
MOVSI P1,-PGSIZ ;SETUP TO UNLOCK ALL LOCKED PAGES
HLRZ P2,DIAGFK ;GET TEMP PAGE ADDRESS
SKIPN P2 ;CHECK THERE WAS ONE
BUG(HLT,DGZTPA,<DIAG - LOCKED PAGE LIST PAGE WAS ZERO>)
DGEXR1: HRRZ T1,P1 ;WAS THIS PAGE LOCKED BY DIAG?
ADD T1,P2 ; ...
SKIPGE T1,(T1) ; ?
JRST DGEXR2 ;NO - DO NOTHING
CAML T1,MONCOR ;A REASONABLE PAGE?
CALL MULKCR ;YES - UNLOCK IT
DGEXR2: AOBJN P1,DGEXR1 ;LOOP FOR WHOLE ADDRESS SPACE
MOVE T1,P2 ;NOW UNLOCK LOCK PAGE LIST PAGE
CALL FPTA ;LACK OF MULKMA
CALL MULKPG ;UNLOCK IT
HRRZS DIAGFK ;CLEAR MEMORY OF PAGE
;****** RESTORE JSYS AND PAGE TRAP HERE
NOINT
SOS PNSKDC ;ONE LESS