Table of Contents

DMTAKE Source

References

Source Listing

DMTAKE.ASSEMBLE.txt
  1. AKE TITLE 'DMTAKE (RSCS) VM/370 - RELEASE 6' 00001000
  2. *. 00002000
  3. * MODULE NAME - 00003000
  4. * 00004000
  5. * DMTAKE 00005000
  6. * 00006000
  7. * FUNCTION - 00007000
  8. * 00008000
  9. * THE DMTAKE MODULE CONTAINS THE SUPR SERVICE WHICH 00009000
  10. * SUPPLIES TASK PROGRAMS WITH THE RECEIVER INTERFACE 00010000
  11. * TO GIVE REQUESTS ISSUED BY OTHER TASKS. A SINGLE 00011000
  12. * CALL TO DMTAKE FIRST RESPONDS TO THE PREVIOUSLY 00012000
  13. * SUPPLIED GIVE REQUEST, AND THEN SUPPLIES A NEW 00013000
  14. * GIVE REQUEST TO THE TASK FOR ITS PROCESSING. 00014000
  15. * 00015000
  16. * ATTRIBUTES - 00016000
  17. * 00017000
  18. * REUSABLE, NON-INTERRUPTABLE 00018000
  19. * 00019000
  20. * ENTRY POINTS - 00020000
  21. * 00021000
  22. * DMTAKE - RESPOND TO LAST REQ, ACCEPT ANOTHER 00022000
  23. * 00023000
  24. * ENTRY CONDITIONS - 00024000
  25. * 00025000
  26. * GPR0 = POST CODE FOR RESPONSE TO PREVIOUS REQUEST 00026000
  27. * GPR1 = ADDRESS OF CALLER'S TAKE TABLE 00027000
  28. * GPR14 = RETURN ADDRESS 00028000
  29. * GPR15 = ENTRY ADDRESS 00029000
  30. * 00030000
  31. * EXIT CONDITIONS - 00031000
  32. * 00032000
  33. * NORMAL - 00033000
  34. * 00034000
  35. * GPR15 = X'00' RESPONSE PERFORMED, NEW REQUEST 00035000
  36. * SUPPLIED 00036000
  37. * 00037000
  38. * ERROR - 00038000
  39. * 00039000
  40. * GPR15 = X'04' IF REQ SUPPLIED AND NO RESP PENDING 00040000
  41. * X'08' IF RESP DONE AND NO REQ PENDING 00041000
  42. * X'0C' IF NEITHER REQ NOR RESP PENDING 00042000
  43. * 00043000
  44. EJECT 00044000
  45. * 00045000
  46. * CALLS TO OTHER ROUTINES - 00046000
  47. * 00047000
  48. * DMTQRQ - TO RESERVE AND RELEASE SUP QUEUE ELEMENTS 00048000
  49. * DMTPST - TO POST RESPONSE COMPLETION 00049000
  50. * 00050000
  51. * EXTERNAL REFERENCES - 00051000
  52. * 00052000
  53. * NONE 00053000
  54. * 00054000
  55. * TABLES / WORKAREAS - 00055000
  56. * 00056000
  57. * DMTVEC - SUPERVISOR COMMON AREA 00057000
  58. * TASK ELEMENT 00058000
  59. * GIVE ELEMENT 00059000
  60. * 00060000
  61. * REGISTER USAGE - 00061000
  62. * 00062000
  63. * GPR0 = RESPONSE POST CODE REGISTER 00063000
  64. * GPR1 = CALLING PARAMETER REGISTER 00064000
  65. * GPR2 = GIVE REQUEST ELEMENT POINTER 00065000
  66. * GPR3 = GIVE REQUEST ELEMENT POINTER 00066000
  67. * GPR4 = TASK ELEMENT POINTER 00067000
  68. * GPR5 = SCRATCH 00068000
  69. * GPR6 = SCRATCH 00069000
  70. * GPR7 = UNUSED 00070000
  71. * GPR8 = UNUSED 00071000
  72. * GPR9 = UNUSED 00072000
  73. * GPR10 = UNUSED 00073000
  74. * GPR11 = TASK ELEMENT POINTER 00074000
  75. * GPR12 = DMTAKE BASE REGISTER 00075000
  76. * GPR13 = TASK SAVE AREA POINTER 00076000
  77. * GPR14 = LINKAGE RETURN REGISTER 00077000
  78. * GPR15 = LINKAGE ENTRY REGISTER 00078000
  79. * 00079000
  80. * NOTES - 00080000
  81. * 00081000
  82. * THE FUNCTIONAL DESIGN OF THIS MODULE IS FAIRLY ELABORATE, 00082000
  83. * PARTIALLY AS A RESULT OF THE NEED TO INSURE INTEGRITY 00083000
  84. * OF THE SYSTEM WHEN A TASK TERMINATES ABRUPTLY, AND 00084000
  85. * AND PARTIALLY AS THE RESULT OF EXPERIENCE WITH A SIMPLER 00085000
  86. * AND MORE GENERAL SIMILAR FACILITY. 00086000
  87. * 00087000
  88. * OPERATION - 00088000
  89. * 00089000
  90. * DMTAKE BEGINS PROCESSING BY SUSPENDING THE 00090000
  91. * CALLING TASK'S EXECUTION BY THE FREEZE SVC 00091000
  92. * FUNCTION. THE GIVE REQUEST QUEUE IS SCANNED FOR AN 00092000
  93. * ELEMENT REFLECTING A PENDING RESPONSE TO A 00093000
  94. * PREVIOUSLY RECEIVED GIVE REQUEST. IF SUCH AN 00094000
  95. * ELEMENT IS FOUND, THE RESPONSE BUFFER SUPPLIED BY 00095000
  96. * THE CALLER IS MOVED TO THE SENDER'S RESPONSE 00096000
  97. * BUFFER, AND THE SENDER'S GIVE TABLE IS POSTED WITH 00097000
  98. * THE CODE SUPPLIED BY THE RESPONDING TASK. THE GIVE 00098000
  99. * REQUEST QUEUE IS THEN SCANNED AGAIN FOR AN ELEMENT 00099000
  100. * REFLECTING A PREVIOUSLY UNACCEPTED GIVE REQUEST 00100000
  101. * ADDRESSED TO THE CALLING TASK. IF SUCH AN ELEMENT 00101000
  102. * IS FOUND, THE REQUEST BUFFER SUPPLIED BY THE TASK 00102000
  103. * ISSUING THE GIVE REQUEST IS MOVED TO THE DMTAKE 00103000
  104. * CALLER'S REQUEST BUFFER. THE RETURN CODE IS SET 00104000
  105. * ACCORDING TO THE CONDITIONS WHICH OCCURED DURING 00105000
  106. * THE DMTAKE REQUEST PROCESSING, AND CONTROL IS 00106000
  107. * RETURNED TO THE DISPATCHER. 00107000
  108. * 00108000
  109. * 00109000
  110. *. 00110000
  111. EJECT 00111000
  112. DMTAKE CSECT 00112000
  113. SPACE 00113000
  114. * ENTRY POINT FOR CALL TO DMTAKE ROUTINE 00114000
  115. SPACE 00115000
  116. FREEZE SAVE RESUME PSW AND GREGS FOR DISPATCH LATER 00116000
  117. SPACE 00117000
  118. LR R13,R14 REG.13 = CALLER'S TASK SAVE AREA ADDRESS 00118000
  119. USING TAREA,R13 DEFINE ADDRESSABILITY FOR CALLER'S S 00119000
  120. USING SVECTORS,0 GET SVECTORS ADDRESSABILITY 00120000
  121. USING GIVEE,R2 GET GIVE ELEMENT ADDRESSABILITY 00121000
  122. USING TASKE,R11 GET TASK ELEMENT ADDRESSABILITY 00122000
  123. SPACE 00123000
  124. LA R12,0(R15) REG.12 = ENTRY ADDRESS FOR DMTAKE 00124000
  125. USING DMTAKE,R12 USE ENTRY ADDRESS AS BASE 00125000
  126. SPACE 00126000
  127. L R11,ACTIVE INITIALIZE TAKER'S TASK TABLE ADDRESS REGISTE 00127000
  128. SPACE 00128000
  129. LA R15,4 REG.15 = NO PENDING RESPONSE RETURN CODE 00129000
  130. ST R15,TGREG15 ANTICIPATE THAT SITUATION FOR NOW 00130000
  131. SPACE 00131000
  132. LA R2,GIVEQ-(GIVENEXT-GIVEE) INITIALIZE GIVE QUEUE ELEMENT 00132000
  133. TAKERESP EQU * 00133000
  134. LR R3,R2 SAVE PREDECESSOR ADDRESS 00134000
  135. ICM R2,B'1111',GIVENEXT-GIVEE(R3) REG 2 = ADDRESS OF NEXT GI 00135000
  136. BZ TAKERQST NOPE - NO PENDING RESPONSE FOR CALLER 00136000
  137. CLC GIVENID(1),TASKID-TASKE(R11) IS THIS THE CALLER'S PENDIN 00137000
  138. BNE TAKERESP NOPE - KEEP LOOKING THROUGH THE QUEUE 00138000
  139. SPACE 00139000
  140. MVC GIVENEXT-GIVEE(4,R3),GIVENEXT UNCHAIN TO START 00140000
  141. MVI TGREG15+3,X'00' AND CLEAR THE RETURN CODE 00141000
  142. SPACE 00142000
  143. L R3,GIVEADDR REG.3 = ADDR OF GIVER'S TABLE 00143000
  144. L R4,8(R1) REG.4 = 'FROM' ADDRESS (TAKE RESPONSE BUFFER) 00144000
  145. L R5,12(R3) REG.5 = 'TO' ADDRESS (GIVE RESPONSE BUFFER) 00145000
  146. SR R6,R6 CLEAR CHARACTER COUNT REGISTER 00146000
  147. IC R6,0(R4) REG.6 = RESPONSE MESSAGE CHARACTER COUNT 00147000
  148. CLC 0(1,R4),12(R3) IS THERE ENOUGH ROOM FOR THE RESPONSE? 00148000
  149. BNH TAKEOK1 YES - MOVE THE ENTIRE THING 00149000
  150. IC R6,12(R3) OTHERWISE, TRUNCATE AT END OF RECEIVING BUFFER 00150000
  151. TAKEOK1 EQU * 00151000
  152. STC R6,0(R5) SET THE COUNT BYTE 00152000
  153. LTR R6,R6 ANYTHING TO BE MOVED? 00153000
  154. BZ TAKEMUTE NO - SKIP MOVER LOGIC 00154000
  155. BCTR R6,0 REG.6 = CHAR COUNT FOR MOVE -1 00155000
  156. EX R6,TAKEMOVE MOVE THE RESPONSE CHARACTER STRING 00156000
  157. * B TAKEMUTE AT THE TOP OF THE NEXT PAGE 00157000
  158. EJECT 00158000
  159. TAKEMUTE EQU * 00159000
  160. MVC 4(4,R3),TASKNAME RESTORE ADDRESSEE'S NAME IN TABLE 00160000
  161. LR R1,R3 REG.1 = ADDRESS OF GIVER'S TABLE 00161000
  162. L R15,POSTREQ REG.15 = ENTRY ADDRESS TO POST ROUTINE 00162000
  163. BALR R14,R15 POST WITH CODE IN REG.0 AS SET BY CALLER 00163000
  164. SPACE 00164000
  165. LR R1,R2 REG.1 = ADDRESS OF OLD GIVE QUEUE ELEMENT 00165000
  166. L R15,QREQ REG.15 = ENTRY ADDRESS TO SUP QUEUE MANAGER 00166000
  167. BALR R14,R15 FREE THE OLD ELEMENT 00167000
  168. O R15,TGREG15 REG.15 = COMPOSITE ERROR CODE SO FAR 00168000
  169. ST R15,TGREG15 SET RETURN CODE FOR CALLER 00169000
  170. L R1,TGREG1 RESTORE TAKE REQUEST TABLE ADDRESS 00170000
  171. SPACE 00171000
  172. TAKERQST EQU * 00172000
  173. CLI 4(R1),X'00' IS THERE A NEW TAKE REQUEST? 00173000
  174. BE TAKEXIT NOPE - RETURN TO CALLER IMMEDIATELY 00174000
  175. SPACE 00175000
  176. SR R2,R2 CLEAR QUEUE SCAN POINTER SAVE REGISTER 00176000
  177. LA R3,GIVEQ-(GIVENEXT-GIVEE) INITIALIZE QUEUE SCAN REGISTER 00177000
  178. DROP R2 00178000
  179. USING GIVEE,R3 GET GIVE ELEMENT ADDRESSABILTIY 00179000
  180. TAKESCAN EQU * 00180000
  181. ICM R3,B'1111',GIVENEXT REG 3 = ADDR OF NEXT GIVE ELEMENT IN 00181000
  182. BZ TAKEQEND YEP - GO SEE WHAT TO DO NEXT 00182000
  183. CLI GIVENID,X'00' IS A RESPONSE PENDING ALREADY? 00183000
  184. BNE TAKESCAN YES - KEEP LOOKING FOR A PENDING REQUEST 00184000
  185. CLC GIVENAME(4),TASKNAME IS THIS ONE FOR THE CALLER? 00185000
  186. BNE TAKESCAN NOPE - KEEP LOOKING DOWN THE QUEUE 00186000
  187. LTR R2,R2 HAVE WE HIT ONE FOR THE CALLER ALREADY? 00187000
  188. BNZ TAKEGIVE YEP - GO DELIVER IT WITHOUT CLEARING SYNLOCK 00188000
  189. LR R2,R3 OTHERWISE SAVE THE ADDRESS OF THE ELEMENT 00189000
  190. B TAKESCAN AND SEE IF THERE ARE ANY MORE LEFT 00190000
  191. EJECT 00191000
  192. TAKEQEND EQU * 00192000
  193. XC TREQLOCK(4),TREQLOCK CLEAR SYNLOCK - NO MORE PENDING 00193000
  194. LTR R2,R2 DID WE ACTUALLY FIND THE LAST ONE? 00194000
  195. BZ TAKENOGO NOPE - RETURN WITH ERROR INDICATION 00195000
  196. DROP R3 00196000
  197. USING GIVEE,R2 GET GIVE ELEMENT ADDRESSABILITY 00197000
  198. TAKEGIVE EQU * 00198000
  199. MVC GIVENID(1),TASKID-TASKE(R11) SET RESPONSE PENDING FROM C 00199000
  200. L R3,GIVEADDR REG.3 = ADDRESS OF GIVER'S TABLE 00200000
  201. L R4,8(R3) REG.4 = 'FROM' ADDRESS (GIVE REQUEST BUFFER) 00201000
  202. L R5,4(R1) REG.5 = 'TO' ADDRESS (TAKE REQUEST BUFFER) 00202000
  203. SR R6,R6 CLEAR CHARACTER COUNT REGISTER 00203000
  204. IC R6,0(R4) REG.6 = REQUEST MESSAGE CHARACTER COUNT 00204000
  205. CLC 0(1,R4),4(R1) IS THERE ROOM ENOUGH TO FIT IT ALL IN? 00205000
  206. BNH TAKEOK2 YES - DO SO 00206000
  207. IC R6,4(R1) OTHERWISE, TRUNCATE AT END OF RECEIVING BUFFER 00207000
  208. TAKEOK2 EQU * 00208000
  209. STC R6,0(R5) SET THE COUNT BYTE 00209000
  210. LTR R6,R6 IS THERE ANYTHING TO BE MOVED? 00210000
  211. BZ TAKENONE NOPE - GIVER MUST HAVE STRANGE REQUEST 00211000
  212. BCTR R6,0 REG.6 = CHARACTER COUNT FOR MOVE -1 00212000
  213. EX R6,TAKEMOVE MOVE THE REQUEST CHARACTER STRING 00213000
  214. SPACE 00214000
  215. TAKENONE EQU * 00215000
  216. MVI 0(R1),C'?' SET FIRST CHARACTER OF DEFAULT NAME 00216000
  217. MVC 1(3,R1),0(R1) SET GIVER'S NAME TO C'????' FOR NOW 00217000
  218. SPACE 00218000
  219. DROP R11 00219000
  220. USING TASKE,R4 GET TASK ELEMENT ADDRESSABILITY 00220000
  221. LA R4,TASKQ-(TASKNEXT-TASKE) INITIALIZE TASK ELEMENT POINTE 00221000
  222. TAKETASK EQU * 00222000
  223. ICM R4,B'1111',TASKNEXT REG 4 = ADDRESS OF NEXT TASK ELEMENT 00223000
  224. BZ TAKEXIT YES - SHOULDN'T HAPPEN - BETTER JUST QUIT 00224000
  225. CLC TASKID(1),GIVERID IS THIS THE GIVER'S TASK ELEMEN 00225000
  226. BNE TAKETASK NOPE - KEEP LOOKING FOR THE RIGHT ONE 00226000
  227. MVC 0(4,R1),TASKNAME SET GIVER'S NAME IN TAKER'S TABLE 00227000
  228. SPACE 00228000
  229. TAKEXIT EQU * 00229000
  230. L R15,DISPATCH REG.15 = ADDRESS OF DISPATCHER ENTRY 00230000
  231. BALR R14,R15 EXIT TO DISPATCHER 00231000
  232. SPACE 00232000
  233. TAKENOGO EQU * 00233000
  234. OI TGREG15+3,X'08' SET NO PENDING GIVE REQUEST RETURN CODE 00234000
  235. B TAKEXIT AND RETURN WITH RETURN CODE THROUGH DISPATCHER 00235000
  236. SPACE 00236000
  237. TAKEMOVE MVC 1(0,R5),1(R4) TO BE EXECUTED BY CODE ABOVE 00237000
  238. EJECT 00238000
  239. COPY RSSEQU 00239000
  240. EJECT 00240000
  241. COPY SVECTORS 00241000
  242. EJECT 00242000
  243. COPY TAREA 00243000
  244. EJECT 00244000
  245. COPY TASKE 00245000
  246. EJECT 00246000
  247. COPY GIVEE 00247000
  248. END 00248000