GIV TITLE 'DMTGIV (RSCS) VM/370 - RELEASE 6' 00001000
*. 00002000
* MODULE NAME - 00003000
* 00004000
* DMTGIV 00005000
* 00006000
* FUNCTION - 00007000
* 00008000
* DMTGIV IS A SUPERVISOR SERVICE ROUTINE WHICH ENQUEUES 00009000
* GIVE REQUESTS FROM TASKS TO BE DELIVERED TO OTHER 00010000
* TASKS BY DMTAKE. 00011000
* 00012000
* ATTRIBUTES - 00013000
* 00014000
* REUSABLE, NON-INTERRUPTABLE 00015000
* 00016000
* ENTRY POINTS - 00017000
* 00018000
* DMTGIV - ENQUEUE A GIVE REQUEST 00019000
* 00020000
* ENTRY CONDITIONS - 00021000
* 00022000
* GPR1 = GIVE TABLE ADDRESS IN TASK STORAGE 00023000
* GPR14 = RETURN ADDRESS 00024000
* GPR15 = ENTRY ADDRESS 00025000
* 00026000
* EXIT CONDITIONS - 00027000
* 00028000
* NORMAL - 00029000
* 00030000
* GPR15 = X'00' REQUEST SUCCESSFULLY ENQUEUED 00031000
* (BUT NOT NECESSARILY DELIVERED) 00032000
* 00033000
* ERROR - 00034000
* 00035000
* GPR15 = > X'00' ERROR CODE ON RETURN FROM DMTQRQ 00036000
* 00037000
EJECT 00038000
* 00039000
* CALLS TO OTHER ROUTINES - 00040000
* 00041000
* DMTQRQ - TO RESERVE AND RELEASE SUP QUEUE ELEMENTS 00042000
* DMTPST - TO NOTIFY A TASK OF REQUEST AVAILABILITY 00043000
* 00044000
* EXTERNAL REFERENCES - 00045000
* 00046000
* NONE 00047000
* 00048000
* TABLES / WORKAREAS - 00049000
* 00050000
* DMTVEC - SUPERVISOR COMMON AREA 00051000
* TASK ELEMENT 00052000
* GIVE ELEMENT 00053000
* 00054000
* REGISTER USAGE - 00055000
* 00056000
* GPR0 = CALLING PARAMETER (POST CODE TO DMTPST) 00057000
* GPR1 = CALLING PARAMETER (TO DMTQRQ AND DMTPST) 00058000
* GPR2 = SCRATCH 00059000
* GPR3 = TASK ELEMENT POINTER, TASK SAVE AREA POINTER 00060000
* GPR4 = GIVE ELEMENT POINTER 00061000
* GPR5 = UNUSED 00062000
* GPR6 = UNUSED 00063000
* GPR7 = UNUSED 00064000
* GPR8 = UNUSED 00065000
* GPR9 = UNUSED 00066000
* GPR10 = UNUSED 00067000
* GPR11 = UNUSED 00068000
* GPR12 = DMTGIV BASE REGISTER 00069000
* GPR13 = TASK SAVE AREA POINTER 00070000
* GPR14 = LINKAGE RETURN ADDRESS 00071000
* GPR15 = LINKAGE ENTRY ADDRESS 00072000
* 00073000
* NOTES - 00074000
* 00075000
* REFER TO MODULE DMTAKE FOR A MORE COMPLETE UNDERSTANDING 00076000
* OF THE FUNCTION OF THIS ROUTINE. 00077000
* 00078000
* OPERATION - 00079000
* 00080000
* 00081000
* DMTGIV BEGINS PROCESSING BY SUSPENDING CALLING 00082000
* TASK EXECUTION THROUGH THE FREEZE SVC FUNCTION. A 00083000
* SUPERVISOR STATUS QUEUE ELEMENT IS GOTTEN THROUGH 00084000
* A CALL TO DMTQRQ, A GIVE REQUEST ELEMENT IS 00085000
* BUILT USING THE INFORMATION SUPPLIED BY THE 00086000
* CALLING TASK, AND THE ELEMENT IS ENQUEUED ON THE 00087000
* GIVE REQUEST QUEUE. THE ADDRESSED TASK IS LOCATED, 00088000
* AND IF ITS REQUEST ARRIVAL SYNCH LOCK IS NOT 00089000
* ALREADY POSTED, IT IS POSTED BY DMTGIV. CONTROL 00090000
* IS RETURNED TO THE DISPATCHER. 00091000
* 00092000
* 00093000
*. 00094000
EJECT 00095000
DMTGIV CSECT 00096000
SPACE 00097000
* ENTRY POINT FOR CALL TO DMTGIV ROUTINE 00098000
SPACE 00099000
FREEZE SAVE RESUME PSW AND GREGS FOR DISPATCH LATER 00100000
SPACE 00101000
LR R13,R14 REG.13 = SAVE AREA ADDRESS FOR DMTGIV 00102000
USING TAREA,R13 DEFINE ADDRESSABILITY FOR CALLER'S S 00103000
USING SVECTORS,0 GET SVECTORS ADDRESSABILTIY 00104000
USING GIVEE,R4 GET GIVE ELEMENT ADDRESSABILTIY 00105000
SPACE 00106000
LA R12,0(R15) REG.12 = ENTRY ADDRESS FOR DMTGIV 00107000
USING DMTGIV,R12 USE ENTRY ADDRESS AS BASE 00108000
SPACE 00109000
LA R3,GIVEQ-(GIVENEXT-GIVEE) INITIALIZE QUEUE SCAN POINTER 00110000
GIVESCAN EQU * 00111000
LR R4,R3 REG.4 = ADDR OF LAST LINK FIELD SCANNED 00112000
ICM R3,B'1111',GIVENEXT REG 3 = ADDRESS OF NEXT GIVE ELEMENT 00113000
BNZ GIVESCAN NOPE - KEEP LOOKING FOR THE LAST ELEMENT 00114000
SPACE 00115000
* LAST ELEMENT ADDRESS IN REG 4 -- ENQUEUE FIRST IN FIRST OUT 00116000
SPACE 00117000
LR R2,R1 SAVE ADDR OF GIVE TABLE IN REG.2 00118000
SR R1,R1 CLEAR REG.1 FOR GET CALL TO SUP QUEUE MANAGER 00119000
L R15,QREQ REG.15 = ENTRY ADDRESS FOR SUP QUEUE REQ 00120000
BALR R14,R15 GET A FREE SUP QUEUE ELEMENT FOR NEW GIVE REQ 00121000
LTR R15,R15 DID WE GET ONE O.K.? 00122000
BNZ GIVEXIT EXIT WITH SUP QUEUE MGR'S RETURN CODE IF NOT 00123000
ST R1,GIVENEXT CHAIN NEW ELEMENT TO END OF GIVE QUEUE 00124000
DROP R4 00125000
SPACE 00126000
USING GIVEE,R1 00127000
XC GIVENEXT(4),GIVENEXT CLEAR THE NEW ELEMENT LINK 00128000
ST R2,GIVEADDR SET ADDRESS OF REQUEST INTO ELEMENT 00129000
MVC GIVENAME(4),4(R2) GET RECEIVER'S NAME FROM REQUEST 00130000
MVI GIVENID,X'00' CLEAR TAKER'S ID FIELD UNTIL TAKEN 00131000
L R4,ACTIVE GET THE ACTIVE TASK ELEMENT 00132000
MVC GIVERID(1),TASKID-TASKE(R4) MOVE SENDING TASK ID INTO EL 00133000
ST R1,4(R2) SET NEW ELEMENT ADDRESS IN CALLER'S GIVE TABLE 00134000
EJECT 00135000
LA R3,TASKQ-(TASKNEXT-TASKE) INITIALIZE TASK QUEUE SCAN REG 00136000
USING TASKE,R3 GET TASK ELEMENT ADDRESSABILITY 00137000
GIVESNIF EQU * 00138000
ICM R3,B'1111',TASKNEXT REG 3 = NEXT TASK TABLE IN QUEUE 00139000
BZ GIVEDONE YEP - RECEIVING TASK NOT ACTIVE (YET?) 00140000
CLC GIVENAME(4),TASKNAME IS THIS THE ADDRESSED TASK? 00141000
BNE GIVESNIF KEEP SCANNING IF IT ISN'T 00142000
SPACE 00143000
DROP R3 00144000
DROP R13 STOP USING CALLER'S TASK AREA 00145000
USING TAREA,R3 AND START USING ADDRESSEE'S 00146000
SPACE 00147000
L R3,TASKSAVE-TASKE(R3) REG 3 = ADDRESS OF ADDRESSED TAS 00148000
CLI TREQLOCK,X'00' IS HIS GIVE REQ SYNLOCK POSTED ALREADY? 00149000
BNE GIVEDONE NO NEED TO POST IT AGAIN IF SO 00150000
SR R0,R0 CLEAR REG.0 POST CODE FOR CALL TO POST 00151000
LA R1,TREQLOCK REG.1 = ADDRESS OF TASK'S GIVE REQ SYNLOCK 00152000
L R15,POSTREQ REG.15 = ADDR OF ENTRY TO POST ROUTINE 00153000
BALR R14,R15 POST RECEIVING TASK'S SYNCH LOCK 00154000
SPACE 00155000
DROP R3 STOP USING ADDRESSEE'S TASK SAVE AREA DSECT 00156000
USING TAREA,R13 AND RESUME USING CALLER'S TASK AREA 00157000
SPACE 00158000
GIVEDONE EQU * 00159000
SR R15,R15 CLEAR RETURN CODE FOR RETURN 00160000
SPACE 00161000
GIVEXIT EQU * 00162000
ST R15,TGREG15 SET RETURN CODE IN CALLER'S TASK SAVE AREA 00163000
L R15,DISPATCH REG.15 = DISPATCHER ENTRY ADDRESS 00164000
BALR R14,R15 GO BACK TO DISPATCHING TASKS 00165000
EJECT 00166000
COPY RSSEQU 00167000
EJECT 00168000
COPY SVECTORS 00169000
EJECT 00170000
COPY TAREA 00171000
EJECT 00172000
COPY TASKE 00173000
EJECT 00174000
COPY GIVEE 00175000
END 00176000