TRA TITLE 'DMKTRA (CP) VM/370 - RELEASE 6' 00001000
ISEQ 73,80 VALIDATE SEQUENCING OF SOURCE 00002000
*. 00003000
* MODULE NAME - 00004000
* 00005000
* DMKTRA 00006000
* 00007000
* FUNCTION - 00008000
* 00009000
* TO PROVIDE A VIRTUAL MACHINE WITH THE FACILITY TO TRACE 00010000
* SVC INSTRUCTIONS, PROGRAM INTERRUPTS, EXTERNAL INTERRUPTS, 00011000
* PRIVILEGED INSTRUCTIONS, I/O OPERATIONS, SUCCESSFUL BRANCHES, 00012000
* OR ALL INSTRUCTIONS, WITH OUTPUT ON THE PRINTER, TERMINAL, 00013000
* OR BOTH. 00014000
* 00015000
* COMMAND LINE FORMAT - 00016000
* 00017000
* +---------+---------------------------------------+ 00018000
* | | | 00019000
* | TRACE | SVC < PRINTER > | 00020000
* | TR | I/O | 00021000
* | | PROGRAM < TERMINAL < RUN >> | 00022000
* | | EXTERNAL < TERMINAL < NORUN >> | 00023000
* | | PRIV | 00024000
* | | SIO < BOTH < RUN >> | 00025000
* | | CCW < BOTH < NORUN >> | 00026000
* | | BRANCH | 00027000
* | | INSTRUCT < OFF > | 00028000
* | | CSW | 00029000
* | | ALL | 00030000
* | | | 00031000
* | | END | 00032000
* | | | 00033000
* +---------+---------------------------------------+ 00034000
* 00035000
* ATTRIBUTES - 00036000
* 00037000
* REENTRANT, PAGEABLE, CALLED VIA SVC 00038000
* 00039000
* ENTRY POINTS - 00040000
* 00041000
* DMKTRACE - INITIALIZE, MODIFY, OR TERMINATE THE TRACE FUNCTION 00042000
EJECT 00043000
* ENTRY CONDITIONS - 00044000
* 00045000
* GPR 9 = ADDRESS OF COMMAND BUFFER 00046000
* GPR 11 = ADDRESS OF VIRTUAL MACHINE VMBLOK 00047000
* GPR 12 = ENTRY POINT ADDRESSABILITY 00048000
* GPR 13 = ADDRESS OF STANDARD SAVE AREA 00049000
* 00050000
* EXIT CONDITIONS - 00051000
* 00052000
* TRACE CONTROL BLOCK HAS BEEN OBTAINED IF NECESSARY, 00053000
* INITIALIZED OR MODIFIED AS NEEDED, OR RETURNED TO 00054000
* FREE STORAGE IF "TRACE END" HAS BEEN EFFECTED. 00055000
* 00056000
* TRACE CONTROL FLAGS IN THE USER'S VMBLOK HAVE SIMILARLY 00057000
* BEEN SET, MODIFIED, OR RESET, AS APPROPRIATE. 00058000
* 00059000
* CALLS TO OTHER ROUTINES - 00060000
* 00061000
* DMKSCNFD - TO PICK UP PARAMETERS FROM COMMAND LINE 00062000
* DMKQCNWT - WRITE A MESSAGE TO USER TERMINAL 00063000
* DMKERMSG - TO TYPE ERROR MESSAGES TO USER 00064000
* DMKFREE - TO GET FREE STORAGE FOR TRACE CONTROL BLOCK 00065000
* DMKFRET - TO RETURN TRACE CONTROL BLOCK TO FREE STORAGE 00066000
* DMKTRCPB - TO PUT BACK USER INSTRUCTIONS ALTERED BY TRACING 00067000
* DMKTRCIT - TO SET NEEDED "SVC B2" FOR INSTRUCTION TRACING 00068000
* DMKSTKCP - TO STACK A CP REQUEST BLOCK IF NECESSARY 00069000
* 00070000
* EXTERNAL REFERENCES - 00071000
* 00072000
* NONE 00073000
* 00074000
* TABLES / WORK AREAS - 00075000
* 00076000
* TRACE CONTROL BLOCK 00077000
EJECT 00078000
* REGISTER USAGE - 00079000
* 00080000
* GPR 9 = ADDRESS OF COMMAND BUFFER (FOR DMKTRACE ENTRY) 00081000
* OR 00082000
* ADDRESS OF TRACE CONTROL BLOCK 00083000
* GPR 12 - BASE REGISTER 00084000
* GPR 13 - ADDRESS OF STANDARD SAVE AREA 00085000
* 00086000
* OTHER REGISTERS = WORK REGISTERS 00087000
* 00088000
* NOTES - 00089000
* 00090000
* SEE "RESTRICTIONS" (PRECEDING "ERROR MESSAGES") 00091000
* 00092000
* VARIOUS TRACE OPTIONS CAN BE SET CUMULATIVELY BY ISSUING 00093000
* SUCCESSIVE TRACE COMMANDS; FOR EXAMPLE TO HAVE BRANCH 00094000
* TRACING ON THE TERMINAL (WITH RUN ON) AND FULL INSTRUCTION 00095000
* TRACING ON THE PRINTER THE FOLLOWING COULD BE ISSUED 00096000
* (ASSUMING THE USER IS IN CP MODE): 00097000
* 00098000
* TRACE BRANCH TERMINAL RUN 00099000
* TRACE INSTRUCT PRINTER 00100000
* BEGIN (OR SIMILAR CP COMMAND) 00101000
* 00102000
* FOR FULL INSTRUCTION OR BRANCH TRACING, ANY INSTRUCTION 00103000
* WHICH MODIFIES THE NEXT BYTE IN STORAGE (FOLLOWING THE 00104000
* INSTRUCTION) WILL CAUSE ERRONEOUS RESULTS, USUALLY 00105000
* RESULTING IN TRACING BEING TERMINATED UNTIL AN INTERRUPT 00106000
* OCCURS. 00107000
* 00108000
* SIMILARLY, AN INSTRUCTION WHICH EXAMINES EITHER (OR BOTH) 00109000
* OF THE NEXT TWO BYTES FOLLOWING THE INSTRUCTION (WHEN 00110000
* RUNNING WITH FULL INSTRUCTION OR BRANCH TRACING) WILL 00111000
* OBTAIN ERRONEOUS DATA. 00112000
* 00113000
* AN INSTRUCTION WHICH EXECUTES THE NEXT INSTRUCTION IN 00114000
* SEQUENCE, ON THE OTHER HAND, WILL BE HANDLED SATISFACTORILY, 00115000
* EXCEPT THAT ONLY THE FIRST EXECUTION OF THE INSTRUCTION WILL 00116000
* WILL BE TRACED. (IF NO TRANSFER OCCURS, THE 'EX' DROPS THRU, 00117000
* AND THE INSTRUCTION IS DONE AGAIN IN LINE, IT WILL NOT 00118000
* BE TRACED THE SECOND TIME. TRACING WILL THEN RESUME WITH 00119000
* THE NEXT INSTRUCTION FOLLOWING THE EXECUTED INSTRUCTION.) 00120000
* 00121000
* WHEN SEVERAL TRACE OPTIONS ARE IN EFFECT, THE SAME 00122000
* INSTRUCTION CAN APPEAR IN THE TRACE OUTPUT MORE THAN 00123000
* ONCE. FOR EXAMPLE, IF FULL INSTRUCTION TRACING WERE 00124000
* IN EFFECT, A START I/O (SIO) INSTRUCTION WOULD BE TRACED 00125000
* BEFORE IT IS EXECUTED; SUBSEQUENTLY, WHEN THE SIO HAS 00126000
* BEEN HANDLED BY CP, AND THE CONDITION CODE IS READY 00127000
* TO BE REFLECTED TO THE USER, THE SIO WOULD BE TRACED 00128000
* AGAIN WITH THE USUAL PERTINENT INFORMATION GIVEN FOR 00129000
* THE TRACING OF I/O OPERATIONS (SEE RESPONSES). 00130000
EJECT 00131000
* OPERATION - 00132000
* 00133000
* DMKTRACE - INITIALIZE, MODIFY, OR TERMINATE THE TRACE FUNCTION 00134000
* 00135000
* THE COMMAND LINE IS CHECKED FOR VALID OPERANDS (E.G. 00136000
* SVC, SIO, OR I/O) - OF WHICH AT LEAST ONE MUST BE 00137000
* PRESENT; AND FOR ANY VALID OPTIONS (E.G. PRINTER). 00138000
* AN ERROR MESSAGE IS GIVEN IF NO OPERAND IS PRESENT, 00139000
* OR IF INVALID, CONFLICTING, OR MUTUALLY EXCLUSIVE 00140000
* OPTIONS ARE FOUND. IF ALL OPERAND(S) AND OPTION(S) 00141000
* ARE VALID, THEN TRACING IS INITIATED (IF IT WAS NOT 00142000
* IN EFFECT) OR MODIFIED (IF ALREADY IN EFFECT) TO CAUSE 00143000
* SPECIFIED TRACING TO BE IMPLEMENTED ON THE TERMINAL, 00144000
* PRINTER, OR BOTH. IF TRACING IS ON THE TERMINAL 00145000
* (WHETHER OR NOT ALSO ON THE PRINTER), THE USER MAY 00146000
* SPECIFY EITHER 'RUN' IF HE WISHES HIS VIRTUAL MACHINE TO 00147000
* KEEP RUNNING WHILE TRACE OUTPUT IS OCCURRING, OR 'NORUN' 00148000
* IF HE WISHES HIS VIRTUAL MACHINE TO PAUSE FOR INPUT 00149000
* FROM THE TERMINAL AFTER EACH TRACED EVENT. IF USER IS TRACING 00150000
* SVC, PRIV, BRANCH, INSTRUCT, OR ALL, VM ASSIST IS TURNED OFF. 00151000
* 00152000
* 'TERMINAL' AND 'NORUN' ARE THE DEFAULTS. 00153000
* 00154000
* 'TRACE END' WILL TERMINATE ALL TRACING. IN ADDITION, IF VM 00155000
* ASSIST HAD BEEN TURNED OFF FOR TRACING AND THE USER WANTS IT 00156000
* ON, VM ASSIST IS TURNED BACK ON. 00157000
* 00158000
* 'TRACE OPERAND OFF' WILL TERMINATE TRACING FOR THAT 00159000
* FUNCTION. FOR EXAMPLE, IF SIO AND CCW TRACING WERE 00160000
* IN EFFECT, 'TRACE CCW OFF' WOULD RESET CCW TRACING 00161000
* BUT RETAIN SIO TRACING. IF ALL TRACING HAS BECOME 00162000
* RESET, THEN THIS IS HANDLED LIKE 'TRACE END'. 00163000
* 00164000
* IF 'TRACE OPERAND OFF' OR 'TRACE END' IS GIVEN AND 00165000
* TRACING IS NOT IN EFFECT, AN ERROR MESSAGE IS GIVEN. 00166000
* 00167000
* CERTAIN OPERANDS AUTOMATCIALLY IMPLY OTHERS: FOR EXAMPLE 00168000
* CCW IMPLIES SIO; AND CSW IMPLIES I/O. THEY MAY BE 00169000
* SPECIFIED SEPARATELY, HOWEVER, FOR EXAMPLE: 00170000
* TRACE SIO BOTH RUN 00171000
* TRACE CCW PRINTER 00172000
* 00173000
* RESPONSES - 00174000
* 00175000
* TRACING INITIATED: 00176000
* 00177000
* 'TRACE STARTED' 00178000
* 00179000
* TRACING MODIFIED BY AN ADDITIONAL 'TRACE' COMMAND: 00180000
* 00181000
* (NONE) 00182000
* 00183000
* TRACING ENDED: 00184000
* 00185000
* 'TRACE ENDED' 00186000
EJECT 00187000
* RESTRICTIONS - 00188000
* 00189000
* NONE - 00190000
* 00191000
* ERROR MESSAGES - 00192000
* 00193000
* DMKTRA002E INVALID OPERAND - OPERAND 00194000
* DMKTRA003E INVALID OPTION - OPTION 00195000
* DMKTRA013E CONFLICTING OPERAND - OPERAND 00196000
* DMKTRA026E OPERAND MISSING OR INVALID 00197000
* DMKTRA180W TRACE NOT IN EFFECT 00198000
* DMKTRA182E "PER" TRACE IS ACTIVE 00199000
*. 00200000
EJECT 00201000
* MACRO TO SET UP FLAG-BITS ETC. FOR ARGUMENTS & OPTIONS: 00202000
* &NAME = ARGUMENT OR OPTION - E.G. SVC OR PRINTER 00203000
* &COUNT = MINIMUM NUMBER OF BYTES FOR SHORT-FORM ABBREVIATION 00204000
* &FLAG1 = FLAG-BITS CORRESPONDING TO VMTREXT = TREXCTL1 00205000
* &FLAG2 = FLAG-BITS CORRESPONDING TO TREXCTL2 00206000
SPACE 00207000
MACRO 00208000
&LABEL ARGMAC &NAME,&COUNT,&FLAG1,&FLAG2 00209000
&LABEL DC CL8'&NAME' 00210000
DC AL1(&COUNT) 00211000
DC AL1(&FLAG1),AL1(&FLAG2) 00212000
MEND 00213000
SPACE 00214000
COPY OPTIONS 00215000
COPY LOCAL 00216000
EJECT 00217000
DMKTRA CSECT LOADER CONTROL 00218000
SPACE 00219000
DC CL8'DMKTRA' MODULE IDENTIFIER 00220000
SPACE 00221000
USING PSA,R0 00222000
USING VMBLOK,R11 00223000
USING DMKTRA,R12 00224000
USING SAVEAREA,R13 00225000
* 00226000
EXTRN DMKSCNFD 00227000
EXTRN DMKERMSG 00228000
EXTRN DMKTRCPB 00229000
EXTRN DMKTRCIT 00230000
EXTRN DMKLOCKD @V200820 00231000
EXTRN DMKLOCKQ @VA03505 00232000
* 00233000
ENTRY DMKTRACE 00234000
DMKTRACE ENTER "TRACE" INITIALIZER ENTRY POINT 00235000
SL R12,F8 SUBTRACT 8 A LA 'RELOC' FOR 1ST ENTRY 00236000
MVC SAVEWRK7(1),VMRSTAT SAVE VMRSTAT FLAG STATUS AT ENTRY 00237000
OI VMRSTAT,VMEXWAIT+VMCFWAIT ENSURE THAT USER IS NOT RUN 00238000
SLR R0,R0 CLEAR SAVEWRK2 AND SAVEWRK1 FLAGS 00241000
ST R0,SAVEWRK2 SAVEWRK2+2 USED FOR OPTION FLAG-BITS 00242000
ST R0,SAVEWRK1 SAVEWRK1+2 USED FOR ARGUMENT FLAG-BITS 00243000
CALL DMKSCNFD PICK UP FIRST ARGUMENT 00244000
BNZ ARGMISS TUT-TUT IF NOTHING THERE AT ALL. 00245000
CL R0,F3 3 BYTES ? 00246000
BNE TRA02 NOPE. 00247000
CLC CLEND(3),0(R1) IS IT 'END' ? 00248000
BE TRAEND YES. 00249000
* 00250000
TRA02 LA R3,ARGFIRST SET R3-R4-R5 FOR BXLE LOOP 00251000
LA R4,11 ... 00252000
LA R5,ARGLAST ... 00253000
LR R15,R0 BYTE-COUNT INTO R15 00254000
CL R15,F8 MORE THAN 8 BYTES ? 00255000
BH ARGINV INVALID IF YES. 00256000
BCTR R15,0 LESS 1 FOR EX-CLC 00257000
* 00258000
TRA04 EX R15,EXCLC LOOK FOR MATCH IN TABLE OF ARGUMENTS 00259000
BE TRA18 TRF IF PROBABLE MATCH. 00260000
BXLE R3,R4,TRA04 ITERATE THRU ARGUMENT TABLE. 00261000
* 00262000
TM SAVEWRK2+2,ARGFOUND DID WE FIND AT LEAST ONE ARGUMENT ? 00263000
BZ ARGINV IF NOT, CONSIDER COMMAND INVALID. 00264000
* 00265000
CL R0,F3 WAS BYTE-COUNT 3 00266000
BNE TRA06 NOPE. 00267000
CLC CLOFF,0(R1) IF YES, WAS 'OFF' SPECIFIED ? 00268000
BE TRAOFF YES 00269000
TRA06 LA R3,OPTFIRST SET R3 FOR BXLE LOOP 00270000
LA R5,OPTLAST DITTO R5 (R4 STILL = 11) 00271000
LR R15,R0 BYTE-COUNT INTO R15 00272000
CL R15,F8 MORE THAN 8 BYTES ? 00273000
BH OPTINV INVALID IF YES. 00274000
BCTR R15,0 LESS 1 FOR EX-CLC 00275000
* 00276000
TRA08 EX R15,EXCLC LOOK FOR MATCH IN TABLE OF OPTIONS 00277000
BE TRA10 TRF IF PROBABLE MATCH 00278000
BXLE R3,R4,TRA08 ITERATE THRU OPTION TABLE. 00279000
B OPTINV INVALID OPTION IF NOT IN TABLE. 00280000
* 00281000
* APPARENT MATCH FOUND WHEN CHECKING THE OPTIONS: 00282000
TRA10 CLM R0,1,8(R3) IF MATCH, DO WE HAVE ENOUGH BYTES ? 00283000
BL OPTINV INVALID IF TOO FEW. 00284000
ICM R15,3,9(R3) PICK UP HALFWORD OF FLAGS, 00285000
O R15,SAVEWRK2 OR INTO SAVEWRK2 FLAG 00286000
ST R15,SAVEWRK2 AND REPLACE ACCUMULATED FLAGS 00287000
CALL DMKSCNFD ANY MORE OPTIONS THERE ? 00288000
BZ TRA06 IF YES, GO CHECK THEM. 00289000
TM SAVEWRK2+2,JRUN+JNORUN CHECK RUN/NORUN FLAGBITS 00290000
BO RUNNORUN INVALID IF 'NORUN' SET ALONG WITH 'RUN' 00291000
TM SAVEWRK2+2,JBOTH TERMINAL & PRINTER BOTH SPECIFIED ? 00292000
BO TRA14 YES - CHECK FOR RUN OR NORUN. 00293000
BZ TRA12 IF NEITHER, DEFAULT TO TERMINAL. 00294000
TM SAVEWRK2+2,JTERM IF ONE OR THE OTHER, WHICH ? 00295000
BO TRA14 TRF IF IT WAS THE TERMINAL. 00296000
TM SAVEWRK2+2,JRUN+JNORUN IF PRT ONLY, WAS RUN/ @VA00782 00297000
* NORUN SPECIFIED? 00298000
BNZ PRTNORUN INVALID IF SO @VA00782 00299000
B TRA22 AND GO FINISH UP. 00300000
* 00301000
TRA12 OI SAVEWRK2+2,JTERM DEFAULT TO TERMINAL 00302000
* 00303000
TRA14 TM SAVEWRK2+2,JRUN TERMINAL OR BOTH, CHECK FOR 'RUN' 00304000
BO TRA22 OK IF RUN WAS SPECIFIED. 00305000
B TRA20 NO, MAKE SURE 'NORUN' SET & FINISH UP. 00306000
* 00307000
* APPARENT MATCH FOUND WHEN CHECKING PRIMARY ARGUMENTS: 00308000
TRA18 CLM R0,1,8(R3) IF MATCH, DO WE HAVE ENOUGH BYTES ? 00309000
BL ARGINV INVALID IF TOO FEW BYTES. 00310000
ICM R15,3,9(R3) PICK UP HALFWORD OF FLAGS @V304735 00311000
O R15,SAVEWRK1 'OR' IN WITH FLAGS ACCUMULATED SO FAR, 00312000
ST R15,SAVEWRK1 AND REPLACE 00313000
OI SAVEWRK2+2,ARGFOUND SIGNAL AT LEAST ONE ARGUMENT FOUND 00314000
CALL DMKSCNFD ANY MORE FIELDS ON INPUT LINE ? 00315000
BZ TRA02 IF YES, SEE IF THEY ARE ARGUMENTS. 00316000
* NO OPTIONS IN COMMAND LINE - JUST PRIMARY ARGUMENTS: 00317000
TRA20 OI SAVEWRK2+2,JTERM+JNORUN SET FOR TERMINAL + NORUN 00318000
* 00319000
* ALL OPTIONS LOOK OK - COMPLETE THE INITIALIZATION PROCESS: 00320000
TRA22 DS 0H NOW FINISH UP: 00321000
TM SAVEWRK1+3,TREXBRAN+TREXINST BRANCH & INSTRUCT BOTH SET 00322000
BO BRINCOMP THAT'S INVALID FOR ONE TRACE CALL. 00323000
L R9,VMTREXT GET POINTER TO TRACE CONTROL BLOCK 00324000
LTR R9,R9 (IF ANY) 00325000
BNZ TRA24 IT'S ALREADY THERE. 00326000
MSG 'TRACE STARTED' MIGHT AS WELL GIVE MESSAGE NOW 00327000
CALL DMKQCNWT,PARM=NORET ... 00328000
LA R0,TREXSIZE GET A TRACE CONTROL BLOCK 00329000
CALL DMKFREE ... 00330000
ST R1,VMTREXT STORE ADDRESS IN VMBLOK, 00331000
LR R9,R1 INTO R9 THE ADDRESS SHALL GO 00332000
USING TREXT,R9 AND REFERENCE SAME 00333000
XC TREXT(TREXSIZE*8),TREXT CLEAR THE WHOLE BLOCK 00334000
MVC TREXIN1(8),FFS SET TREXIN1 & TREXIN2 TO X'FFFFFFFF' 00335000
MVC TREXANSI(4),FFS DITTO TREXANSI 00336000
* 00337000
TRA24 DS 0H NOW ADJUST FLAG-BITS IF/AS NEEDED: 00338000
L R0,XRIGHT16 X'0000FFFF' INTO R0 @VA00782 00339000
ICM R1,2,VMTRCTL LOAD FIRST BYTE OF CONTROL. PER001 00340000
IC R1,TREXCTL+1 LOAD THE SECOND BYTE. PER001 00340500
LH R2,TREXPRNT OLD TREXPRNT INTO R2 (RIGHT END) 00341000
LH R3,TREXTERM OLD TREXTERM INTO R3 (RIGHT END) 00342000
LH R4,TREXRUNF OLD TREXRUNF INTO R4 (RIGHT END) 00343000
L R5,SAVEWRK1 NEW FLAG-BITS INTO R5 (RIGHT END) 00344000
XR R0,R5 GET "EXCLUSIVE OR" OF NEW FLAG BITS 00345000
NR R2,R0 RESET OLD PRINTER BITS (IF ANY) 00346000
NR R3,R0 RESET OLD TERMINAL BITS (IF ANY) 00347000
NR R4,R0 RESET OLD RUN BITS (IF ANY) 00348000
TM SAVEWRK2+2,JPRINT WAS PRINTER WANTED ? 00349000
BZ TRA28 NOPE - MUST BE JUST THE TERMINAL. 00350000
OR R2,R5 YES - SET NEW PRINTER FLAG BITS 00351000
TM SAVEWRK2+2,JTERM TERMINAL ALSO WANTED ? 00352000
BZ TRA30 NOPE, GO SET UP FLAG BITS. @VA00782 00353000
TRA28 OR R3,R5 SET NEW TERMINAL FLAG-BITS 00354000
TM SAVEWRK2+2,JRUN "RUN" WANTED ? 00355000
BZ TRA30 NOPE. 00356000
TRA29 OR R4,R5 SET NEW "RUN" FLAG-BITS 00357000
TRA30 OR R1,R5 "OR" NEW FLAG-BITS INTO TREXCTL FLAGS 00358000
STH R1,TREXCTL STORE NEW TREXCTL1/TREXCTL2 00359000
STCM R1,2,VMTRCTL AND 1ST BYTE OF SAME INTO VMBLOK FLAGBYTE 00360000
STH R2,TREXPRNT NEW TREXPRNT, 00361000
STH R3,TREXTERM NEW TREXTERM, 00362000
STH R4,TREXRUNF AND NEW TREXRUNF 00363000
LA R1,TREXPRNT GET 1ST FIELD TO CHECK @VA00782 00364000
LA R2,3 COUNT OF TIMES TO DO THIS TRICK @VA00782 00365000
NEXTBITS TM 1(R1),TREXCCW CCW'S BEING TRACED HERE? @VA00782 00366000
BZ *+12 NOPE, SKIP AROUND @VA00782 00367000
OI 0(R1),VMTRSIO INSURE SIO IS ON TOO. @VA00782 00368000
OI VMTRCTL,VMTRSIO SET IT ON IN THE VMBLOK TOO @VA00782 00369000
TM 1(R1),TREXCSW CCW'S BEING TRACED HERE? @VA00782 00370000
BZ *+12 NOPE, SKIP AROUND @VA00782 00371000
OI 0(R1),VMTRIO INSURE I/O IS ON TOO @VA00782 00372000
OI VMTRCTL,VMTRIO SET I/O ON IN THE VMBLOK @VA00782 00373000
LA R1,2(R1) GET NEXT FIELD TO CHECK @VA00782 00374000
BCT R2,NEXTBITS & GO CHECK IT (MAYBE) @VA00782 00375000
TM VMTRCTL,VMTREX TRACE EXTERNAL REQUESTED ? @V3M4026 00375150
BZ NOTEXTS IF YES, MAKE SURE TO DISABLE THE @V3M4035 00375300
NI VMMCR6,X'FF'-VMMVTMR VIRTUAL TIMER ASSIST @V3M4026 00375450
* (IF NOT, MIGHT LOSE TIMER INTS.) 00375600
NOTEXTS EQU * @V3M4035 00375750
TM SAVEWRK1+3,TREXBRAN+TREXINST BRANCH OR FULL TRACE WANTED 00376000
BZ TRAEXIT IF NOT, GO EXIT (WE'RE ALL SET). 00377000
CALL DMKTRCPB RESET ANY POSSIBLE OLD SVCB1/SVCB2 00378000
TM VMPSW+1,WAIT IS USER IN WAIT STATE ? 00379000
BO TRAEXIT YES - IT WILL HAVE TO BE SET LATER. 00380000
L R1,VMPSW+4 NO - WHERE WE'LL BE GOING INTO R1 00381000
CALL DMKTRCIT INITIALIZE TRACING BRANCHES AND/OR INSTR 00382000
B TRAEXIT WHEN ALL THRU, GO EXIT. 00383000
EJECT 00384000
TRAOFF DS 0H "OFF" WAS SPECIFIED: 00385000
BAL R14,GETR9 GET R9 = POINTER TO TRACE CONTROL BLOCK 00386000
* (GOES TO "TRACENOT" IF NONEXISTENT) 00387000
USING TREXT,R9 00388000
TM SAVEWRK1+2,VMTRSIO SIO TRACING TO BE TURNED OFF ? 00389000
BZ TRA32 NOPE. 00390000
OI SAVEWRK1+3,TREXCCW YES, ENSURE TURN OFF CCW BIT ALSO 00391000
TRA32 TM SAVEWRK1+2,VMTRIO I/O INTERRUPTS TO BE TURNED OFF ? 00392000
BZ TRA33 NO. 00393000
OI SAVEWRK1+3,TREXCSW YES, ENSURE TURN OFF CSW BIT ALSO 00394000
TRA33 LH R4,TREXCTL GET OLD CONTROL BITS 00395000
NI TREXCTL,255-VMTRPER CLEAR THE P.E.R. BIT. PER001 00395500
L R3,SAVEWRK1 GET NEW ARGUMENT FLAG-BITS 00396000
X R3,XRIGHT16 EXCLUSIVE OR VS. 0000FFFF TO INVERT 00397000
NR R4,R3 NOW TURN OFF SPECIFIED BITS 00398000
LR R0,R4 PREPARE TO CLEAR P.E.R BIT. PER001 00398100
N R0,=A(X'7FFF') CLEAR ALL BUT THE P.E.R. PER001 00398200
BZ TRAEND1 IF FLAG ALL CLEAR, TREAT AS "TRACE END" 00399000
LA R15,TREXBRAN+TREXINST BRANCH OR INSTRUCTION TRACING 00400000
NR R15,R4 STILL ON ? 00401000
BZ TRA34 NOPE - REPLACE POSSIBLE ALTERED INSTRUCT. 00402000
LA R15,(VMTRBRIN)*256 YES - SET VMTRBRIN FLAG-BIT AGAIN 00403000
OR R4,R15 ... 00404000
B TRA35 DON'T RESET ALTERED INSTRUCTIONS. 00405000
TRA34 CALL DMKTRCPB PUT BACK POSSIBLE ALTERED INSTRUCTIONS 00406000
TRA35 STH R4,TREXCTL NOW STORE REVISED FLAG 00407000
NI TREXCTL,255-VMTRPER CLEAR P.E.R. TRACING. PER001 00407500
STCM R4,2,VMTRCTL ALSO IN VMBLOK FLAG 00408000
TM VMTRCTL,VMTREX IS USER STILL TRACING EXTERNAL ? @V3M4026 00408300
BZ TRATMRCK NO, GO TRY TO USE TIMER ASSIST. @V3M4026 00408600
B TRAEXIT AND GO EXIT. 00409000
SPACE 00410000
TRAEND DS 0H "END" WAS SPECIFIED: 00411000
BAL R14,GETR9 GET R9 = POINTER TO TRACE CONTROL BLOCK 00412000
* (GOES TO "TRACENOT" IF NONEXISTENT) 00413000
USING TREXT,R9 00414000
ST R9,TRALOCK+4 PUT TREXT ADDR DOWN FOR LOCK @VA03505 00415000
LA R1,TRALOCK POINT TO THE LOCK NAME @VA03505 00416000
CALL DMKLOCKQ MAKE SURE PREVIOUS TRACE IS DONE @VA03505 00417000
TRAEND1 CALL DMKTRCPB PUT BACK ANY INSTRUCTIONS WHICH WE ALTERED 00418000
ST R9,TRALOCK+4 PUT TREXT ADDRESS DOWN FOR LOCK @V200820 00419000
LA R1,TRALOCK POINT TO THE LOCK "NAME" @V200820 00420000
TRAEND2 EQU * @V200820 00421000
CALL DMKLOCKD DEQUEUE ANY TRACE LOCKS @V200820 00422000
BZ TRAEND2 CONTINUE UNTIL NOT LOCKED @V200820 00423000
LA R0,TREXSIZE SIZE OF TREX BLOCK, 00424000
LR R1,R9 AND ITS ADDRESS 00425000
SLR R15,R15 BEFORE CALLING DMKFRET, 00426000
ST R15,VMTREXT CLEAR "VMTREXT" AND 00427000
NI VMTRCTL,VMTRPER RESET ALL TRACING. PER001 00428000
CALL DMKFRET GIVE IT BACK TO FREE STORAGE 00429000
LA R1,TRENDED 'TRACE ENDED' MESSAGE TO THE USER 00430000
LA R0,L'TRENDED+L'CLEND ... 00431000
CALL DMKQCNWT,PARM=NORET ... 00432000
SPACE 00432050
TRATMRCK EQU * HERE TO TRY TIMER ASSIST ENABLE @V3M4026 00432100
TM VMFSTAT,VMFVTMR IS IT TO BE USED ? @V3M4026 00432150
BZ TRAEXIT NO, ALL SET. @V3M4026 00432200
TM VMTLEVEL,VMRON+VMTON IS THE TIMER RUNNING ? @V3M4026 00432250
BZ TRAEXIT NO, GET OUT. @V3M4026 00432300
ICM R1,B'0111',VMMADDR NEED TO HAVE VM ASSIST ON. @V3M4026 00432350
BZ TRAEXIT IF NOT, CAN'T USE TIMER ASSIST @V3M4026 00432400
USING MICBLOK,R1 VMA POINTER LIST ADDRESSABILITY @V3M4026 00432450
LCTL C1,C1,VMSEG GET USER'S ADDRESS SPACE @V3M4026 00432500
LRA R15,TIMER-PSA VIRTUAL LOC. 80 TIMER RESIDENT ? @V3M4026 00432550
BZ STMCVTMR YES, PUT THIS ADDR IN MICBLOK @V3M4035 00432600
LA R15,VMTIMER POINT TO VALUE IN VMBLOK @VA06289 00432650
STMCVTMR ST R15,MICVTMR THIS ADDRESS WILL BE DECREMENTED @V3M4035 00432700
OI VMMCR6,VMMVTMR SET THE TIMER ASSIST ENABLE FLAG @V3M4026 00432750
SPACE 00432800
TRAEXIT DS 0H RESTORE VMRSTAT FLAGBITS (AS NEEDED) BEFORE EXIT: 00433000
OI SAVEWRK7,255-(VMEXWAIT+VMCFWAIT) PRESERVE ALL OTHER BITS 00434000
NC VMRSTAT(1),SAVEWRK7 RESTORE VMEXWAIT|VMCFWAIT AS NEEDED 00435000
TRAEXITR LCTL C1,C1,VMSEG BE SURE CONTROL REG 1 IS CORRECTLY SET, 00436000
EXIT AND REALLY EXIT. 00437000
EJECT 00438000
* TABLES FOR CHECKING TRACE ARGUMENTS AND OPTIONS: 00439000
* (SEE "ARGMAC" MACRO) 00440000
* 00441000
EXCLC CLC 0(*-*,R1),0(R3) EXECUTED CLC TO FIND ARGUMENTS 00442000
* 00443000
* KEEP THE NEXT TWO IN ORDER: 00444000
TRENDED DC C'TRACE ' 00445000
CLEND DC C'ENDED' 00446000
* 00447000
CLOFF DC CL3'OFF' 00448000
CLTRA EQU DMKTRA+3 (= CL3'TRA') 00449000
SPACE 00450000
DS 0F WORD BOUNDARY ALIGNMENT @VA01382 00451000
TRALOCK DC C'TREX',A(*-*) LOCK NAME FOR DMKLOC @V200820 00452000
PRINT NOGEN @V200820 00453000
* 00454000
ARGFIRST ARGMAC INSTRUCT,4,VMTRBRIN,TREXINST INSTRUCT 00455000
CLSVC ARGMAC SVC,3,VMTRSVC,0 SVC 00456000
CLIO ARGMAC I/O,3,VMTRIO,0 I/O 00457000
CLPROG ARGMAC PROGRAM,3,VMTRPRG,0 PROGRAM 00458000
CLEXT ARGMAC EXTERNAL,3,VMTREX,0 EXTERNAL 00459000
ARGMAC PRIV,4,VMTRPRV,0 PRIV 00460000
ARGMAC SIO,3,VMTRSIO,0 SIO 00461000
CLCCW ARGMAC CCW,3,0,TREXCCW CCW 00462000
CLCC EQU CLCCW (= CL2'CC') 00463000
CHARW EQU CLCCW+2 (= C'W') 00464000
CLCSW ARGMAC CSW,3,0,TREXCSW CSW 00465000
CLBRANCH ARGMAC BRANCH,2,VMTRBRIN,TREXBRAN BRANCH 00466000
ARGLAST ARGMAC ALL,3,VMTRALL,TREXCCW+TREXCSW+TREXINST ALL 00467000
EJECT 00468000
* OPTIONS: 00469000
* 00470000
OPTFIRST ARGMAC PRINTER,1,JPRINT,0 PRINTER 00471000
ARGMAC TERMINAL,4,JTERM,0 TERMINAL 00472000
ARGMAC BOTH,4,JBOTH,0 BOTH 00473000
ARGMAC RUN,3,JRUN,0 RUN 00474000
OPTLAST ARGMAC NORUN,3,JNORUN,0 NORUN 00475000
SPACE 00476000
CLNORUN EQU OPTLAST = C'NORUN' 00477000
SPACE 2 00478000
* FLAG-BITS USED IN SAVEWRK2+2 (LOW HALFWORD OF SAVEWRK2): 00479000
ARGFOUND EQU X'40' 00480000
JPRINT EQU X'20' 00481000
JTERM EQU X'10' 00482000
JBOTH EQU JPRINT+JTERM 00483000
JRUN EQU X'04' 00484000
JNORUN EQU X'02' 00485000
SPACE 2 00486000
* ADDITIONAL FLAGBIT(S) DEFINED IN SAVEWRK1+3: 00487000
* 00488000
NOSTOP EQU X'02' NO MSG TO BE GIVEN, AND DO NOT STOP. 00489000
NOTRAMSG EQU X'01' NO TRACE MSG WANTED (ALREADY GIVEN) 00490000
PRINT GEN @V200820 00491000
EJECT 00492000
* ERROR RETURNS: 00493000
* 00494000
* INCOMPATIBLE COMBINATION OF 'BRANCH' & 'INSTRUCT' 00495000
* (THE ONLY COMPATIBLE COMBINATION IS BRANCH ON ONE DEVICE 00496000
* AND INSTRUCT ON THE OTHER - E.G. BRANCH ON TERMINAL, 00497000
* INSTRUCT ON THE PRINTER) 00498000
* 00499000
BRINCOMP LA R1,CLBRANCH 'BRANCH' AND 'INSTRUCT' 00500000
LA R0,6 USE 'BRANCH' FOR THE MESSAGE 00501000
B INCOMPAT ... 00502000
SPACE 00503000
* 'PRINTER' AND 'NORUN' WERE SPECIFIED (NOT VALID COMBINATION): 00504000
* 00505000
PRTNORUN DS 0H 'RUN/NORUN PRINTER' IS INCOMPATA @VA00782 00506000
LA R1,=C'RUN/NORUN PRINTER' SET UP FOR THE @VA00782 00507000
LA R0,17 DIRTY MESSAGE... @VA00782 00508000
B INCOMPAT AND LET HIM HAVE IT. @VA00782 00509000
* CONTINUE ... 00510000
SPACE 00511000
* 'NORUN' AND 'RUN' WERE BOTH SPECIFIED (NOT VALID COMBINATION): 00512000
* 00513000
RUNNORUN LA R1,CLNORUN 'RUN & NORUN' INCOMPATIBLE 00514000
LA R0,5 USE 'NORUN' FOR THE MESSAGE 00515000
* 00516000
INCOMPAT LA R2,13 CONFLICTING OPERAND = ERROR 13 00517000
B ERRJOIN2 00518000
* 00519000
OPTINV LA R2,3 R2=3 FOR INVALID OPTION - OPTION 00520000
B ERRJOIN2 00521000
SPACE 00522000
* OPERAND (OR POSSIBLY OPTION) WAS INVALID (R0/R1 POINT TO IT): 00523000
* 00524000
ARGINV LA R2,2 R2=2 FOR INVALID OPERAND - OPERAND 00525000
B ERRJOIN2 AND JOIN ERROR HANDLING BELOW. 00526000
SPACE 00527000
* NO ARGUMENTS WERE THERE ON THE COMMAND LINE AT ALL: 00528000
* 00529000
ARGMISS LA R2,26 THAT IS ERROR NUMBER 26 00530000
* 00531000
ERRJOIN SLR R1,R1 R1=0 MEANS NO DATA FOR DMKERMSG 00532000
* 00533000
ERRJOIN2 ST R2,SAVER2 RETURN THE ERROR CODE TO THE CALLER 00534000
ERRJOIN3 ICM R0,B'1110',CLTRA 'TRA' INTO HIGH 3 BYTES OF R0 00535000
ICM R2,B'1000',HIGHX80 SIGNAL: RETURN TO ME, PLEASE 00536000
CALL DMKERMSG CALL ERROR MESSAGE HANDLER 00537000
B TRAEXIT AND GET OUT OF HERE, MAN. 00538000
SPACE 00539000
GETR9 L R9,VMTREXT GET POINTER TO TRACE CONTROL BLOCK 00540000
LTR R9,R9 IT SHOULD EXIST - DOES IT ? 00541000
BCR 7,R14 <BNZ> YES - RETURN TO TRACE END OR TRACE OFF. 00542000
* NO - "GO DIRECTLY TO JAIL" ETC ... 00543000
* 'TRACE' NOT IN EFFECT FOR 'TRACE OPERAND OFF' OR 'TRACE END' 00544000
* 00545000
TRACENOT LA R2,180 MAKE THIS ONE ERROR NUMBER 180 00546000
ST R2,SAVER2 RETURN IT TO THE USER 00547000
SETWMSG ICM R2,B'0100',CHARW SET FOR A 'W' MESSAGE PLEASE 00548000
SLR R1,R1 NO DATA TO PASS TO DMKERMSG 00549000
B ERRJOIN3 AND JOIN COMMON LOGIC. 00550000
EJECT 00556000
* EQUATES: 00557000
* 00558000
SVCB1 EQU X'0AB1' = SVC X'B1' TO TRACE NEXT SEQUENTIAL INSTRUCTION 00559000
SVCB2 EQU X'0AB2' = SVC X'B2' TO TRACE BRANCHES 00560000
SPACE 00561000
LTORG 00562000
HIGHX80 DC X'80' FOR USE WHEN CALLING DMKERMSG 00563000
EJECT 00564000
COPY VMBLOK 00565000
VMTRALL EQU VMTRINT+VMTRSIO+VMTRBRIN FOR TRACE 'ALL' 00566000
COPY TREXT 00567000
PSA 00568000
COPY SAVE 00569000
COPY EQU 00570000
COPY MICBLOK @V3M4026 00571000
END DMKTRA @V3M4026 00572000