Table of Contents

DMKLOC Source

References

Source Listing

DMKLOC.ASSEMBLE.txt
  1. LOC TITLE 'DMKLOC (CP) VM/370 - RELEASE 6' 00001000
  2. ISEQ 73,80 VALIDATE SEQUENCING OF SYSIN @V200820 00002000
  3. *. 00003000
  4. * MODULE NAME 00004000
  5. * 00005000
  6. * DMKLOCK USER LOCK ROUTINE 00006000
  7. * 00007000
  8. * FUNCTION 00008000
  9. * 00009000
  10. * TO ALLOW A SYSTEM RESOURCE TO BE MARKED AS IN USE 00010000
  11. * OR NOT AVAILABLE, BY A UNIQUE 8 CHARACTER NAME. 00011000
  12. * 00012000
  13. * ATTRIBUTES 00013000
  14. * 00014000
  15. * REENTRANT, BALR CALLED, PAGEABLE 00015000
  16. * 00016000
  17. * ENTRY POINTS 00017000
  18. * 00018000
  19. * DMKLOCK LOCK A NAME 00019000
  20. * DMKLOCKD DEQUEUE A LOCKED NAME 00020000
  21. * DMKLOCKT TEST IF A NAME IS LOCKED 00021000
  22. * DMKLOCKQ QUEUE OR LOCK A NAME 00022000
  23. * 00023000
  24. * ENTRY CONDITIONS 00024000
  25. * 00025000
  26. * R1 = ADDRESS OF THE NAME TO LOCK, TEST, QUEUE 00026000
  27. * OR DEQUEUE. 00027000
  28. * 00028000
  29. * EXIT CONDITIONS 00029000
  30. * 00030000
  31. * DMKLOCK 00031000
  32. * CC = 0 SUCCESSFUL LOCK WAS MADE 00032000
  33. * CC = 1 NAME LOCKED ON ENTRY 00033000
  34. * 00034000
  35. * DMKLOCKD 00035000
  36. * CC = 0 SUCCESSFUL UNLOCK OR DEQUEUE 00036000
  37. * CC = 1 NAME WAS NOT LOCKED 00037000
  38. * 00038000
  39. * DMKLOCKT 00039000
  40. * CC = 0 LOCK IS OFF 00040000
  41. * CC = 1 LOCK IS ON 00041000
  42. * 00042000
  43. * DMKLOCKQ 00043000
  44. * NO CONDITION CODE IS SET. THE ROUTINE WILL NOT 00044000
  45. * RETURN TO THE CALLER UNTIL A SECCESSFUL LOCK IS MADE. 00045000
  46. * IF THE NAME IS LOCKED AT ENTRY THE CALLER WILL BE 00046000
  47. * QUEUED UNTIL DEQUEUED BY THE DMKLOCKD ROUTINE. 00047000
  48. * 00048000
  49. * CALLS TO OTHER ROUTINES 00049000
  50. * 00050000
  51. * DMKFREE - TO GET FREE STORAGE FOR A LOCKBLOK 00051000
  52. * DMKFRET - TO RETURN FREE STORAGE 00052000
  53. * 00053000
  54. EJECT 00054000
  55. * EXTERNAL REFERENCES 00055000
  56. * 00056000
  57. * DMKSYSLB = POINTER TO THE USER DIRECTORY LOCK BLOCK 00057000
  58. * 00058000
  59. * TABLES / WORK AREAS 00059000
  60. * 00060000
  61. * NONE 00061000
  62. * 00062000
  63. * REGISTER USAGE 00063000
  64. * 00064000
  65. * 00065000
  66. * R0 = WORK 00066000
  67. * R1 = POINTER TO NAME FROM USER 00067000
  68. * R2 = FIRST HALF OF NAME FROM USER 00068000
  69. * R3 = SECOND HALF OF NAME FROM USER 00069000
  70. * R4 = POINTER TO L BLOCK 00070000
  71. * R5 = POINTER TO THE NEXT LOCK BLOCK 00071000
  72. * R6 = FIRST HALF OF NAME FROM THE LOCK BLOCK 00072000
  73. * R7 = SECOND HALF OF NAME FROM THE LOCK BLOCK 00073000
  74. * R8 = POINTER TO THE LAST LOCK BLOCK 00074000
  75. * R9 = BRANCH AND LINK REG 00075000
  76. * R10 = POINTER TO DMKSYSLC OR CPEXBLOK. 00076000
  77. * R11 = VMBLOK 00077000
  78. * R12 = BASE A(DMKLOCK) 00078000
  79. * R13 = NOT USED 00079000
  80. * R14 = CALLERS RETURN ADDRESS. 00080000
  81. * R15 = ADDRESS OF THE ENTRY POINT. 00081000
  82. * 00082000
  83. * OPERATION 00083000
  84. * 00084000
  85. * DMKLOCK 00085000
  86. * 00086000
  87. * 1. SCAN LOCK BLOCK LIST 00087000
  88. * 2. IF THE LOCK IS ON EXIT CC = 1. 00088000
  89. * 3. CALL DMKFREE TO GET A LOCK BLOCK. 00089000
  90. * 4. BUILD AND CHAIN IN THE LOCK BLOCK. 00090000
  91. * 5. EXIT CC = 0 00091000
  92. * 00092000
  93. * DMKLOCKD 00093000
  94. * 00094000
  95. * 1. SCAN LOCK BLOCK LIST. 00095000
  96. * 2. IF THE LOCK IS OFF EXIT CC = 1. 00096000
  97. * 3. IF ANY CPEXBLOK'S ARE QUEUED GO TO STEP 7. 00097000
  98. * 4. UNCHAIN THE LOCK BLOCK. 00098000
  99. * 5. CALL DMKFRET TO RETURN THE LOCK BLOCK'S STORAGE. 00099000
  100. * 6. EXIT CC = 0. 00100000
  101. * 7. UNCHAIN THE CPEXBLOK FROM THE LOCK BLOCK AND 00101000
  102. * CALL DMKSTKCP THE CPEXBLOCK. 00102000
  103. * 8. EXIT CC = 0. 00103000
  104. * 00104000
  105. * DMKLOCKT 00105000
  106. * 00106000
  107. * 1. SCAN LOCK BLOCK LIST. 00107000
  108. * 2. EXIT CC = 0 IF LOCK IS OFF. 00108000
  109. * 3. EXIT CC = 1 IF THE LOCK IS ON. 00109000
  110. * 00110000
  111. * DMKLOCKQ 00111000
  112. * 00112000
  113. * 1. SCAN LOCK BLOCK LIST. 00113000
  114. * 2. IF THE LOCK IS NOT ON GO TO THE LOCK ROUTINE 00114000
  115. * STEP 3, ELSE CONTINUE. 00115000
  116. * 3. CALL DMKFREE TO GET A CPEXBLOK. 00116000
  117. * 4. BUILD A CPEXBLOK AND CHAIN IT TO THE END OF 00117000
  118. * THE LOCK BLOCK QUEUE. 00118000
  119. * 5. GO TO DMKDSPCH (WAIT FOR THE NAME TO BE UNLOCKED). 00119000
  120. *. 00120000
  121. SPACE 3 00121000
  122. DMKLOC CSECT 00122000
  123. USING PSA,R0 00123000
  124. * USING LOCKBLOK,R4 00124000
  125. USING SYSLOCS,R10 00125000
  126. USING DMKLOCK,R12 00126000
  127. SPACE 3 00127000
  128. EXTRN DMKSTKMP STACK FOR MY PROCESSOR @V407510 00128100
  129. EXTRN DMKSTKOP STACK FOR OTHER PROCESSOR @V407510 00128200
  130. EJECT 00129000
  131. ENTRY DMKLOCK 00130000
  132. DMKLOCK STM R0,R15,BALRSAVE SAVE THE CALLERS REGISTERS 00131000
  133. LR R12,R15 POINT TO THE START OF THE MODULE 00132000
  134. BAL R9,SCAN LOOK UP NAME 00133000
  135. BC 4,EXITCC1 RETURN CC EQ 1 IF LOCK WAS ON 00134000
  136. LOCKIT LA R0,LOCKSIZE SET UP TO GET CORE 00135000
  137. CALL DMKFREE GET FREE CORE FOR L BLOCK 00136000
  138. USING LOCKBLOK,R1 00137000
  139. ST R5,LOCKNEXT STORE ZERO IN LOCKNEXT 00138000
  140. ST R5,LOCKQUE ZERO THE QUEUE LIST POINTER 00139000
  141. STM R2,R3,LOCKNAME STORE NAME IN NEW L BLOCK 00140000
  142. DROP R1 00141000
  143. USING LOCKBLOK,R4 00142000
  144. ST R1,LOCKNEXT SAVE POINTER IN LAST L BLOCK 00143000
  145. B EXITCC0 RETURN CC EQ 0 00144000
  146. SPACE 2 00145000
  147. ENTRY DMKLOCKD 00146000
  148. USING *,R15 00147000
  149. DMKLOCKD STM R0,R15,BALRSAVE SAVE THE CALLERS REGISTERS 00148000
  150. L R12,=A(DMKLOCK) POINT TO THE START OF THE MODULE 00149000
  151. DROP R15 00150000
  152. BAL R9,SCAN LOOK UP NAME 00151000
  153. BZ EXITCC1 BRANCH IF NAME WAS NOT LOCKED 00152000
  154. ICM R1,15,LOCKQUE POINT TO THE FIRST CPEXBLOK, IF ANY. 00153000
  155. BP DEQUEUE DEQUEUE THE CPEXBLOK IF ANY 00154000
  156. DROP R4 00155000
  157. USING LOCKBLOK,R8 00156000
  158. ST R5,LOCKNEXT SAVE POINTER IN LAST L BLOCK 00157000
  159. LA R0,LOCKSIZE SET UP STORAGE SIZE TO FRET 00158000
  160. LR R1,R4 POINT TO STORAGE TO FRET 00159000
  161. DROP R8 00160000
  162. USING LOCKBLOK,R4 00161000
  163. CALL DMKFRET 00162000
  164. B EXITCC0 RETURN CC EQ 0 00163000
  165. SPACE 00164000
  166. USING CPEXBLOK,R1 00165000
  167. DEQUEUE MVC LOCKQUE(4),CPEXFPNT POINT TO THE NEXT CPEXBLOK 00166000
  168. * NOTE: DMKSTK WILL NOT USE BALR SAVE AREA @V407510 00167100
  169. CLC CPEXPROC,LPUADDR STACK FOR THIS PROCESSOR? @V407510 00167200
  170. BNE STKOTHER NO, STACK FOR OTHER PROCESSOR @V407510 00167300
  171. CALL DMKSTKMP STACK CPEXBLOK FOR THIS PROC @V407510 00167400
  172. B EXITCC0 RETURN CC=0 TO CALLER @V407510 00167500
  173. STKOTHER DS 0H @V407510 00167600
  174. CALL DMKSTKOP STACK CPEXBLOK FOR OTHER PROC @V407510 00167700
  175. B EXITCC0 RETURN CC = 0 TO THE CALLER 00169000
  176. EJECT 00170000
  177. ENTRY DMKLOCKT 00171000
  178. USING *,R15 00172000
  179. DMKLOCKT STM R0,R15,BALRSAVE SAVE THE CALLERS REGISTERS 00173000
  180. L R12,=A(DMKLOCK) POINT TO THE START OF THE MODULE 00174000
  181. DROP R15 00175000
  182. BAL R9,SCAN LOOK UP NAME 00176000
  183. B EXIT RETURN CC EQ 0 LOCK OFF CC EQ 1 LOCK ON 00177000
  184. SPACE 3 00178000
  185. ENTRY DMKLOCKQ 00179000
  186. USING *,R15 00180000
  187. DMKLOCKQ STM R0,R15,BALRSAVE SAVE CALLERS REGISTERS 00181000
  188. L R12,=A(DMKLOCK) POINT TO THE START OF THE MODULE 00182000
  189. DROP R15 00183000
  190. BAL R9,SCAN GO LOOK UP THE NAME; IS IT LOCKED? 00184000
  191. BZ LOCKIT NO- BRANCH TO BUILD A LOCK BLOCK 00185000
  192. LA R0,CPEXSIZE * GET A CPEXBLOK TO QUEUE OFF THE 00186000
  193. CALL DMKFREE * LOCK BLOCK. 00187000
  194. MVC CPEXPROC,LPUADDR INDICATE BLOK TO BE STACKED @V407510 00187100
  195. * FOR THIS PROCESSOR @V407510 00187200
  196. MVC CPEXREGS(16*4),BALRSAVE MOVE ALL 16 REGS IN 00188000
  197. MVC CPEXADD(4),BALR14 AND THE RETURN REG ALSO 00189000
  198. XC CPEXFPNT(4),CPEXFPNT ZERO POINTER TO NEXT CPEXBLOK 00190000
  199. DROP R1 00191000
  200. USING CPEXBLOK,R3 00192000
  201. LA R3,LOCKQUE-(CPEXFPNT-CPEXBLOK) POINT AT POINTER TO *00193000
  202. CHAIN OF CPEXBLOK'S 00194000
  203. LOOP1 ICM R2,15,CPEXFPNT GET NEXT POINTER AND TEST FOR ZERO 00195000
  204. BZ ENDOFQUE IF ZERO BRANCH 00196000
  205. LR R3,R2 POINT TO THE NEXT CPEXBLOK 00197000
  206. B LOOP1 AND LOOP 00198000
  207. ENDOFQUE ST R1,CPEXFPNT CHAIN IN THE NEW CPEXBLOK 00199000
  208. DROP R3 00200000
  209. GOTO DMKDSPCH WAIT FOR SOMEBODY TO UNLOCK THIS NAME!! 00201000
  210. EJECT 00202000
  211. * SCAN SUBROUTINE 00203000
  212. SPACE 00204000
  213. SCAN LM R2,R3,0(R1) PICK UP NAME FROM CALLER 00205000
  214. L R10,ASYSLC POINTER TO SYSLOCS 00206000
  215. LA R4,DMKSYSLB SET UP FOR FIRST TIME 00207000
  216. L R5,DMKSYSLB PICK UP POINTER TO FIRST L BLOCK 00208000
  217. RESCAN LTR R5,R5 IS POINTER 0 00209000
  218. BCR 8,R9 YES- END OF LIST GO BACK TO CALLER 00210000
  219. LR R8,R4 POINT TO THE LAST L BLOCK 00211000
  220. LR R4,R5 SET POINTER TO NEXT L BLOCK 00212000
  221. L R5,LOCKNEXT POINT TO NEXT L BLOCK 00213000
  222. LM R6,R7,LOCKNAME PICK UP L BLOCK NAME 00214000
  223. CLR R2,R6 IS NAME EQ 00215000
  224. BNE RESCAN NO- BRANCH 00216000
  225. CLR R3,R7 IS NAME EQ 00217000
  226. BNE RESCAN NO- BRANCH 00218000
  227. TM *,X'FF' SET CC EQ 1 00219000
  228. BR R9 GO BACK TO CALLER 00220000
  229. SPACE 2 00221000
  230. EXITCC0 SR R0,R0 SET CC = 0 00222000
  231. EXIT LM R0,R15,BALRSAVE RETURN THE CALLERS REG'S 00223000
  232. BR R14 AND GO BACK 00224000
  233. EXITCC1 TM *,X'FF' SET CC EQ 1 00225000
  234. B EXIT RETURN TO CALLER CC = 1 00226000
  235. EXITCC2 CLI *,X'00' SET CC = 2 00227000
  236. B EXIT RETURN TO CALLER CC EQ 0 00228000
  237. SPACE 3 00229000
  238. LTORG 00230000
  239. EJECT 00231000
  240. COPY EQU 00232000
  241. COPY SAVE 00233000
  242. COPY UDIRECT 00234000
  243. SYSLOCS 00235000
  244. PSA 00236000
  245. END DMKLOC 00237000