.TITLE TQE .IDENT 'X03-000' .SUBTITLE NOTICES ;++ ; ; Facility: Timer que element list utility ; ; Abstract: ; This is a program to display the items in the timer queue ; ; Author: ; Lee K. Gleason ; Control-G Consultants ; 2416 Branard #D ; Huston Tx 77098 ; Phone (713)528-1859 ; ;-- ;++ ; Modified by ; Michael N. LeVine ; Code 3514 ; Naval Weapons Center ; China Lake ; Ca 93555 ; (619)939-2465 ; avn 437-2465 ;-- .SBTTL TQE ;++ ; Functional Description: ; This program enters kernel mode, raises ipl to block clock ; events, and copies the timer queue elements to a work area. ; It then goes back to user mode, and displays the entries in ; a semi-readable form. ; ;-- .PAGE .SUBTITLE LOAD SYSTEM MACROS .LIBRARY /SYS$LIBRARY:LIB.MLB/ $TQEDEF ;Timer que element symbols $PSLDEF ;Access mode definitions $IPLDEF ;Ipl definitions $ACBDEF ;AST control block definitions $JPIDEF ;JPI system service routine defs $DPTDEF ;DPT block defs .SUBTITLE DEFINE USER MACROS .MACRO MSTR SRC ;MOVE STRING MOVZBL SRC,R0 ADDL3 #BUFFER,BUFFER_LENGTH,R1 ADDL2 R0,BUFFER_LENGTH MOVC3 R0,@SRC+4,(R1) .ENDM MSTR CR=13 LF=10 .PAGE .SUBTITLE DEFINE VOLITILE STORAGE AREA .PSECT TQEDAT PIC,LONG,USR,CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC MAXENTRY=256 ;Allow report on 256 entries(This would be a BIG system) ;make this larger, if need be. MAXDEVICE=256 ;Allow for 256 devices in system TQE_INRANGE: ;Range of data pages to lock down while at elevated ipl .ADDRESS TQELST ;Address of tqe buffer .ADDRESS COUNT ;Address of count longword TQE_OUTRANGE: .QUAD 0 ;Actual range locked here (not used this version) DEV_INRANGE: .ADDRESS DEVLST .ADDRESS DEVCOUNT DEV_OUTRANGE: .QUAD 0 ; *** do not rearrange following lines (or you'll be sorry...) *** TQELST: .BLKB TQE$C_LENGTH*MAXENTRY ;Tqe buffer GETTQE_ARGS: ;Argument list for call to gettqe routine .LONG 2 ;# of args .ADDRESS TQELST ;Addr of tqe buffer .ADDRESS COUNT ;Addr of count longword COUNT: .LONG 0 ;Count of entries found ; *** do not rearrange preceeding lines (...I'm warning you) *** ; *** ditto for the next set of lines also DEVLST: .BLKB 20*MAXDEVICE GETDEV_ARGS: .LONG 2 .ADDRESS DEVLST .ADDRESS DEVCOUNT DEVCOUNT: .LONG 0 ; ****Done location sensitive locs COUNTSTR: ;Fao string for count .ASCID @!/!UL entries in the timer queue!/@ OUTCOUNTSTR: ;Fao string for count .ASCID / / BUFFER_LENGTH: .LONG 0 BUFFER_DESCRIPTER: .LONG 0,0 BUFFER: .BLKB 1024. EXTERNAL_PID: .LONG 0 JPI_LIST: .WORD 15 .WORD JPI$_PRCNAM .ADDRESS PROCESS_NAME .ADDRESS PROCESS_NAME_LENGTH .WORD 128 .WORD JPI$_IMAGNAME .ADDRESS IMAGE_NAME .ADDRESS IMAGE_NAME_LENGTH .LONG 0 PROCESS_NAME_LENGTH: .LONG 0 .ADDRESS PROCESS_NAME PROCESS_NAME: .BLKB 15 IMAGE_NAME_LENGTH: .LONG 0 .ADDRESS IMAGE_NAME IMAGE_NAME: .BLKB 128 .PAGE .SUBTITLE MAIN LINE CODE .PSECT TQECOD PIC,LONG,USR,CON,REL,GBL,SHR,EXE,RD,NOWRT,NOVEC .ENTRY TQE,^M<> ;+ ; Well, Let's get to work...first, lock down all pages that need to ; be accessed by routine gettqe, as it will be running at IPL$_TIMER, ; and a page fault would cause the system to stop (and the phones to ; start ringing.) ;- $LKWSET_S INADR=TQE_INRANGE,RETADR=TQE_OUTRANGE,- ACMODE=#PSL$C_USER BLBS R0,5$ BRW DIE 5$: ; Call the get elements routine in kernel mode $CMKRNL_S ROUTIN=GETTQE,ARGLST=GETTQE_ARGS BLBS R0,1$ BRW DIE 1$: ; Get the device driver information $LKWSET_S INADR=DEV_INRANGE,RETADR=DEV_OUTRANGE,- ACMODE=#PSL$C_USER BLBS R0,2$ BRW DIE 2$: $CMKRNL_S ROUTIN=GETDEV,ARGLST=GETDEV_ARGS BLBS R0,3$ BRW DIE 3$: ; Format the count string attractively ($fao, the heir to $edmsg) $FAO_S CTRSTR=COUNTSTR,OUTBUF=OUTCOUNTSTR,OUTLEN=OUTCOUNTSTR,P1=COUNT PUSHAL OUTCOUNTSTR CALLS #1,G^LIB$PUT_OUTPUT ;Output the count string MOVL COUNT,R3 ;Number of entries found->R3 MOVAL TQELST,R2 ;Addr of list->R2 AGAIN: PUSHL R2 ;Load arg for format routine BLBC TQE$B_RQTYPE(R2),1$ ;System or process? CALLS #1,FORSYSTQE ;Do it system style BLBC R0,DIE ;How'd we do? BRB INCIT ;Skip process style 1$: CALLS #1,FORPROTQE ;Call format routine BLBC R0,DIE ;Everything OK? INCIT: ADDL #TQE$C_LENGTH,R2 ;Advance pointer one entries worth SOBGTR R3,AGAIN ;Loop til done DIE: $EXIT_S R0 ;Exit .PAGE .SUBTITLE FORMAT ROUTINE STRING STORAGE AREA .PSECT TQEPUR PIC,LONG,USR,CON,REL,GBL,SHR,NOEXE,RD,NOWRT,NOVEC PROC: .ASCID /Process Timer, / SCHED: .ASCID /Scheduled Wakeup, / SYS: .ASCID /System Subroutine, / REPEAT: .ASCID /Repeat, / ONCE: .ASCID /One-shot, / REL: .ASCID /Relative/ ABS: .ASCID /Absolute/ PNAME: .ASCID /Process name / INAME: .ASCID / Image name / DUE: .ASCID /Due at / DELTA: .ASCID /, Delta time / EVF: .ASCID /Event Flag / NAST: .ASCID /%D, No AST / UAST: .ASCID /%D, User mode AST with parameter value / SAST: .ASCID /%D, Supervisor mode AST with parameter value / KAST: .ASCID /%D, Kernel mode AST with parameter value / EAST: .ASCID /%D, Executive mode AST with parameter value / PX: .ASCID /%X/ EOL: .ASCID / / REQNAME:.ASCID /Requesting process name / SYSPC: .ASCID @PC !XL%X FR3 !XL%X FR4 !XL%X@ TIMEOUT:.ASCID / (EXE$TIMEOUT)/ .PAGE .SUBTITLE FORMAT PROCESS ELEMENTS .PSECT TQECOD PIC,LONG,USR,CON,REL,GBL,SHR,EXE,RD,NOWRT,NOVEC .ENTRY FORPROTQE,^M ; ; INIT THE BUFFER ; CLRL BUFFER_LENGTH MOVC5 #0,#0,#^A/ /,#1024,BUFFER ; ; INIT POINTER TO ELEMENT TO BE DECODED ; MOVL 4(AP),R7 ; ; FIRST THE HEADER LINE WHICH TELL WHICH TYPE OF PROCESS ; REQUEST THIS IS ; BBS #1,TQE$B_RQTYPE(R7),101$ MSTR SCHED BRB 102$ 101$: MSTR PROC 102$: BBS #TQE$V_REPEAT,TQE$B_RQTYPE(R7),103$ MSTR ONCE BRB 104$ 103$: MSTR REPEAT 104$: BBS #TQE$V_ABSOLUTE,TQE$B_RQTYPE(R7),105$ MSTR REL BRB 106$ 105$: MSTR ABS 106$: ; FIRST LINE COMPLETE-NEXT SECTION IS TARGET PROCESS INFO ; LINE 2 PROCESS NAME, IMAGE NAME ; LINE 3 DUE TIME {DELTA TIME IF ANY} ; LINE 4 EVENT FLAG,AST INFO EITHER NOAST OR MODE AND PARAMETER ; IF REQUESTER PROCESS IS NOT SAME AS TARGET PROCESS THEN ; LINE 5 PROCESS NAME,IMAGE NAME ; ; START LINE 2 ; MOVL TQE$L_PID(R7),R0 JSB EXE$IPID_TO_EPID MOVL R0,EXTERNAL_PID CLRL PROCESS_NAME_LENGTH CLRL IMAGE_NAME_LENGTH $GETJPI_S EFN=#1,PIDADR=EXTERNAL_PID,ITMLST=JPI_LIST $WAITFR_S EFN=#1 MSTR PNAME MSTR PROCESS_NAME_LENGTH MSTR INAME MSTR IMAGE_NAME_LENGTH ; LINE 3 MSTR DUE ADDL3 BUFFER_LENGTH,#BUFFER,BUFFER_DESCRIPTER+4 MOVL #30,BUFFER_DESCRIPTER PUSHL #0 PUSHAL TQE$Q_TIME(R7) PUSHAL BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #4,G^SYS$ASCTIM MOVZBL BUFFER_DESCRIPTER,R0 ADDL2 R0,BUFFER_LENGTH BBC #TQE$V_REPEAT,TQE$B_RQTYPE(R7),1$ MSTR DELTA ADDL3 BUFFER_LENGTH,#BUFFER,BUFFER_DESCRIPTER+4 MOVL #30,BUFFER_DESCRIPTER PUSHL #1 PUSHAL TQE$Q_DELTA(R7) PUSHAL BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #4,G^SYS$ASCTIM MOVZBL BUFFER_DESCRIPTER,R0 ADDL2 R0,BUFFER_LENGTH 1$: ; LINE 4 MSTR EVF PUSHL #1 PUSHL #3 ADDL3 #BUFFER,BUFFER_LENGTH,BUFFER_DESCRIPTER+4 MOVL #3,BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER PUSHAL TQE$B_EFN(R7) CALLS #4,G^OTS$CVT_L_TU ADDL2 #3,BUFFER_LENGTH BBS #ACB$V_QUOTA,TQE$B_RMOD(R7),2$ MSTR NAST BRW 10$ 2$: BICB3 #^C3,TQE$B_RMOD(R7),R0 TSTB R0 BNEQ 3$ MSTR KAST BRB 7$ 3$: CMPB #1,R0 BNEQ 4$ MSTR EAST BRB 7$ 4$: CMPB #2,R0 BNEQ 5$ MSTR SAST BRB 7$ 5$: MSTR UAST 7$: PUSHL #4 PUSHL #8 ADDL3 #BUFFER,BUFFER_LENGTH,BUFFER_DESCRIPTER+4 MOVL #8,BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER PUSHAL TQE$L_ASTPRM(R7) CALLS #4,G^OTS$CVT_L_TZ ADDL2 #8,BUFFER_LENGTH MSTR PX 10$: CMPL TQE$L_RQPID(R7),TQE$L_PID(R7) BNEQ 11$ BRW 50$ 11$: MSTR REQNAME MOVL TQE$L_RQPID(R7),R0 JSB EXE$IPID_TO_EPID MOVL R0,EXTERNAL_PID CLRL PROCESS_NAME_LENGTH CLRL IMAGE_NAME_LENGTH $GETJPI_S EFN=#1,PIDADR=EXTERNAL_PID,ITMLST=JPI_LIST $WAITFR_S EFN=#1 MSTR PROCESS_NAME_LENGTH MSTR INAME MSTR IMAGE_NAME_LENGTH 50$: MSTR EOL MOVAL BUFFER,BUFFER_DESCRIPTER+4 MOVL BUFFER_LENGTH,BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #1,G^LIB$PUT_OUTPUT RET .PAGE .SUBTITLE FORMAT SYSTEM ELEMENTS .PAGE .ENTRY FORSYSTQE,^M ; ; INIT THE BUFFER ; CLRL BUFFER_LENGTH MOVC5 #0,#0,#^A/ /,#1024,BUFFER ; ; INIT POINTER TO ELEMENT TO BE DECODED ; MOVL 4(AP),R7 ; ; FIRST THE HEADER LINE WHICH TELL WHICH TYPE OF PROCESS ; REQUEST THIS IS ; MSTR SYS BBS #TQE$V_REPEAT,TQE$B_RQTYPE(R7),103$ MSTR ONCE BRB 104$ 103$: MSTR REPEAT 104$: BBS #TQE$V_ABSOLUTE,TQE$B_RQTYPE(R7),105$ MSTR REL BRB 106$ 105$: MSTR ABS 106$: ADDL3 #BUFFER,BUFFER_LENGTH,BUFFER_DESCRIPTER+4 MOVL #132,BUFFER_DESCRIPTER $FAO_S CTRSTR=SYSPC,OUTBUF=BUFFER_DESCRIPTER,OUTLEN=BUFFER_DESCRIPTER,- P1=TQE$L_PID(R7),P2=TQE$L_AST(R7),P3=TQE$L_ASTPRM(R7) MOVZBL BUFFER_DESCRIPTER,R0 ADDL2 R0,BUFFER_LENGTH CMPL #EXE$TIMEOUT,TQE$L_PID(R7) BNEQ 107$ MSTR TIMEOUT BRW 108$ 107$: MOVAL DEVLST,R11 MOVL DEVCOUNT,R10 BEQL 108$ 110$: CMPL TQE$L_PID(R7),(R11) BLSSU 109$ CMPL TQE$L_PID(R7),4(R11) BGTRU 109$ ADDL3 #BUFFER,BUFFER_LENGTH,R9 ADDL2 #2,BUFFER_LENGTH MOVW #^A/ (/,(R9) ADDL2 #2,R9 MOVZBL 8(R11),R0 ADDL2 R0,BUFFER_LENGTH MOVL R9,R1 ADDL2 R0,R9 MOVC3 R0,9(R11),(R1) ADDL2 #1,BUFFER_LENGTH MOVB #^A/)/,(R9) BRW 108$ 109$: ADDL2 #20,R11 DECL R10 BGTR 110$ 108$: MSTR DUE ADDL3 BUFFER_LENGTH,#BUFFER,BUFFER_DESCRIPTER+4 MOVL #30,BUFFER_DESCRIPTER PUSHL #0 PUSHAL TQE$Q_TIME(R7) PUSHAL BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #4,G^SYS$ASCTIM MOVZBL BUFFER_DESCRIPTER,R0 ADDL2 R0,BUFFER_LENGTH BBC #TQE$V_REPEAT,TQE$B_RQTYPE(R7),1$ MSTR DELTA ADDL3 BUFFER_LENGTH,#BUFFER,BUFFER_DESCRIPTER+4 MOVL #30,BUFFER_DESCRIPTER PUSHL #1 PUSHAL TQE$Q_DELTA(R7) PUSHAL BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #4,G^SYS$ASCTIM MOVZBL BUFFER_DESCRIPTER,R0 ADDL2 R0,BUFFER_LENGTH 1$: MSTR EOL MOVAL BUFFER,BUFFER_DESCRIPTER+4 MOVL BUFFER_LENGTH,BUFFER_DESCRIPTER PUSHAL BUFFER_DESCRIPTER CALLS #1,G^LIB$PUT_OUTPUT RET .PAGE .SUBTITLE KERNEL MODE COPY ROUTINE .ENTRY GETTQE,^M ;+ ; This subroutine executes in kernel mode, and at IPL$_TIMER ; If the thunder don't get you,then the lightning will... ;- SETIPL ENDPRI ;lock this code, and raise ipl CLRL R7 ;Start with zero entries MOVL EXE$GL_TQFL,R6 ;listhead to R6 MOVL 4(AP),R3 ;pointer to place copy entries to R3 N: CMPL #EXE$AL_TQENOREPT,R6 ;reached the end? BEQL UNEXEC ;Then get out MOVC3 #TQE$C_LENGTH,(R6),(R3) ;else copy one MOVL (R6),R6 ;next link please AOBLSS #MAXENTRY,R7,N ;count it, and do ti again if room UNEXEC: MOVL R7,@8(AP) ;return count to caller MOVL #1,R0 ;return success RET ;gotta get back to where you belong ;ret restores ipl for us ENDPRI: .LONG IPL$_TIMER ;ipl to raise to (block timer events) ASSUME LE 512 ;make sure this code will lock .PAGE .SUBTITLE KERNEL MODE GET DEVICE DRIVER LOCATION INFO ROUTINE .ENTRY GETDEV,^M SETIPL DEVPRI MOVL 4(AP),R11 ;GET ADDR OF DEVICE LIST CLRL R10 ;INIT COUNTER MOVAL IOC$GL_DPTLIST,R9 ;GET DPT LIST HEAD MOVL R9,R8 ;WORKING COPY 1$: MOVL (R8),R8 ;NEXT DPT CMPL R8,R9 ;SEE IF DONE BEQL 10$ ;YES MOVL R8,(R11) ;STORE STARTING ADDR MOVZWL DPT$W_SIZE(R8),R7 ;GET SIZE ADDL3 R7,R8,4(R11) ;GET END ADDR MOVQ DPT$T_NAME(R8),8(R11) ;GET START OF NAME MOVL DPT$T_NAME+8(R8),16(R11);GET END OF NAME ADDL2 #20,R11 ;NEXT ENTRY AOBLSS #MAXDEVICE,R10,1$ ;count it, and do ti again if room 10$: MOVL R10,@8(AP) MOVL #1,R0 RET DEVPRI: .LONG IPL$_TIMER ASSUME LE 512 .END TQE