ASY TITLE 'DMTASY (RSCS) VM/370 - RELEASE 6' 00001000 *. 00002000 * MODULE NAME - 00003000 * 00004000 * DMTASY 00005000 * 00006000 * FUNCTION - 00007000 * 00008000 * DMTASY IS A SUPERVISOR SERVICE ROUTINE MODULE 00009000 * WHICH INITIATES AND TERMINATES ASYNCHRONOUS EXIT 00010000 * REQUESTS FOR TASK PROGRAMS. ASYNCHRONOUS EXIT 00011000 * REQUESTS FOR ASYNCHRONOUS I/O INTERRUPT, EXTERNAL 00012000 * INTERRUPT, AND ALERT EXIT REQUESTS ARE HANDLED BY 00013000 * THIS ROUTINE. 00014000 * 00015000 * ATTRIBUTES - 00016000 * 00017000 * REUSABLE 00018000 * 00019000 * ENTRY POINTS - 00020000 * 00021000 * DMTASY - INITIATE OR TERMINATE AN ASYNCH EXIT 00022000 * 00023000 * ENTRY CONDITIONS - 00024000 * 00025000 * R0 - ASYNCH EXIT CODE: 00025500 * X'00000000' FOR TASK ALERT EXIT 00026000 * X'0000XXXX' FOR ASYNCH I/O INT EXIT 00026500 * X'XXXX0000' FOR EXTERNAL INTERRUPT EXIT 00027000 * 00027500 * WHERE XXXX IS AN I/O ADDRESS OR AN EXTERNAL CODE 00028000 * 00028500 * R1 - ZERO TO TERMINATE A REQUEST 00029000 * - ADDR OF TASK ASYNCH EXIT ROUTINE TO SET A REQUEST 00029500 * 00030000 * R2+R3 - FOR CLOCK COMPARATOR EXITS ONLY, CLOCK COMP VALUE 00030500 * 00031000 * R14 - RETURN ADDRESS 00031500 * R15 - ENTRY ADDRESS 00032000 * 00036000 * EXIT CONDITIONS - 00037000 * 00038000 * NORMAL - 00039000 * 00040000 * GPR15 = X'00' ON ALL SUCCESSFUL REQUESTS 00041000 * 00042000 * ERROR - 00043000 * 00044000 * R15 - 04 IF TERMINATE REQ FOR NON-EXISTENT EXIT 00044500 * - 08 IF INITIATE REQ OF SAME CODE FOR SAME TASK 00045000 * - 0C IF INITIATING ILLEGAL EXTERNAL CODE 00045500 * VALID CODES ARE: 00046000 * X'1004' FOR CLOCK COMPARATOR 00046500 * - 10 ERROR FROM QRQ GETTING A QUEUE ELEMENT 00047000 * 00050000 EJECT 00051000 * 00052000 * CALLS TO OTHER ROUTINES - 00053000 * 00054000 * DMTQRQ - TO RESERVE AND RELEASE SUP QUEUE ELEMENTS 00055000 * 00056000 * EXTERNAL REFERENCES - 00057000 * 00058000 * NONE 00059000 * 00060000 * 00061000 * TABLES / WORKAREAS - 00062000 * 00063000 * DMTVEC - SUPERVISOR COMMON AREA 00064000 * ASYNCH INTERRUPT EXIT REQUEST ELEMENT 00065000 * TASK ELEMENT 00066000 * 00067000 * REGISTER USAGE - 00068000 * 00069000 * R0 - EXIT CODE 00070000 * R1 - NEW ASYNE 00071000 * R2 - TASK EXIT ADDRESS 00072000 * R3 - PREVIOUS ASYNE IN CHAIN 00073000 * R4 - NEXT ASYNE IN CHAIN 00074000 * R5 - LINK 00075000 * R6 - CALLING TASKS TASKE 00076000 * R7 - WORK 00077000 * R8 - WORK 00078000 * R9 - LINKTABL 00079000 * R10 - WORK 00080000 * R11 - WORK 00081000 * R12 - DMTASY BASE REG 00082000 * R13 - TASK SAVE AREA POINTER 00083000 * R14 - RETURN ADDRESS 00084000 * R15 - ENTRY ADDRESS 00085000 * 00086000 * OPERATION - 00086500 * 00087000 * DMTASY BEGINS BY UNCONDITIONALLY SUSPENDING THE 00087500 * CALLING TASK'S EXECUTION WITH A FREEZE SVC. FOR AN 00088000 * INITIATE EXIT REQUEST, THE APPROPRIATE QUEUE IS 00088500 * SCANNED FOR AN EXISTING SIMILAR REQUEST FOR THE SAME 00089000 * TASK. IF NONE IS FOUND, A SUPERVISOR STATUS QUEUE 00089500 * ELEMENT IS GOTTEN BY A CALL TO DMTQRQ, THE NEW EXIT 00090000 * ELEMENT IS BUILT FROM THE SUPPLIED INFORMATION, AND 00090500 * IT IS QUEUED ON THE APPROPRIATE CHAIN. 00091000 * FOR CLOCK COMPARATOR REQUESTS, THE NEW REQUEST IS 00091500 * QUEUED IN THE APPROPRIATE PLACE IN THE QUEUE. THE 00092000 * EXTERNAL QUEUE IS ORDERED IN THE FOLLOWING WAY: 00092500 * 00093000 * 1. CLOCK COMPARATOR INTERRUPTS IN ASCENDING CLOCK VALUE 00093500 * ORDER. 00094000 * 2. ALL OTHER EXTERNAL REQUESTS. 00094500 * 00095000 * IF THE NEW REQUEST IS NOW THE LOWEST CLOCK REQUEST, 00095500 * ITS CLOCK VALUE IS SET IN THE CLOCK COMPARATOR. 00096000 * 00096500 * IF AN ELEMENT IS FOUND AND A TERMINATE REQUEST IS BEING 00097000 * MADE, THE ELEMENT IS DEQUEUED AND RETURNED TO THE FREEQ. 00097500 * IF THE RETURNED ELEMENT REPRESENTS THE ACTIVE CLOCK 00098000 * COMPARATOR, THE CLOCK COMPARATOR IS SET TO ALL F'S. 00098500 * 00099000 * NOTE: 00099500 * 00100000 * THE EXTERNAL INTERRUPT QUEUE IS MAINTAINED IN THE 00100500 * FOLLOWING ORDER: 00101000 * 00101500 * . CLOCK COMPARATOR REQUESTS IN ASCENDING CLOCK ORDER. 00102000 * THE FIRST CLOCK COMPARATOR ENTRY REPRESENTS THE 00102500 * CLOCK VALUE WHICH HAS BEEN SET (UNLESS NONE HAS BEEN 00103000 * REQUESTED, IN WHICH CASE THE CLOCK COMPARATOR IS FF'S) 00103500 * 00104000 * . ALL OTHER EXTERNAL INTERRUPT REQUESTS IN ANY ORDER. 00104500 * 00105000 * CLOCK COMPARATOR EXIT REQUESTS ARE INITIATED BY THIS 00105500 * ROUTINE. THEY ARE TERMINATED BY EITHER A TERMINATE 00106000 * REQUEST TO THIS ROUTINE OR BY THE OCCURENCE OF THE 00106500 * INTERRUPT. 00107000 * 00111000 * 00112000 *. 00113000 EJECT 00114000 DMTASY CSECT 00115000 SPACE 00116000 * ENTRY POINT FOR CALL TO DMTASY ROUTINE 00117000 SPACE 00118000 FREEZE SAVE CALLING TASK'S STAT AND GET S/A ADDR 00119000 SPACE 00120000 LR R13,R14 REG.13 = ADDRESS OF CALLER'S TASK SAVE AREA 00121000 USING TAREA,R13 DEFINE TASK SAVE AREA DSECT ADDRESSA 00122000 USING SVECTORS,0 GET SVECTORS ADDRESSABILITY 00123000 USING ASYNE,R4 GET ASYN ELEMENT ADDRESSABILITY 00124000 USING TASKE,R6 ADDRESS THE TASK ELEMENT @VA03349 00124500 SPACE 00125000 LA R12,0(R15) REG.12 = BASE REGISTER FOR ASYN ROUTINE 00126000 USING DMTASY,R12 DEFINE DMTASY ADDRESSABILITY 00127000 SPACE 00128000 XC TGREG15(4),TGREG15 SET RETURN CODE TO ZERO FOR NOW 00129000 LR R2,R1 SAVE EXIT ADDR IN R2 @VA03349 00130000 L R6,ACTIVE GET ACTIVE TASK ELEMENT @VA03349 00130400 LTR R0,R0 TASK ALERT SET REQUEST? @VA03349 00130800 BNZ EXTIO NOPE, EXT OR I/O, BR. @VA03349 00131200 LA R4,ALERTQ SET UP FOR ALERT CHAIN @VA03349 00131600 IC R0,TASKID USE TASKID FOR CODE ON ALERTS @VA03349 00132000 B SCAN01 AND PROCEED WITH THE SCAN @VA03349 00132400 SPACE 00132800 EXTIO LA R4,IOEXITQ ASSUME I/O EXIT REQUEST @VA03349 00133200 OC TGREG0(2),TGREG0 IS IT FOR I/O? @VA03349 00133600 BZ SCAN01 YES, BR @VA03349 00134000 SRL R0,16 SHIFT EXT CODE TO LOW ORDER BYTES@VA03349 00134400 LA R4,EXTQ GET THE EXTERNAL QUEUE ANCHOR @VA03349 00134800 SPACE 00135200 SCAN01 LTR R1,R1 SET OR TERMINATE REQUEST? @VA03349 00135600 BZ ASYTERM TERMINATE, GO PROCESS @VA03349 00136000 GETNEXT BAL R5,SCANQ GO SCAN FOR R0 INT CODE TYPE @VA03349 00136400 BNZ NONEFND CODE NOT FOUND ON CHAIN @VA03349 00136800 USING ASYNE,R4 @VA03349 00137200 OC TGREG0(2),TGREG0 IS THIS AN EXT REQUEST? @VA03349 00137600 BZ ASREJECT SETTING SECOND NON-EXT IS A NONO @VA03349 00138000 CLC TASKID(1),ASYNID EXT, SAME TASK SETTING 2ND ? @VA03349 00138400 BE ASREJECT YES, THATS ALSO A NONO @VA03349 00138800 B GETNEXT GO LOOK THROUGH ALL ELEMENTS @VA03349 00139200 SPACE 00139600 NONEFND OC TGREG0(2),TGREG0 IS THIS AN EXT SET REQUEST? @VA03349 00140000 BNZ SETEXT YES, BR @VA03349 00140400 GETELEM BAL R5,ASYBLD GO GET AN ELEMENT @VA03349 00140800 ST R1,ASYNNEXT-ASYNE(R3) CHAIN IN NEW ELEMENT @VA03349 00141200 SPACE 00141600 ASEXIT L R15,DISPATCH GOTO DISPATCHER @VA03349 00142000 BALR R14,R15 ... @VA03349 00142400 EJECT 00142800 SETEXT CH R0,=X'1004' REQUESTING CLOCK COMP INT? @VA03349 00143200 BNE NOSUCH NOPE-DON'T KNOW WHAT YOU'RE DOING@VA03349 00143600 LA R4,EXTQ BEGINNING OF QUEUE AGAIN @VA03349 00144000 SLR R7,R7 CLEAR EXT COUNT @VA03349 00144400 BAL R5,ASYBLD GO GET AND INITIALIZE AN ELEM @VA03349 00144800 NXTREQ LR R3,R4 SAVE PREVIOUS POINTER @VA03349 00145200 ICM R4,B'1111',ASYNNEXT GET NEXT ENTRY @VA03349 00145600 BZ CHKFLAG END OF CHAIN, GO SEE WHERE WE ARE@VA03349 00146000 CH R0,ASYNCODE STILL LOOKIN AT CLOCK COMPS? @VA03349 00146400 BNE CHKFLAG NOPE, MUST BE AT END OF CCOMPS @VA03349 00146800 LA R7,1(R7) BUMP CLOCK COMP COUNT @VA03349 00147200 BAL R5,SCANLINK GO GET THE LINKTABL ENTRY @VA03349 00147600 USING LINKTABL,R9 @VA03349 00148000 CLC TGREG2(8),LNKCLOCK IS NEW VALUE < THIS ONE? @VA03349 00148400 BNL NXTREQ NOPE, NOT RIGHT PLACE YET. @VA03349 00148800 CL R7,F1 IS THIS THE ACTIVE CLOCK ASYNE @VA03349 00149200 BNE TSTAMP NOPE, THEN CHAIN IN FRONT OF IT. @VA03349 00149600 SETCLOCK SCKC TGREG2 SET THE NEW CLOCK COMP VALUE @VA03349 00150000 TSTAMP ST R1,ASYNNEXT-ASYNE(R3) CHAIN PREV TO NEW... @VA03349 00150400 ST R4,ASYNNEXT-ASYNE(R1) AND NEW TO NEXT @VA03349 00150800 LR R4,R1 SET ASYNE = NEW ONE @VA03349 00151200 BAL R5,SCANLINK GO GET THE CALLERS LINKTABLE @VA03349 00151600 MVC LNKCLOCK(8),TGREG2 STAMP THE LINKTABL @VA03349 00152000 B ASEXIT DONE. @VA03349 00152400 SPACE 00152800 CHKFLAG LTR R7,R7 IS THE CLOCK RUNNING NOW? @VA03349 00153200 BNZ TSTAMP YES, CHAIN THIS ENTRY ON END. @VA03349 00153600 B SETCLOCK NO, THEN MAKE IT RUNNING. @VA03349 00154000 EJECT 00154400 ASYTERM SLR R7,R7 CLEAR CLOCK COMP COUNT @VA03349 00154800 FINDNEXT BAL R5,SCANQ GO SCAN THE QUEUE FOR SAME CODE @VA03349 00155200 BNZ ASNOFIND NOT THERE, CANT TERMINATE THEN. @VA03349 00155600 LA R7,1(R7) UP CLOCK COMP COUNT @VA03349 00156000 CLC TASKID(1),ASYNID DID WE FIND THE RIGHT REQUEST @VA03349 00156400 BNE FINDNEXT NOPE, KEEP LOOKING @VA03349 00156800 OC TGREG0(2),TGREG0 EXT TERMINATION REQUEST? @VA03349 00157200 BZ UNCHAIN NOPE, I/O OR ASY SIG, GO UNCHAIN @VA03349 00157600 CLC ASYNCODE(2),=X'1004' CLOCK COMP? @VA03349 00158000 BNE NOSUCH NOPE, DONT KNOW WHAT YOURE DOING @VA03349 00158400 BAL R5,SCANLINK GO GET THIS GUYS LINKTABL @VA03349 00158800 MVC LNKCLOCK(8),FFS CLEAR THE CLOCK VALUE @VA03349 00159200 CL R7,F1 IS THIS THE ACTIVE (FIRST) ASYNE @VA03349 00159600 BNE UNCHAIN NOPE, JUST DEQUEUE AND RETURN. @VA03349 00160000 LR R1,R4 SAVE OLD ELEM ADDR FOR RETURN @VA03349 00160400 L R4,ASYNNEXT GET POINTER TO NEXT @VA03349 00160800 ST R4,ASYNNEXT-ASYNE(R3) AND PUT IN PREVIOUS @VA03349 00161200 LTR R4,R4 IS THERE A NEXT ELEM? @VA03349 00161600 BZ STAMPHI NO, USE A HIGH VALUE @VA03349 00162000 CLC ASYNCODE(2),=X'1004' IS IT CLOCK COMP @VA03349 00162400 BNE STAMPHI NOPE, NOMORE CLOCK COMP REQUESTS @VA03349 00162800 BAL R5,SCANLINK GO GET THIS GUYS LINKTABL @VA03349 00163200 SCKC LNKCLOCK MAKE THIS THE ACTIVE CLOCK COMP @VA03349 00163600 B RETELEM NOW GO RETURN THE DEQUED ELEM @VA03349 00164000 SPACE 00164400 UNCHAIN LR R1,R4 SAVE ELEM TO RETURN @VA03349 00164800 L R4,ASYNNEXT GET PTR TO NEXT @VA03349 00165200 ST R4,ASYNNEXT-ASYNE(R3) AND PUT IN PREVIOUS @VA03349 00165600 B RETELEM NOW RETURN THE ELEMENT @VA03349 00166000 SPACE 00166400 STAMPHI SCKC FFS SET A HIGH CLOCK COMP VALUE @VA03349 00166800 RETELEM L R15,QREQ RETURN THE DEQUEUED ELEMENT @VA03349 00167200 BALR R14,R15 ... @VA03349 00167600 B ASEXIT DONE @VA03349 00168000 EJECT 00168400 SCANLINK L R8,ASYNTASK GET TASK ELEMENT ADDRESS @VA03349 00168800 L R8,TASKNAME-TASKE(R8) GET TASK NAME @VA03349 00169200 L R9,TLINKS GET LINKTABLE ANCHOR @VA03349 00169600 L R10,0(R9) GET NUMBER OF ENTRIES @VA03349 00170000 LA R9,8(R9) BUMP TO FIRST ENTRY @VA03349 00170400 CHKNEXT TM LFLAG,LACTIVE IS THIS TASK ACTIVE? @VA03349 00170800 BZ BUMPNEXT NOPE, THEN SKIP IT. @VA03349 00171200 CL R8,LACTTNME SAME TASK NAME? @VA03349 00171600 BER R5 YES, LINKTABL ENTRY FOUND, RETURN@VA03349 00172000 BUMPNEXT LA R9,LINKLEN(R9) BUMP TO NEXT ENTRY @VA03349 00172400 BCT R10,CHKNEXT AND KEEP LOOKING @VA03349 00172800 DC H'0' THATS THE END OF THE ROAD. @VA03349 00173200 EJECT 00173600 SCANQ LR R3,R4 SAVE PREV POINTER @VA03349 00174000 ICM R4,B'1111',ASYNNEXT GET NEXT ELEM IN Q @VA03349 00174400 BZ SETCC1 END OF CHAIN, NOT FOUND, RET CC1 @VA03349 00174800 CH R0,ASYNCODE ARE THE INT CODES THE SAME? @VA03349 00175200 BER R5 YES, ALL SET, RETURN CC0 @VA03349 00175600 B SCANQ AND GO BACK FOR MORE @VA03349 00176000 SPACE 00176400 SETCC1 TM *,X'FF' SET CC=1 @VA03349 00176800 BR R5 AND RETURN @VA03349 00177200 DROP R4 NO MORE ASYNE @VA03349 00177600 SPACE 3 00178000 USING ASYNE,R1 @VA03349 00178400 ASYBLD SLR R1,R1 CLEAR FOR CALL @VA03349 00178800 L R15,QREQ CALL QRQ FOR AN ELEMENT @VA03349 00179200 BALR R14,R15 ... @VA03349 00179600 LTR R15,R15 DID WE GET IT? @VA03349 00180000 BNZ QELEMERR NOPE, TERMINATE WITH QUEUE ERROR @VA03349 00180400 XC ASYNE(ASYNLEN),ASYNE CLEAR THE BLOCK @VA03349 00180800 STCM R6,B'0111',ASYNTASK+1 SAVE ACTIVE TASK TASKE @VA03349 00181200 ST R2,ASYNEXIT SET EXIT ADDRESS @VA03349 00181600 STH R0,ASYNCODE SET EXIT REQUEST CODE @VA03349 00182000 MVC ASYNID(1),TASKID SET ACTIVE TASKID IN ELEM @VA03349 00182400 BR R5 @VA03349 00182800 DROP R1 @VA03349 00183200 SPACE 3 00183600 EJECT 00188000 ASNOFIND EQU * 00189000 LA R15,4 SET ERROR CODE 4 FOR ELEMENT NOT FOUND 00190000 B ASEREXIT AND GO EXIT 00191000 SPACE 00192000 ASREJECT EQU * 00193000 LA R15,8 SET ERROR CODE 8 FOR EXIT ALREADY CLAIMED 00194000 B ASEREXIT AND EXIT @VA03349 00195000 SPACE 00195500 NOSUCH LA R15,12 ATTEMPTING TO SET ILLEGAL CODE @VA03349 00196000 B ASEREXIT @VA03349 00196500 SPACE 00197000 QELEMERR LA R15,16 ERROR GETTING A QUEUE ELEM @VA03349 00197500 SPACE 00198000 ASEREXIT EQU * 00199000 ST R15,TGREG15 STORE CODE IN CALLER'S REG.15 SAVE AREA 00200000 B ASEXIT AND RETURN THROUGH THE DISPATCHER 00201000 DS 0D @VA03349 00201100 FFS DC 8X'FF' @VA03349 00201200 F1 DC F'1' @VA03349 00201300 EJECT 00202000 COPY RSSEQU 00203000 COPY SVECTORS 00205000 COPY TAREA 00207000 COPY ASYNE 00209000 ASYNLEN EQU *-ASYNNEXT @VA03349 00209100 COPY LINKTABL @VA03349 00210000 COPY TASKE 00211000 END 00212000