WAT TITLE 'DMTWAT (RSCS) VM/370 - RELEASE 6' 00001000 *. 00002000 * MODULE NAME - 00003000 * 00004000 * DMTWAT 00005000 * 00006000 * FUNCTION - 00007000 * 00008000 * THE DMTWAT MODULE IS A TASK SERVICE ROUTINE WHICH 00009000 * IS CALLED DIRECTLY FROM TASK PROGRAMS BY MEANS OF 00010000 * BRANCH AND LINK. DMTWAT PROVIDES EVENT 00011000 * SYNCHRONIZATION BY MEANS OF SUSPENDING A TASK'S 00012000 * EXECUTION UNTIL SOME SPECIFIED EVENT IS SIGNALLED 00013000 * COMPLETE BY ANOTHER PROCESS IN THE SYSTEM. 00014000 * 00015000 * ATTRIBUTES - 00016000 * 00017000 * REUSABLE, NON-INTERRUPTABLE 00018000 * 00019000 * ENTRY POINTS - 00020000 * 00021000 * DMTWAT - SUSPEND DISPATCHING UNTIL COMPLETION IS 00022000 * SIGNALLED 00023000 * 00024000 * ENTRY CONDITIONS - 00025000 * 00026000 * GPR1 = ADDR OF A SYNCH LOCK IF THE FULLWORD CONTENTS 00027000 * ADDRESSED = F'0' 00028000 * ADDR OF A LIST OF SYNCH LOCKS OTHERWISE 00029000 * GPR14 = RETURN ADDRESS 00030000 * GPR15 = ENTRY ADDRESS 00031000 * 00032000 * EXIT CONDITIONS - 00033000 * 00034000 * NORMAL - 00035000 * 00036000 * TO THE DISPATCHER WHEN PROCESSING IS COMPLETE 00037000 * 00038000 * ERROR - 00039000 * 00040000 * NONE 00041000 * 00042000 EJECT 00043000 * 00044000 * CALLS TO OTHER ROUTINES - 00045000 * 00046000 * NONE 00047000 * 00048000 * EXTERNAL REFERENCES - 00049000 * 00050000 * NONE 00051000 * 00052000 * TABLES / WORKAREAS - 00053000 * 00054000 * DMTVEC - SUPERVISOR COMMON AREA 00055000 * 00056000 * REGISTER USAGE - 00057000 * 00058000 * GPR0 = UNUSED 00059000 * GPR1 = SYNCH LOCK POINTER, OR LOCK LIST POINTER 00060000 * GPR2 = SCRATCH 00061000 * GPR3 = SCRATCH 00062000 * GPR4 = SCRATCH 00063000 * GPR5 = TASK ELEMENT POINTER 00064000 * GPR6 = SCRATCH 00065000 * GPR7 = UNUSED 00066000 * GPR8 = UNUSED 00067000 * GPR9 = UNUSED 00068000 * GPR10 = UNUSED 00069000 * GPR11 = UNUSED 00070000 * GPR12 = UNUSED 00071000 * GPR13 = UNUSED 00072000 * GPR14 = UNUSED 00073000 * GPR15 = ENTRY ADDRESS, BASE REGISTER 00074000 * 00075000 * NOTES - 00076000 * 00077000 * NONE 00078000 * 00079000 * OPERATION - 00080000 * 00081000 * DMTWAT BEGINS BY SUSPENDING THE CALLING TASK'S 00082000 * EXECUTION THROUGH THE FREEZE SVC. IF A SINGLE 00083000 * SYNCH LOCK IS SPECIFIED IN THE CALL, IT IS 00084000 * INSPECTED TO SEE IF IT HAS ALREADY BEEN POSTED. 00085000 * IF THE SPECIFIED SYNCH LOCK IS POSTED, CONTROL IS 00086000 * IMMEDIATELY PASSED TO DMTDSP, THE MSUP DISPATCHER. 00087000 * IF THE SYNCH LOCK IS NOT POSTED, THE "WAITING" BIT 00088000 * IS SET IN THE CALLING TASK'S TASK ELEMENT, THE 00089000 * ADDRESS OF THE TASK ELEMENT IS SET IN THE SYNCH 00090000 * LOCK, AND CONTROL IS PASSED TO THE DISPATCHER. 00091000 * 00092000 * IF A LIST OF SYNCH LOCKS IS SPECIFIED IN THE CALL, 00093000 * EACH SYNCH LOCK IN THE LIST WHICH IS NOT FLAGGED 00094000 * TO BE SKIPPED IS INSPECTED TO SEE IF IT HAS 00095000 * ALREADY BEEN POSTED. IF AT LEAST ONE HAS BEEN 00096000 * POSTED, CONTROL IS IMMEDIATELY PASSED TO THE MSUP 00097000 * DISPATCHER. IF NO SYNCH LOCK IN THE LIST IS 00098000 * POSTED, THE "WAITING" AND "LOCKLIST" BITS IN THE 00099000 * CALLING TASK'S TASK ELEMENT ARE SET TO ONE, THE 00100000 * ADDRESS OF THE CALLING TASK ELEMENT IS SET INTO 00101000 * EACH SYNCH LOCK IN THE LIST WHICH IS NOT FLAGGED 00102000 * TO BE SKIPPED, AND CONTROL IS PASSED TO THE 00103000 * DISPATCHER. 00104000 * 00105000 *. 00106000 EJECT 00107000 DMTWAT CSECT 00108000 SPACE 00109000 * ENTRY POINT FOR CALL TO DMTWAT ROUTINE 00110000 SPACE 00111000 FREEZE SET REG.14 = ADDR OF TASK SAVE AREA AND SAVE STATE 00112000 SPACE 00113000 USING DMTWAT,R15 USE ENTRY REGISTER FOR ADDRESSING 00114000 USING SVECTORS,0 GET SVECTORS ADDRESSABILTIY 00115000 USING TASKE,R5 GET TASK ELEMENT ADDRESSABILTIY 00116000 SPACE 00117000 L R2,0(R1) REG 2 = CONTENTS OF SYNLOCK; OR FIRST LIST ENTR 00118000 LR R3,R1 SAVE REG.1 IN CASE OF WAITABLE LIST CALL 00119000 LR R4,R2 SAVE REG.2 FOR SAME REASON 00120000 L R5,ACTIVE REG.5 = ADDRESS OF CALLER'S TASK ELEMENT 00121000 LA R5,0(R5) SET TOP BYTE (ID CODE) TO ZERO 00122000 LA R6,0(R2) CLEAR TOP BYTE IN CASE IT IS A POSTED SYNLOCK 00123000 LTR R6,R6 IS THIS THE FIRST ENTRY OF A LIST? 00124000 BNZ WAITLIST ALL SYNLOCKS MUST CONTAIN 0 IN BYTES 1->3 00125000 CLI 0(R1),X'00' IT IS A SYNLOCK - IS IT ALREADY POSTED? 00126000 BNE WAITGO YEP - LEAVE IT ALONE AND GO TO THE DISPATCHER 00127000 ST R5,0(R1) OTHERWISE SET TASK ELEMENT ADDRESS IN SYNLOCK 00128000 B WAITSTOP SET TASK WAITING AND EXIT TO DISPATCHER 00129000 SPACE 00130000 WAITLIST EQU * 00131000 TM 0(R1),X'40' IS THIS ENTRY FLAGGED TO BE SKIPPED? 00132000 BO WAITPASS YES - CHECK IT FOR TERMINATION BIT IMMEDIATELY 00133000 CLI 0(R2),X'00' IS THIS SYNLOCK ALREADY POSTED? 00134000 BNE WAITGO YEP - DON'T TOUCH THE SYNLOCKS AND DISPATCH 00135000 WAITPASS EQU * 00136000 LTR R2,R2 WAS THAT THE LAST LIST ENTRY? 00137000 BM WAITSET YES - NOTHING POSTED, SO SET UP TO WAIT 00138000 LA R1,4(R1) OTHERWISE REG.1 = ADDR OF NEXT LIST ENTRY 00139000 L R2,0(R1) REG.2 = CONTENTS OF NEXT LIST ENTRY 00140000 B WAITLIST CHECK THIS SYNLOCK ENTRY FOR EARLY POST 00141000 SPACE 00142000 WAITSET EQU * 00143000 OI TASKSTAT,LOCKLIST FLAG DISPATCHER TO CLEAR SYN LOCKS 00144000 WAITNEXT EQU * 00145000 TM 0(R3),X'40' IS THE SKIP BIT SET IN THIS LIST ENTRY? 00146000 BO WAITSKIP YEP - DON'T MESS WITH THE SYNLOCK 00147000 ST R5,0(R4) SET TASK ELEMENT ADDRESS IN THIS SYNLOCK 00148000 WAITSKIP EQU * 00149000 LTR R4,R4 WAS THAT THE LAST LIST ENTRY? 00150000 BM WAITSTOP SET TASK WAITING AND DISPATCH IF IT WAS 00151000 LA R3,4(R3) REG.3 = ADDRESS OF THE NEXT LIST ENTRY 00152000 L R4,0(R3) REG.4 = ADDRESS OF THE NEXT SYNLOCK 00153000 B WAITNEXT SET THIS ONE TO WAIT AND CONTINUE SCAN 00154000 SPACE 00155000 WAITSTOP EQU * 00156000 OI TASKSTAT,WAITING SET TASK NON-DISPATCHABLE 00157000 SPACE 00158000 WAITGO EQU * 00159000 L R15,DISPATCH REG.15 = ENTRY ADDRESS OF DISPATCHER 00160000 BALR R14,R15 ENTER THE DISPATCHER FOR NEXT LAP 00161000 EJECT 00162000 COPY SVECTORS 00163000 EJECT 00164000 COPY TAREA 00165000 EJECT 00166000 COPY TASKE 00167000 EJECT 00168000 COPY RSSEQU 00169000 END 00170000