AKE TITLE 'DMTAKE (RSCS) VM/370 - RELEASE 6' 00001000
*. 00002000
* MODULE NAME - 00003000
* 00004000
* DMTAKE 00005000
* 00006000
* FUNCTION - 00007000
* 00008000
* THE DMTAKE MODULE CONTAINS THE SUPR SERVICE WHICH 00009000
* SUPPLIES TASK PROGRAMS WITH THE RECEIVER INTERFACE 00010000
* TO GIVE REQUESTS ISSUED BY OTHER TASKS. A SINGLE 00011000
* CALL TO DMTAKE FIRST RESPONDS TO THE PREVIOUSLY 00012000
* SUPPLIED GIVE REQUEST, AND THEN SUPPLIES A NEW 00013000
* GIVE REQUEST TO THE TASK FOR ITS PROCESSING. 00014000
* 00015000
* ATTRIBUTES - 00016000
* 00017000
* REUSABLE, NON-INTERRUPTABLE 00018000
* 00019000
* ENTRY POINTS - 00020000
* 00021000
* DMTAKE - RESPOND TO LAST REQ, ACCEPT ANOTHER 00022000
* 00023000
* ENTRY CONDITIONS - 00024000
* 00025000
* GPR0 = POST CODE FOR RESPONSE TO PREVIOUS REQUEST 00026000
* GPR1 = ADDRESS OF CALLER'S TAKE TABLE 00027000
* GPR14 = RETURN ADDRESS 00028000
* GPR15 = ENTRY ADDRESS 00029000
* 00030000
* EXIT CONDITIONS - 00031000
* 00032000
* NORMAL - 00033000
* 00034000
* GPR15 = X'00' RESPONSE PERFORMED, NEW REQUEST 00035000
* SUPPLIED 00036000
* 00037000
* ERROR - 00038000
* 00039000
* GPR15 = X'04' IF REQ SUPPLIED AND NO RESP PENDING 00040000
* X'08' IF RESP DONE AND NO REQ PENDING 00041000
* X'0C' IF NEITHER REQ NOR RESP PENDING 00042000
* 00043000
EJECT 00044000
* 00045000
* CALLS TO OTHER ROUTINES - 00046000
* 00047000
* DMTQRQ - TO RESERVE AND RELEASE SUP QUEUE ELEMENTS 00048000
* DMTPST - TO POST RESPONSE COMPLETION 00049000
* 00050000
* EXTERNAL REFERENCES - 00051000
* 00052000
* NONE 00053000
* 00054000
* TABLES / WORKAREAS - 00055000
* 00056000
* DMTVEC - SUPERVISOR COMMON AREA 00057000
* TASK ELEMENT 00058000
* GIVE ELEMENT 00059000
* 00060000
* REGISTER USAGE - 00061000
* 00062000
* GPR0 = RESPONSE POST CODE REGISTER 00063000
* GPR1 = CALLING PARAMETER REGISTER 00064000
* GPR2 = GIVE REQUEST ELEMENT POINTER 00065000
* GPR3 = GIVE REQUEST ELEMENT POINTER 00066000
* GPR4 = TASK ELEMENT POINTER 00067000
* GPR5 = SCRATCH 00068000
* GPR6 = SCRATCH 00069000
* GPR7 = UNUSED 00070000
* GPR8 = UNUSED 00071000
* GPR9 = UNUSED 00072000
* GPR10 = UNUSED 00073000
* GPR11 = TASK ELEMENT POINTER 00074000
* GPR12 = DMTAKE BASE REGISTER 00075000
* GPR13 = TASK SAVE AREA POINTER 00076000
* GPR14 = LINKAGE RETURN REGISTER 00077000
* GPR15 = LINKAGE ENTRY REGISTER 00078000
* 00079000
* NOTES - 00080000
* 00081000
* THE FUNCTIONAL DESIGN OF THIS MODULE IS FAIRLY ELABORATE, 00082000
* PARTIALLY AS A RESULT OF THE NEED TO INSURE INTEGRITY 00083000
* OF THE SYSTEM WHEN A TASK TERMINATES ABRUPTLY, AND 00084000
* AND PARTIALLY AS THE RESULT OF EXPERIENCE WITH A SIMPLER 00085000
* AND MORE GENERAL SIMILAR FACILITY. 00086000
* 00087000
* OPERATION - 00088000
* 00089000
* DMTAKE BEGINS PROCESSING BY SUSPENDING THE 00090000
* CALLING TASK'S EXECUTION BY THE FREEZE SVC 00091000
* FUNCTION. THE GIVE REQUEST QUEUE IS SCANNED FOR AN 00092000
* ELEMENT REFLECTING A PENDING RESPONSE TO A 00093000
* PREVIOUSLY RECEIVED GIVE REQUEST. IF SUCH AN 00094000
* ELEMENT IS FOUND, THE RESPONSE BUFFER SUPPLIED BY 00095000
* THE CALLER IS MOVED TO THE SENDER'S RESPONSE 00096000
* BUFFER, AND THE SENDER'S GIVE TABLE IS POSTED WITH 00097000
* THE CODE SUPPLIED BY THE RESPONDING TASK. THE GIVE 00098000
* REQUEST QUEUE IS THEN SCANNED AGAIN FOR AN ELEMENT 00099000
* REFLECTING A PREVIOUSLY UNACCEPTED GIVE REQUEST 00100000
* ADDRESSED TO THE CALLING TASK. IF SUCH AN ELEMENT 00101000
* IS FOUND, THE REQUEST BUFFER SUPPLIED BY THE TASK 00102000
* ISSUING THE GIVE REQUEST IS MOVED TO THE DMTAKE 00103000
* CALLER'S REQUEST BUFFER. THE RETURN CODE IS SET 00104000
* ACCORDING TO THE CONDITIONS WHICH OCCURED DURING 00105000
* THE DMTAKE REQUEST PROCESSING, AND CONTROL IS 00106000
* RETURNED TO THE DISPATCHER. 00107000
* 00108000
* 00109000
*. 00110000
EJECT 00111000
DMTAKE CSECT 00112000
SPACE 00113000
* ENTRY POINT FOR CALL TO DMTAKE ROUTINE 00114000
SPACE 00115000
FREEZE SAVE RESUME PSW AND GREGS FOR DISPATCH LATER 00116000
SPACE 00117000
LR R13,R14 REG.13 = CALLER'S TASK SAVE AREA ADDRESS 00118000
USING TAREA,R13 DEFINE ADDRESSABILITY FOR CALLER'S S 00119000
USING SVECTORS,0 GET SVECTORS ADDRESSABILITY 00120000
USING GIVEE,R2 GET GIVE ELEMENT ADDRESSABILITY 00121000
USING TASKE,R11 GET TASK ELEMENT ADDRESSABILITY 00122000
SPACE 00123000
LA R12,0(R15) REG.12 = ENTRY ADDRESS FOR DMTAKE 00124000
USING DMTAKE,R12 USE ENTRY ADDRESS AS BASE 00125000
SPACE 00126000
L R11,ACTIVE INITIALIZE TAKER'S TASK TABLE ADDRESS REGISTE 00127000
SPACE 00128000
LA R15,4 REG.15 = NO PENDING RESPONSE RETURN CODE 00129000
ST R15,TGREG15 ANTICIPATE THAT SITUATION FOR NOW 00130000
SPACE 00131000
LA R2,GIVEQ-(GIVENEXT-GIVEE) INITIALIZE GIVE QUEUE ELEMENT 00132000
TAKERESP EQU * 00133000
LR R3,R2 SAVE PREDECESSOR ADDRESS 00134000
ICM R2,B'1111',GIVENEXT-GIVEE(R3) REG 2 = ADDRESS OF NEXT GI 00135000
BZ TAKERQST NOPE - NO PENDING RESPONSE FOR CALLER 00136000
CLC GIVENID(1),TASKID-TASKE(R11) IS THIS THE CALLER'S PENDIN 00137000
BNE TAKERESP NOPE - KEEP LOOKING THROUGH THE QUEUE 00138000
SPACE 00139000
MVC GIVENEXT-GIVEE(4,R3),GIVENEXT UNCHAIN TO START 00140000
MVI TGREG15+3,X'00' AND CLEAR THE RETURN CODE 00141000
SPACE 00142000
L R3,GIVEADDR REG.3 = ADDR OF GIVER'S TABLE 00143000
L R4,8(R1) REG.4 = 'FROM' ADDRESS (TAKE RESPONSE BUFFER) 00144000
L R5,12(R3) REG.5 = 'TO' ADDRESS (GIVE RESPONSE BUFFER) 00145000
SR R6,R6 CLEAR CHARACTER COUNT REGISTER 00146000
IC R6,0(R4) REG.6 = RESPONSE MESSAGE CHARACTER COUNT 00147000
CLC 0(1,R4),12(R3) IS THERE ENOUGH ROOM FOR THE RESPONSE? 00148000
BNH TAKEOK1 YES - MOVE THE ENTIRE THING 00149000
IC R6,12(R3) OTHERWISE, TRUNCATE AT END OF RECEIVING BUFFER 00150000
TAKEOK1 EQU * 00151000
STC R6,0(R5) SET THE COUNT BYTE 00152000
LTR R6,R6 ANYTHING TO BE MOVED? 00153000
BZ TAKEMUTE NO - SKIP MOVER LOGIC 00154000
BCTR R6,0 REG.6 = CHAR COUNT FOR MOVE -1 00155000
EX R6,TAKEMOVE MOVE THE RESPONSE CHARACTER STRING 00156000
* B TAKEMUTE AT THE TOP OF THE NEXT PAGE 00157000
EJECT 00158000
TAKEMUTE EQU * 00159000
MVC 4(4,R3),TASKNAME RESTORE ADDRESSEE'S NAME IN TABLE 00160000
LR R1,R3 REG.1 = ADDRESS OF GIVER'S TABLE 00161000
L R15,POSTREQ REG.15 = ENTRY ADDRESS TO POST ROUTINE 00162000
BALR R14,R15 POST WITH CODE IN REG.0 AS SET BY CALLER 00163000
SPACE 00164000
LR R1,R2 REG.1 = ADDRESS OF OLD GIVE QUEUE ELEMENT 00165000
L R15,QREQ REG.15 = ENTRY ADDRESS TO SUP QUEUE MANAGER 00166000
BALR R14,R15 FREE THE OLD ELEMENT 00167000
O R15,TGREG15 REG.15 = COMPOSITE ERROR CODE SO FAR 00168000
ST R15,TGREG15 SET RETURN CODE FOR CALLER 00169000
L R1,TGREG1 RESTORE TAKE REQUEST TABLE ADDRESS 00170000
SPACE 00171000
TAKERQST EQU * 00172000
CLI 4(R1),X'00' IS THERE A NEW TAKE REQUEST? 00173000
BE TAKEXIT NOPE - RETURN TO CALLER IMMEDIATELY 00174000
SPACE 00175000
SR R2,R2 CLEAR QUEUE SCAN POINTER SAVE REGISTER 00176000
LA R3,GIVEQ-(GIVENEXT-GIVEE) INITIALIZE QUEUE SCAN REGISTER 00177000
DROP R2 00178000
USING GIVEE,R3 GET GIVE ELEMENT ADDRESSABILTIY 00179000
TAKESCAN EQU * 00180000
ICM R3,B'1111',GIVENEXT REG 3 = ADDR OF NEXT GIVE ELEMENT IN 00181000
BZ TAKEQEND YEP - GO SEE WHAT TO DO NEXT 00182000
CLI GIVENID,X'00' IS A RESPONSE PENDING ALREADY? 00183000
BNE TAKESCAN YES - KEEP LOOKING FOR A PENDING REQUEST 00184000
CLC GIVENAME(4),TASKNAME IS THIS ONE FOR THE CALLER? 00185000
BNE TAKESCAN NOPE - KEEP LOOKING DOWN THE QUEUE 00186000
LTR R2,R2 HAVE WE HIT ONE FOR THE CALLER ALREADY? 00187000
BNZ TAKEGIVE YEP - GO DELIVER IT WITHOUT CLEARING SYNLOCK 00188000
LR R2,R3 OTHERWISE SAVE THE ADDRESS OF THE ELEMENT 00189000
B TAKESCAN AND SEE IF THERE ARE ANY MORE LEFT 00190000
EJECT 00191000
TAKEQEND EQU * 00192000
XC TREQLOCK(4),TREQLOCK CLEAR SYNLOCK - NO MORE PENDING 00193000
LTR R2,R2 DID WE ACTUALLY FIND THE LAST ONE? 00194000
BZ TAKENOGO NOPE - RETURN WITH ERROR INDICATION 00195000
DROP R3 00196000
USING GIVEE,R2 GET GIVE ELEMENT ADDRESSABILITY 00197000
TAKEGIVE EQU * 00198000
MVC GIVENID(1),TASKID-TASKE(R11) SET RESPONSE PENDING FROM C 00199000
L R3,GIVEADDR REG.3 = ADDRESS OF GIVER'S TABLE 00200000
L R4,8(R3) REG.4 = 'FROM' ADDRESS (GIVE REQUEST BUFFER) 00201000
L R5,4(R1) REG.5 = 'TO' ADDRESS (TAKE REQUEST BUFFER) 00202000
SR R6,R6 CLEAR CHARACTER COUNT REGISTER 00203000
IC R6,0(R4) REG.6 = REQUEST MESSAGE CHARACTER COUNT 00204000
CLC 0(1,R4),4(R1) IS THERE ROOM ENOUGH TO FIT IT ALL IN? 00205000
BNH TAKEOK2 YES - DO SO 00206000
IC R6,4(R1) OTHERWISE, TRUNCATE AT END OF RECEIVING BUFFER 00207000
TAKEOK2 EQU * 00208000
STC R6,0(R5) SET THE COUNT BYTE 00209000
LTR R6,R6 IS THERE ANYTHING TO BE MOVED? 00210000
BZ TAKENONE NOPE - GIVER MUST HAVE STRANGE REQUEST 00211000
BCTR R6,0 REG.6 = CHARACTER COUNT FOR MOVE -1 00212000
EX R6,TAKEMOVE MOVE THE REQUEST CHARACTER STRING 00213000
SPACE 00214000
TAKENONE EQU * 00215000
MVI 0(R1),C'?' SET FIRST CHARACTER OF DEFAULT NAME 00216000
MVC 1(3,R1),0(R1) SET GIVER'S NAME TO C'????' FOR NOW 00217000
SPACE 00218000
DROP R11 00219000
USING TASKE,R4 GET TASK ELEMENT ADDRESSABILITY 00220000
LA R4,TASKQ-(TASKNEXT-TASKE) INITIALIZE TASK ELEMENT POINTE 00221000
TAKETASK EQU * 00222000
ICM R4,B'1111',TASKNEXT REG 4 = ADDRESS OF NEXT TASK ELEMENT 00223000
BZ TAKEXIT YES - SHOULDN'T HAPPEN - BETTER JUST QUIT 00224000
CLC TASKID(1),GIVERID IS THIS THE GIVER'S TASK ELEMEN 00225000
BNE TAKETASK NOPE - KEEP LOOKING FOR THE RIGHT ONE 00226000
MVC 0(4,R1),TASKNAME SET GIVER'S NAME IN TAKER'S TABLE 00227000
SPACE 00228000
TAKEXIT EQU * 00229000
L R15,DISPATCH REG.15 = ADDRESS OF DISPATCHER ENTRY 00230000
BALR R14,R15 EXIT TO DISPATCHER 00231000
SPACE 00232000
TAKENOGO EQU * 00233000
OI TGREG15+3,X'08' SET NO PENDING GIVE REQUEST RETURN CODE 00234000
B TAKEXIT AND RETURN WITH RETURN CODE THROUGH DISPATCHER 00235000
SPACE 00236000
TAKEMOVE MVC 1(0,R5),1(R4) TO BE EXECUTED BY CODE ABOVE 00237000
EJECT 00238000
COPY RSSEQU 00239000
EJECT 00240000
COPY SVECTORS 00241000
EJECT 00242000
COPY TAREA 00243000
EJECT 00244000
COPY TASKE 00245000
EJECT 00246000
COPY GIVEE 00247000
END 00248000