Trailing-Edge
-
PDP-10 Archives
-
BB-Y393T-SM
-
monitor-sources/diag.mac
There are 50 other files named diag.mac in the archive. Click here to see a list.
; *** Edit 7457 to DIAG.MAC by GSCOTT on 23-Apr-87, for SPR #21597
; Make SET ONLINE command work for drives connected to TM02/TM03/TM78
;<4-1-FIELD-IMAGE.MONITOR>DIAG.MAC.2, 25-Feb-82 20:17:04, EDIT BY DONAHUE
;UPDATE COPYRIGHT DATE
; UPD ID= 816, FARK:<4-WORKING-SOURCES.MONITOR>DIAG.MAC.2, 17-Sep-81 12:13:11 by DONAHUE
;Edit 1946 - If CDB is offline at DGPDL2 set it online and give good return
;<4.MONITOR>DIAG.MAC.31, 3-Jan-80 08:08:28, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
;<4.MONITOR>DIAG.MAC.30, 25-Sep-79 11:22:05, EDIT BY DBELL
;FIX TYPO IN 4.2476
;<4.MONITOR>DIAG.MAC.29, 21-Sep-79 16:29:33, EDIT BY DBELL
;TCO 4.2476 - MAKE .DGPDL FUNCTION WORK IN GENERAL, EVEN ON TXO3'S
;<OSMAN.MON>DIAG.MAC.1, 10-Sep-79 15:21:53, EDIT BY OSMAN
;TCO 4.2412 - Move definition of BUGHLTs, BUGCHKs, and BUGINFs to BUGS.MAC
;<4.MONITOR>DIAG.MAC.27, 4-Mar-79 15:03:17, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.MONITOR>DIAG.MAC.26, 26-Feb-79 11:48:14, Edit by MCLEAN
;MAKE BLOCK TYPE CHECK FOR KDB IN DGPDL
;<4.MONITOR>DIAG.MAC.25, 22-Feb-79 12:06:29, Edit by MCLEAN
;CHANGE SE1CAL IN DGPDL TO SE1ENT
;<4.MONITOR>DIAG.MAC.24, 19-Feb-79 22:29:12, Edit by MCLEAN
;INCREMENT JB0FLG AFTER MTAJB0
;<4.MONITOR>DIAG.MAC.23, 18-Feb-79 01:21:49, Edit by MCLEAN
;FIX DGPDL TO CORRECTLY RECOGNIZE NON-EX DEVICE
;<4.MONITOR>DIAG.MAC.22, 18-Feb-79 01:08:27, Edit by MCLEAN
;FIX DGPDL TO DO CORRECT VERSION OF RESET TO CHANNEL
;<4.MONITOR>DIAG.MAC.21, 7-Feb-79 23:39:36, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.20, 7-Feb-79 18:16:20, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.19, 1-Feb-79 23:23:00, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.18, 1-Feb-79 15:39:48, Edit by MCLEAN
;CHANGE FUNCTION OF .DGPDL
;<4.MONITOR>DIAG.MAC.17, 31-Jan-79 01:07:42, Edit by MCLEAN
;MORE... DGPDL FIXES
;<4.MONITOR>DIAG.MAC.16, 28-Jan-79 21:07:56, Edit by MCLEAN
;FIX DEXIST SUBROUTINE TO DO CORRECT CHECK FOR UDB
;<4.MONITOR>DIAG.MAC.15, 28-Jan-79 16:56:10, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.14, 28-Jan-79 16:25:34, Edit by MCLEAN
;MORE .DGPDL FIXES
;<4.MONITOR>DIAG.MAC.13, 28-Jan-79 14:11:01, Edit by MCLEAN
;CHANGE DIAG11 LABEL TO DIAGZ1 SO MONSYM DOESN'T MESS THINGS UP
;<4.MONITOR>DIAG.MAC.12, 28-Jan-79 14:00:24, Edit by MCLEAN
;MORE .DGPDL CHANGES
;<4.MONITOR>DIAG.MAC.11, 28-Jan-79 13:54:59, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.10, 21-Jan-79 21:37:41, Edit by MCLEAN
;<4.MONITOR>DIAG.MAC.9, 21-Jan-79 17:56:07, Edit by MCLEAN
;ADD .DGPDL JSYS
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980,1981,1982 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
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,.DGPDL ;""
RETERR (DIAGX1) ;no. error
SUBI Q1,.DGGEM-.DGGCS-1 ;GET INDEX INTO DISPATCH
JRST DIAGZ1] ;GO DO IT
AOBJN P4,DIAG1 ;UPDATE COUNT FIELD AND CHECK IF LEGAL
DIGER: 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
DIAGZ1: 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
;WARNING! ADD FUNCTIONS HERE CAREFULLY!
;END OF CHANNEL-SPECIFIC FUNCTIONS. DEFINE NEW FORMAT FUNCTIONS
IFIW!DGMEM ;GET MEMORY
IFIW!DGMEM0 ;RELEASE MEMORY
IFIW!DGPDL ;DYNAMIC RECONFIGURATION OF CHANNEL
;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
CALLRET BLTMU ;TRANSFER WD0-WD2 TO USER SPACE
;HERE TO DO UNIT/CONTROLLER ADDITION
DGPDL: ADD P4,BHC+2 ;CHECK SIZE TO SEE IF LEGAL
AOBJP P4,DIGER ;NO -- TOO SMALL
SUB P4,BHC+3 ;RESTORE
XCTU [SKIPL T1,1(P4)] ;GET CHANNEL AND CHECK VALIDITY
CAILE T1,7 ;LEGAL?
RETERR (DIAGX8) ;NO
SKIPE P1,CHNTAB(T1) ;MAKE SURE CHANNEL EXISTS
XCTU [SKIPGE Q2,2(P4)] ;GET UNIT AND SEE IF NEGATIVE
RETERR (DIAGX8) ;NO CHANNEL OR BAD UNIT
XCTU [SKIPGE P5,3(P4)] ;CHECK FOR -1 CONTROLLER
SETO P5, ;FORCE -1
JUMPL P5,DGPDL2 ;PROCEED IF NO CONTROLLER SPECIFIED
HLRE T1,CDBIUN(P1) ;GET NEGATIVE NUMBER OF ENTRIES
MOVN T1,T1 ;MAKE POSITIVE
CAML P5,T1 ;VERIFY CONTROLLER NUMBER
RETERR (DIAGX8) ;INVALID
MOVE P3,CDBIUN(P1) ;GET ADDRESS OF UDB TABLE
ADD P3,P5 ;ADD TO GET PROPER ENTRY
SKIPN P3,(P3) ;POINTER EXIST?
JRST DGPDL2 ;NO, GO CREATE ONE
LDB T1,USYBKT ;GET BLOCK TYPE
CAIE T1,.BTKDB ;CHECK FOR KDB
RETERR (DIAG12) ;ERROR DEVICE NOT ON LINE
DGPDL2: HRRZ T1,CDBDSP(P1) ;GET DISPATCH TABLE
CALL CDSEXT(T1) ;SEE IF UNIT ALREADY EXISTS
;**;[7457] Replace 7 lines with 12 at DGPDL2+2 GAS 23-Apr-87
IFSKP. ;[7457] If it exists, then check offline
MOVX T1,CS.OFL ;[7457] Load the offline bit for CDB
MOVX T2,US.OFS ;[7457] Load offline bit for UDB
TDNN T1,CDBSTS(P1) ;[7457] Is the CDB off line?
TDNE T2,UDBSTS(P3) ;[7457] or is the UDB off line?
IFSKP. ;[7457] If the CDB and UDB are online and exist
RETERR (DIAG11) ;[7457] then its an illegal request
ENDIF. ;[7457] Otherwise CDB and/or UDB are offline
ANDCAM T1,CDBSTS(P1) ;[7457] Clear CDB offline bit
ANDCAM T2,UDBSTS(P3) ;[7457] Clear UDB offline bit also
RET ;[7457] Return OK
ENDIF. ;[7457] End of code for unit exists
SKIPN T1 ;ILLEGAL UNIT NUMBER?
RETERR (DIAGX8) ;YES, GIVE ERROR
PUSH P,Q2 ;SAVE Q2 AND P5
PUSH P,P5
SKIPL P5 ;CHECK FOR NO CONTROLLER
EXCH Q2,P5 ;SET Q2 TO CONTROLLER
NOINT
SE0ENT
CALL DGUMAP ;CHECK FOR VALIDITY
CALL DGUVAL
CALL DGLOCK ;LOCK
CALL DGUMAP ;PUT IN MAI MODE
CALL DGUASN
CALL DGCASN ;ASSIGN CHANNEL
NOSKED ;NOSKED
IOPIOF ;TURN OFF CHANNEL
SETO P6,0 ;INDICATE ONE UNIT ONLY
MOVE Q3,CDBIUN(P1) ;GET CORRECT UNIT ADDRESS
ADD Q3,Q2
CALL RH2UNS ;GO GET UNIT SETUP
SKIPN 0(Q3) ;ALREADY EXISTS?
MOVEM P3,0(Q3) ;NO STORE THE NEW FOUND ENTRY
CALL DGUMAP ;RELEASE ALL THE UNITS
CALL [ MOVSI T1,(US.MAI!US.MRQ)
TDNN T1,UDBSTS(P3)
RET ;NOT IN USE FORGET IT
CALLRET DGUREL] ;RELEASE
MOVSI T1,(CS.MAI!CS.MRQ) ;RELEASE CHANNEL
ANDCAM T1,CDBSTS(P1)
HLLOS CDBONR(P1)
HRRZ T2,CDBDSP(P1)
MOVEI T1,0 ;RESET CHANNEL
HRRZ T2,CDBDSP(P1) ;GET CHANNEL DISPATCH
CALL CDSRST(T2) ;RESET CHANNEL PIA,ETC.
CALL RSTSEK ;RESTART SEEKS
CALL SCHXFR ;AND ANY TRANSFERS
IOPION
SE1ENT
OKSKED
AOS MTAJB0 ;FORCE SETSPD TO RUN INCASE MAGTAPES
AOS JB0FLG ;START JOB 0
CALL DGUNLK ;UNLOCK AND RETURN
OKINT ;ALLOW INTERRUPTS
POP P,P5
POP P,Q2 ;RESTORE Q2
HRRZ T1,CDBDSP(P1) ;GET DISPATCH TABLE
CALL CDSEXT(T1) ;SEE IF UNIT NOW EXISTS
RETERR (DIAG12) ;NO, COMPLAIN
RET ;ALL OK
;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(DGZTPA)
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 NOSKED BECAUSE OF RESOURCES
OKSKED ;RELESE CPU
MOVE T1,P2 ;GET VIRTUAL ADDR BACK
CALL RELPAG ;RELEASE IT
HRRZ T1,FORKX ;CHECK IF ANY TTY ACTIVITY
HLRZ T1,FKJOB(T1) ;GET JOB NUMBER
HLRE T2,JOBPT(T1) ;GET CONTROLLING TERMINAL
JUMPL T2,R ;IF DETACHED, QUIT
CALL CKINP ;SEE IF ANY TERMINAL INPUT
RET ;NOTHING
CHKINT ;USER IS TYPING. POKE SCHED
RET
;HERE TO REQUEST THE DIAG LOCK
DGLOCK: NOINT ;PREVENT INTS WHILE SETTING UP
AOSE DIAGLK ;TEST/SET LOCK
JRST DGLK1 ;BUSY - MUST WAIT
MOVE T1,FORKX ;HAVE LOCK - IDENTIFY OWNER
MOVEM T1,DIAGFK ; ...
RET
DGLK1: OKINT ;BE OKINT WHEN BLOCKED
MOVEI T1,DGLTST ;BLOCK
MDISMS ; ...
JRST DGLOCK ;TRY AGAIN
DGLTST: SKIPL DIAGLK ;LOCK FREE?
JRST 0(T4) ;NO
JRST 1(T4) ;MAYBE
;HERE TO RELEASE THE DIAG LOCK
DGUNLK: HLRZS T1,DIAGFK ;CHECK FOR UNRELEASED TEMP PAGE
SKIPE T1 ; ...
BUG(DGUTPG)
SETOM DIAGFK ;INDICATE NO OWNER
SETOM DIAGLK ;FREE LOCK
RET
;HERE TO RELEASE ALL DIAG. RESOURCES ALLOCATED TO THIS PROCESS
;CALLED FROM KSELF IF THE FORK HAS ANY ASSIGNED
DGFKIL::HRRZ T1,DIAGFK ;THIS FORK HAVE DIAG RESOURCE NOW?
CAME T1,FORKX ;??
RET ;NO - NOTHING TO DO NOW
SAVEPQ ;SAVE ALL ACS
MOVSI Q1,-CHNN ;BUILD AOBJN POINTER
FKIL1: SKIPN P1,CHNTAB(Q1) ;ANYTHING PRESENT?
JRST FKIL2 ;NO - ON TO NEXT
MOVSI T1,(CS.MRQ) ;MAINT REQUEST UP?
TDNE T1,CDBSTS(P1) ;?
ANDCAM T1,CDBSTS(P1) ;YES - CLEAR IT
MOVSI T1,(CS.MAI) ;YES - IS IT IN ASSIGNED?
TDNN T1,CDBSTS(P1) ; ??
JRST FKIL2 ;NO
CALL DGRLCH ;YES - RELEASE IT
FKIL2: AOBJN Q1,FKIL1 ;LOOP FOR ALL CHANNELS
RET ;ALL DONE
;DIAG ROUTINES FOR TGHA MEMORY CONTROL.
;MAP MEMORY. ALSO TURNS OFF PI AND ENTERS SECONDARY PROTOCOL.
;MAY ALSO TURN OFF METER
;ARGS ARE:
; FIRST USER PAGE IN MAP REGION
; FIRST REAL MEMORY ADDRESS TO MAP
; COUNT OF PAGES TO MAP
; AR/ARX TRAP ADDRESS. -1 => NO INTERVENTION
DGMEM: STKVAR <USRPAG,MEMPAG,CNTPAG,PAGE1,PAGE2>
AOBJN P4,DGMEM1 ;GET USER ADDRESS
RETERR (DIAGX3) ;NOT ENOUGH ARGS
DGMEM1: UMOVE T1,0(P4) ;GET USER PAGE ADDRESS
SKIPLE T1 ;MUST BE A VALID PAGE NUMBER
CAILE T1,777 ;AND MUST BE IN ONE SECTION
RETERR (ARGX06) ;INVALID PAGE NUMBER GIVEN
MOVEM T1,USRPAG ;SAVE USER PAGE
AOBJN P4,DGMEM2 ;GET NEXT ARG
RETERR (DIAGX3) ;NOT ENOUGH
DGMEM2: UMOVE T1,0(P4) ;GET PHYSICAL ADDRESS
CAMLE T1,NHIPG ;IS THIS PAGE EXTANT?
RETERR(PMCLX2) ;NO. GIVE ERROR THEN
MOVEM T1,MEMPAG ;SAVE IT
AOBJN P4,DGMEM3 ;GET LAST ARG
RETERR (DIAGX3) ;TOO BAD. NOT THERE
DGMEM3: UMOVE T1,0(P4) ;GET PAGE COUNT
CAILE T1,1000 ;MUST NOT BE GREATER THAN ONE SECTION
RETERR (ARGX06) ;CAN;T HAVE IT THEN
MOVEM T1,CNTPAG ;SAVE IT
;NOW SEE IF UPPER LIMITS MATCH
ADD T1,MEMPAG ;GET LAST MEMORY PAGE
SOS T1 ;ONE LESS
CAMLE T1,NHIPG ;WITHIN BOUNDS?
RETERR (PMCLX2) ;NO. CAN;T DO IT THEN
MOVE T1,CNTPAG ;GET COUNT AGAIN
ADD T1,USRPAG ;GET END OF USER SPACE
CAILE T1,1000 ;WITHIN SECTION 0
RETERR (ARGX06) ;NO. BOMB THEN
SETOM P3 ;ASSUME NO AR/ARX INTERVENTION
AOBJP P4,DGMEM6 ;IS ONE SPECIFIED?
UMOVE P3,0(P4) ;YES. GET IT
; ..
;HERE WITH ALL ARGS VALIDATED. NOW SET UP USER MAP
DGMEM6: CALL DGLOCK ;GET DIAG LOCK. NOW NOINT
MOVE T1,USRPAG ;GET USER PAGE
MOVE T2,CNTPAG ;GET COUNT
DGMEM4: SKIPE UPTPGA(T1) ;IS THIS MAP SLOT EMPTY?
RETERR (ARGX06,<CALL DGUNLK>) ;NO. CAN'T DO FUNCTION THEN
SOJLE T2,DGMEM5 ;MORE TO DO?
AOJA T1,DGMEM4 ;YES
DGMEM5: CALL ASGPAG ;GET A PAGE
RETERR (MONX02,<CALL DGUNLK>) ;NONE THERE
SKIP 0(T1) ;CREATE THE PAGE
MOVEM T1,PAGE1 ;SAVE THE PAGE
CALL ASGPAG ;GET ANOTHER PAGE
RETERR (MONX02,<CALL DGUNLK
MOVE T1,PAGE1
CALL RELPAG>) ;FREE THE PAGE
MOVE T2,PAGE1 ;GET ADDRESS OF PAGE 1
MOVEM T2,0(T1) ;SAVE IT
MOVE T2,MEMPAG ;GET FIRST MEM PAGE
MOVEM T2,2(T1) ;SAVE IT
MOVE T2,USRPAG ;GET FIRST USER PAGE
MOVEM T2,3(T1) ;SAVE IT
MOVE T2,CNTPAG ;GET COUNT OF PAGES
MOVEM T2,4(T1) ;SAVE IT
MOVEM T1,PAGE2
MOVE T2,CASHF ;CURRENT CACHE STATE
MOVEM T2,5(T1) ;SAVE IT
;USER MAP IS AVAILABLE FOR OPERATION. FIRST LOCK THE DIAGNOSTIC
;IN MEMORY
CALL DGEXCA ;LOCK THE DIAGNOSTIC. WILL BE NOSKED ON RETURN
MOVE T1,PAGE1 ;GET PAGE I.D.
CALL MLKMA ;LOCK IT IN
MOVE T1,PAGE2
HLRZ T2,DIAGFK ;SAVE LOCK PAGE
HRLM T1,DIAGFK ;REMEMBER THIS ADDRESS
MOVEM T2,1(T1) ;SAVE LOCK PAGE ADDRESS
CALL MLKMA ;LOCK THIS ONE ALSO
MOVE T1,FORKX ;GET FORK NUMBER OF THIS PROCESS
HLL T1,FKPGS(T1) ;GET SPTN OF UPTA
HRR T1,USRPAG ;GET STARTING PAGE NUMBER
MOVE T2,MEMPAG ;GET MEMORY PAGE
MOVE T3,CNTPAG ;GET COUNT
CALL MAPPV ;SET UP THE MAP
;USER MAP NOW SET UP. NEED TO FIX UP CST0 AREA
PIOFF ;TURN OFF INTERRUPTS
CALL CASHOF ;TURN OFF THE CACHE
REPEAT 0,< ;SKIP THIS FOR NOW
JSR BUGMON ;AND ENTER SECONDARY PROTOCOL
MOVEI T1,[SIXBIT '$MOS MEMORY DIAGNOSTIC RUNNING...$/']
JSR BUGMSG ;TELL OPERATOR
> ;END OF REPEAT 0
; ..
;HERE WITH MACHINE COMPLETELY UNDER THIS PROCESS'S CONTROL.
;MUST NOW TURN OFF METER, SAVE CST0 FOR TARGET PAGES
;AND MAKE TARGET PAGES ACCESSIBLE.
CALL MTROFF ;TURN OFF CLOCK. (DISABLES
;METER AND TIMER).
;NOW SAVE RELEVANT CST0 LOCATIONS
MOVE T1,MEMPAG ;FIRST MEM PAGE
HRLI T1,CST0(T1) ;GET START OF TRANSFER
HRR T1,PAGE1 ;WHERE IT IS GOING
MOVE T2,PAGE1 ;GET DEST ADDRESS AGAIN
ADD T2,CNTPAG ;# OF PAGES
BLT T1,-1(T2) ;SAVE ALL OF CST0
;CST0 LOCATIONS NOW SAVED. SET UP CURRENT CST0 SO IS ACCESSIBLE
MOVE T1,MEMPAG ;FIRST MEM PAGE
MOVE T2,CNTPAG ;# OF PAGES
CALL SETCST ;SET CST0 FOR THE PAGES
;SETS AGE TO CURRENT AGE. SETS
;USE FIELD TO ALL 1'S
;NOW ALL IS READY FOR THE DIAGNOSTIC. LET IT HAVE IT
;FIRST, WAIT FOR EPT USERS TO FINISH
CALL WATEPT ;LET APRSRV DO THE WAITING
MOVEM P3,DIAGAR ;SET AR/ARX INTERCEPT
RET ;GO!
;MEMORY FUNCTION TO RELEASE ALL RESOURCES.
;NO ARS
DGMEM0: STKVAR <USRPAG,MEMPAG,CNTPAG,PAGE1,PAGE2>
SETZM DIAGAR ;CLEAR AR/ARX INTERCEPT
CALL UNWEPT ;TURN ON EPT DEVICES
HLRZ T1,DIAGFK ;GET PAGE WITH CONTROL INFO
MOVEM T1,PAGE2 ;SAVE IT
MOVE T2,2(T1) ;FIRST MEMORY PAGE
MOVEM T2,MEMPAG
MOVE T3,3(T1) ;GET USER PAGE AFFECTED
MOVEM T3,USRPAG
MOVE T3,4(T1) ;GET COUNT OF PAGES USED
MOVEM T3,CNTPAG
MOVE T4,0(T1) ;GET PAGE WHERE CST0'S ARE SAVED
MOVEM T4,PAGE1
ADDI T2,CST0 ;GET FIRST CST0 SLOT TO RESTORE
ADD T3,T2 ;THE END
HRL T2,T4 ;FORM BLT ARG
BLT T2,-1(T3) ;RESTORE CST0 ENTRIES
CALL MONCLA ;CLEAR MAP
MOVE T4,1(T1) ;GET USER LOCK PAGE PAGE
HRLM T4,DIAGFK ;RESTORE IT
SKIPE 5(T1) ;WANT CACHE ON?
CALL CASHON ;YES. SO TURN IT ON
REPEAT 0,< ;NOT NEEDED PRESENTLY
MOVEI T1,[SIXBIT '$MOS MEMORY DIAGNOSITIC COMPLETED$/']
JSR BUGMSG ;TELL OPERATOR
JSR BUGPRI ;TURN ON PRIMARY PROTOCOL
> ;END OF REPEAT 0
PION ;AND TURN ON INTS
;SYSTEM NOW ON
NOINT ;PREVENT INTS
CALL DGEXRL ;UNLOCK USER. NOW OKSKED
MOVE T1,PAGE1 ;GET JSB PAGE
CALL FPTA ;GET I.D.
CALL MULKPG ;UNLOCK IT
MOVE T1,PAGE1 ;GET IT AGAIN
CALL RELPAG ;RELEASE IT
MOVE T1,PAGE2 ;GET OTHER JSB PAGE
CALL FPTA ;GET I.D.
CALL MULKPG ;UNLOCK IT
MOVE T1,PAGE2 ;GET IT AGAIN
CALL RELPAG ;RELEASE IT
; ..
;NOW CLEAN UP USER MAP
MOVE T3,CNTPAG ;# OF PAGES
SETOM T2 ;SAY CLEAR MAP
MOVE T1,FORKX ;THIS FORK
HLL T1,FKPGS(T1) ;GET USER MAP
HRR T1,USRPAG ;THE STARTING PAGE NUMBER
CALL MAPPV ;CLEAR MAP
CALL DGUNLK ;RELEASE DIAG LOCK
OKINT ;ALLOW INTS NOW
RET ;AND DONE, AT LAST
TNXEND
END