User Tools

Site Tools


ibm:vm370-lib:cms:dmssmn.assemble_src

DMSSMN Source

References

Source Listing

DMSSMN.ASSEMBLE.txt
  1. SMN TITLE 'DMSSMN (CMS) VM/370 - RELEASE 6' 00001000
  2. SPACE 2 00002000
  3. *. 00003000
  4. * 00004000
  5. * 00005000
  6. *MODULE NAME - 00006000
  7. * 00007000
  8. * DMSSMN 00008000
  9. * 00009000
  10. *FUNCTION - 00010000
  11. * 00011000
  12. * THE DMSSMN ROUTINE PROCESSES OS FREEMAIN AND GETMAIN 00012000
  13. * MACROS, AND CMS CALLS TO DMSSMNSB (STRINIT). 00013000
  14. * 00014000
  15. *ATTRIBUTES - 00015000
  16. * 00016000
  17. * NUCLEUS RESIDENT, RE-ENTRANT 00017000
  18. * 00018000
  19. *ENTRY POINTS - 00019000
  20. * 00020000
  21. * DMSSMN10 (SVC 10) -- GETMAIN AND FREEMAIN, R TYPE, FREEPOOL 00021000
  22. * 00022000
  23. * DMSSMN5 (SVC 5) -- FREEMAIN V,A=ADDRESS 00023000
  24. * 00024000
  25. * DMSSMN4 (SVC 4) -- GETMAIN (VC, RU, EC TYPES) 00025000
  26. * 00026000
  27. * DMSSMNSB, -- STRINIT 00027000
  28. * 00028000
  29. *ENTRY CONDITIONS - 00029000
  30. * 00030000
  31. * DMSSMN10,DMSSMN5,DMSSMN4 -- THE REGISTERS ARE SET UP BY THE OS 00031000
  32. * MACROES GETMAIN, FREEMAIN, AND FREEPOOL. 00032000
  33. * 00033000
  34. * DMSSMNSB -- BALR R14,R15 00034000
  35. * 00035000
  36. *EXIT CONDITIONS - 00036000
  37. * 00037000
  38. * NORMAL - 00038000
  39. * THE SPECIFIED STORAGE IS ALLOCATED OR RELEASED, AND CONTROL 00039000
  40. * RETURNS TO THE USER. 00040000
  41. * 00041000
  42. * ERROR - 00042000
  43. * IF THE REQUEST CANNOT BE SATISFIED, AND IT IS UNCONDITIONAL, 00043000
  44. * THEN MESSAGE DMSSMN109S OR DMSSMN133S IS TYPED OUT AND 00044000
  45. * THE USER IS ABENDED. 00045000
  46. * 00046000
  47. *CALLS TO OTHER ROUTINES - 00047000
  48. * 00048000
  49. * DMSSVT, DMSSAB,DMSFRE,DMSLGTA,DMSSLNAB 00049000
  50. * 00050000
  51. *EXTERNAL REFERENCES - 00051000
  52. * 00052000
  53. * NUCON, SSAVE 00053000
  54. * 00054000
  55. *TABLES / WORKAREAS - 00055000
  56. * 00056000
  57. * MACLIB DIRECTORY TABLES ARE FREED BY DMSSMNCL 00057000
  58. * 00058000
  59. *REGISTER USAGE - 00059000
  60. * 00060000
  61. * R12 = BASE 00061000
  62. * R0 - R11 = SCRATCH AND WORK REGISTERS 00062000
  63. * R13 - SYSTEM SAVE AREA 00063000
  64. * 00064000
  65. *OPERATION - 00065000
  66. * 00066000
  67. * IF AN OS GETMAIN OR FREEMAIN IS ISSUED WITH AN R 00067000
  68. * OPERAND, CONTROL IS PASSED VIA AN SVC10 TO THE SVC10 00068000
  69. * ENTRY POINT IN DMSSMN. DMSSMN ROUNDS THE AMOUNT OF 00069000
  70. * STORAGE SPECIFIED UP TO A DOUBLEWORD AND DETERMINES IF 00070000
  71. * A GETMAIN OR FREEMAIN WAS ISSUED. IF A GETMAIN WAS 00071000
  72. * ISSUED, THE GETBLK ROUTINE IN DMSSMN IS CALLED TO GET A 00072000
  73. * FREE STORAGE BLOCK. CONTROL IS THEN RETURNED TO THE 00073000
  74. * USER WITH THE ADDRESS OF THE FREE STORAGE IN REGISTER 00074000
  75. * ONE. IF A FREEMAIN WAS ISSUED, THE FREEBLK ROUTINE IN 00075000
  76. * DMSSMN IS CALLED TO RELEASE A BLOCK OF STORAGE AND 00076000
  77. * CONTROL IS RETURNED TO THE USER. 00077000
  78. * 00078000
  79. * IF AN OS GETMAIN IS ISSUED WITHOUT AN R OPERAND, 00079000
  80. * CONTROL IS PASSED VIA AN SVC4 TO THE SVC4 ENTRY 00080000
  81. * POINT IN DMSSMN. IF THE GETMAIN WAS NOT VARIABLE, 00081000
  82. * DMSSMN ROUNDS UP THE AMOUNT OF STORAGE SPECIFIED AND 00082000
  83. * CALLS THE GETBLK ROUTINE IN DMSSMN TO GET A FREE 00083000
  84. * STORAGE BLOCK. CONTROL IS THEN RETURNED TO THE USER 00084000
  85. * WITH THE ADDRESS OF THE FREE BLOCK. IF THE GETMAIN WAS 00085000
  86. * CONDITIONAL AND THERE WAS AN ERROR, AN ERROR CODE IS 00086000
  87. * PASSED BACK TO THE USER. IF THE GETMAIN WAS VARIABLE, 00087000
  88. * DMSSMN PROCEEDS AS ABOVE EXCEPT THAT IT SEARCHES THE 00088000
  89. * FREE CHAIN TO DETERMINE HOW MUCH STORAGE IS AVAILABLE 00089000
  90. * BEFORE CALLING THE GETBLK ROUTINE. 00090000
  91. * 00091000
  92. * IF AN OS FREEMAIN IS ISSUED WITHOUT AN R OPERAND, 00092000
  93. * CONTROL IS PASSED VIA AN SVC5 TO THE SVC5 ENTRY POINT 00093000
  94. * IN DMSSMN. DMSSMN ROUNDS THE AMOUNT TO BE FREED UP TO 00094000
  95. * A DOUBLEWORD AND CALLS THE FREEBLK ROUTINE TO FREE THE 00095000
  96. * SPECIFIED STORAGE. CONTROL IS THEN RETURNED TO USER. 00096000
  97. * 00097000
  98. * IF A CMS ROUTINE CALLS THE STORAGE INITIALIZATION 00098000
  99. * ROUTINE (STRINIT) IN DMSSMN, STRINIT 00099000
  100. * RESETS THE FREE STORAGE EXTENTS AND EFFECTIVELY FREES 00100000
  101. * ANY STORAGE THAT WAS PREVIOUSLY GETMAINED. IF ANY 00101000
  102. * ERRORS ARE ENCOUNTERED IN RESETTING THE EXTENTS AN 00102000
  103. * ABEND IS ISSUED, OTHERWISE CONTROL IS RETURNED TO THE 00103000
  104. * USER. 00104000
  105. * 00105000
  106. * THE GETBLK ROUTINE IN DMSSMN SEARCHES THE FREE CHAIN 00106000
  107. * FOR A BLOCK OF FREE STORAGE LARGE ENOUGH TO MEET THE 00107000
  108. * CALLER'S NEEDS. WHEN IT FINDS ONE, IT EITHER RESETS 00108000
  109. * THE BLOCK LENGTH OR, IF ALL THE BLOCK IS NEEDED, 00109000
  110. * DELETES IT AND RETURNS CONTROL TO THE CALLER. IF A 00110000
  111. * LARGE ENOUGH BLOCK CANNOT BE FOUND AND THE GETMAIN IS 00111000
  112. * UNCONDITIONAL, AN ABEND IS ISSUED. IF A LARGE ENOUGH 00112000
  113. * BLOCK CANNOT BE FOUND AND THE GETMAIN WAS CONDITIONAL, 00113000
  114. * CONTROL IS RETURNED TO THE CALLER WITH AN ERROR CODE IN 00114000
  115. * REGISTER 15. 00115000
  116. * 00116000
  117. * THE FREEBLK ROUTINE IN DMSSMN RETURNS A BLOCK OF 00117000
  118. * STORAGE TO THE FREE CHAIN. IF THE ADDRESS PASSED IT IS 00118000
  119. * BAD, THE FREEBLK ROUTINE ISSUES AN ABEND. IF THE BLOCK 00119000
  120. * IT IS FREEING IS CONTIGUOUS TO ANY OTHER FREE BLOCK IN 00120000
  121. * CORE, THE FREEBLK ROUTINE WILL COMBINE THE TWO BLOCKS. 00121000
  122. * UPON SUCCESSFUL COMPLETION CONTROL IS RETURNED TO THE 00122000
  123. * CALLER. 00123000
  124. * 00124000
  125. * PREVIOUS STORAGE ALLOCATION REQUESTS MAINTAIN A 00125000
  126. * CHAIN OF POINTERS TO DISCONNECTED AREAS OF FREE CORE 00126000
  127. * EACH LINK +00 IS FREPTR - POINTER TO NEXT LINK 00127000
  128. * ZERO IF LAST IN CHAIN 00128000
  129. * +04 IS FRELEN - LENGTH OF FREE AREA 00129000
  130. * FRELST POINTS TO THE FIRST LINK IN THE CHAIN 00130000
  131. * OF DISCONNECTED AREAS 00131000
  132. * FSTFRE HOLDS THE ORIGINAL BEGINNING OF USER FREE STORAGE 00132000
  133. * LENFRE HOLDS THE LENGTH OF THAT AREA 00133000
  134. * 00134000
  135. * NUCON LOCATION MAINHIGH HOLDS THE LOWER BOUND FOR EXTEND. 00135000
  136. * NUCON LOCATION FREELOWE (LOWEXT) HOLDS THE UPPER BOUND FOR 00136000
  137. * GETMAIN. 00137000
  138. * 00138000
  139. * 00139000
  140. * 00140000
  141. *. 00141000
  142. EJECT 00142000
  143. DMSSMN START X'00' IN THE BEGINNING ... 00143000
  144. ENTRY DMSSMN4,DMSSMN5,DMSSMN10 00144000
  145. ENTRY DMSSMNSB @VA04199 00145000
  146. USING NUCON,R0 00146000
  147. USING SSAVE,R13 00147000
  148. SPACE 3 00148000
  149. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00149000
  150. * 00150000
  151. * SVC 10 - GETMAIN AND FREEMAIN (MODE R) 00151000
  152. * (FREEPOOL IS ALSO SIMULATED AS SVC 10) 00152000
  153. * 00153000
  154. * ON ENTRY: R0 = LENGTH OF BLOCK TO BE FREED 00154000
  155. * OR ALLOCATED 00155000
  156. * R1 -> BLOCK TO BE FREED (FREEMAIN ONLY) 00156000
  157. * 00157000
  158. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00158000
  159. SPACE 1 00159000
  160. USING DMSSMN,R12 ESTABLISH COMMON ADDRESSABILITY @VA04199 00160000
  161. DMSSMN10 LA R5,10 SAVE SVC NUMBER IN R5 @VA04199 00161000
  162. L R13,CURRSAVE SET BASE REGISTER FOR SSAVE DSECT@VA04199 00162000
  163. SPACE 1 00163000
  164. LR R3,R0 GET SPECIFIED LENGTH @VA04199 00164000
  165. CLI EGPR1,X'00' LOOK AT R1'S HIGH-ORDER BYTE @VA04199 00165000
  166. BNE GET IF NOT ZERO THEN THIS IS GETMAIN @VA04199 00166000
  167. SPACE 1 00167000
  168. * FREEMAIN 00168000
  169. BAL R2,ROUNDUP ROUND LENGTH TO A DOUBLEWORD @VA04199 00171000
  170. BZR R14 IF IT'S ZERO, RETURN TO CALLER @VA04199 00172000
  171. TM EGPR1+3,X'07' IS BLOCK ALIGNED ON A DBL WORD? @VA12358 00172300
  172. BNZ ABEND9XX NO - ABEND X'90A' @VA12358 00172600
  173. BAL R10,FREBLK OTHERWISE FREE THE BLOCK @VA04199 00173000
  174. BR R14 RETURN @VA04199 00174000
  175. SPACE 1 00175000
  176. * GETMAIN 00176000
  177. GET BAL R2,ROUNDUP ROUND LENGTH TO A DOUBLEWORD @VA04199 00177000
  178. BZ ABEND8ZZ IF IT'S ZERO, THEN ABEND X'80A' @VA04199 00178000
  179. OI OSSFLAGS,OSSMNU SET "UNCONDITIONAL" FLAG @VA04199 00179000
  180. BAL R10,GETBLK NO - ALLOCATE THE BLOCK, IF POSS.@VA04199 00180000
  181. ST R7,EGPR1 RETURN ITS ADDRESS VIA REGISTER 1@VA04199 00181000
  182. BR 14 RETURN @VA04199 00182000
  183. EJECT 00183000
  184. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00184000
  185. * 00185000
  186. * SVC 5 - FREEMAIN (MODES E AND V) 00186000
  187. * 00187000
  188. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00188000
  189. SPACE 1 00189000
  190. USING *,R12 @VA04199 00190000
  191. DMSSMN5 L R12,=A(DMSSMN) LOAD BASE ADDRESS @VA04199 00191000
  192. USING DMSSMN,R12 ESTABLISH COMMON ADDRESSABILITY @VA04199 00192000
  193. LA R5,5 SAVE SVC NUMBER IN R5 @VA04199 00193000
  194. L R13,CURRSAVE SET BASE REGISTER FOR SSAVE DSECT@VA04199 00194000
  195. SPACE 1 00195000
  196. L R3,0(,R1) GET LENGTH OR V(LENGTH) @VA04199 00196000
  197. LR R2,R1 (TEMPORARILY SAVE R1) @VA04199 00197000
  198. L R1,4(,R1) GET V(ADDRESS AND LENGTH) @VA04199 00198000
  199. TM 8(R2),MODE DETERMINE FREEMAIN MODE @VA04199 00199000
  200. BZ FEMODE "E" MODE @VA04199 00200000
  201. BM ABEND7XX UNRECOGNIZED - ABEND X'705' @VA04199 00201000
  202. SPACE 1 00202000
  203. * V MODE 00203000
  204. L R3,4(,R1) GET LENGTH OF BLOCK TO BE FREED @VA04199 00204000
  205. SPACE 1 00205000
  206. * E MODE (OR V, FROM ABOVE) 00206000
  207. FEMODE EQU * @VA12358 00207500
  208. BAL R2,ROUNDUP ROUND LENGTH TO A DOUBLEWORD @VA04199 00209000
  209. BZR R14 RETURN IF LENGTH IS ZERO @VA04199 00210000
  210. TM 3(R1),X'07' IS BLOCK ALIGNED ON A DBL WORD? @VA12358 00210300
  211. BNZ ABEND9XX IF NOT - ABEND X'905' @VA12358 00210600
  212. L R1,0(,R1) GET ADDRESS OF BLOCK TO BE FREED @VA04199 00211000
  213. BAL R10,FREBLK AND GO FREE IT @VA04199 00212000
  214. BR R14 RETURN @VA04199 00213000
  215. EJECT 00214000
  216. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00215000
  217. * 00216000
  218. * SVC 4 - GETMAIN (MODES EC, EU, VC, VU) 00217000
  219. * 00218000
  220. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00219000
  221. SPACE 1 00220000
  222. USING *,R12 @VA04199 00221000
  223. DMSSMN4 L R12,=A(DMSSMN) LOAD BASE ADDRESS @VA04199 00222000
  224. USING DMSSMN,R12 ESTABLISH COMMON ADDRESSABILITY @VA04199 00223000
  225. LA R5,4 SAVE SVC NUMBER IN R5 @VA04199 00224000
  226. L R13,CURRSAVE SET BASE REGISTER FOR SSAVE DSECT@VA04199 00225000
  227. SPACE 1 00226000
  228. XC EGPR15,EGPR15 CLEAR ERROR RETURN CODE @VA04199 00227000
  229. OI OSSFLAGS,OSSMNU SET "UNCONDITIONAL" FLAG @VA04199 00228000
  230. TM 8(R1),CONDX CONDITIONAL GETMAIN (EC, VC)? @VA04199 00229000
  231. BZ UNCO NO - SKIP @VA04199 00230000
  232. NI OSSFLAGS,X'FF'-OSSMNU YES - RESET THE FLAG @VA04199 00231000
  233. UNCO TM 8(R1),MODE DETERMINE GETMAIN MODE @VA04199 00232000
  234. BO GVMODE "VU"/"VC" MODES @VA04199 00233000
  235. BM ABEND7XX UNRECOGNIZED - ABEND X'704' @VA04199 00234000
  236. SPACE 1 00235000
  237. * EU OR EC MODE 00236000
  238. L R3,0(,R1) GET REQUESTED LENGTH @VA04199 00237000
  239. BAL R2,ROUNDUP AND ROUND IT TO A DOUBLEWORD @VA04199 00238000
  240. BNZ ALLOC CONTINUE IF NOT ZERO @VA14218 00239000
  241. TM 8(R1),CONDX CONDITIONAL GETMAIN ? @VA14218 00239100
  242. BZ ABEND8ZZ NO, ABEND X'804' @VA14218 00239200
  243. MVI EGPR15+3,QUATRE SET RETURN CODE 4 @VA14218 00239300
  244. BR R14 AND RETURN TO CALLER @VA14218 00239400
  245. ALLOC EQU * CONTINUE @VA14218 00239500
  246. BAL R10,GETBLK ALLOCATE THE BLOCK IF POSSIBLE @VA04199 00240000
  247. CLI EGPR15+3,QUATRE WAS A BLOCK FOUND? @VA04199 00241000
  248. BER R14 NO; TELL USER VIA R15 ("EC" ONLY)@VA04199 00242000
  249. L R2,4(,R1) SET ADDRESS OF ALLOCATED BLOCK @VA04199 00243000
  250. ST R7,0(,R2) INTO CALLER'S PARAMETER LIST @VA04199 00244000
  251. BR R14 RETURN @VA04199 00245000
  252. EJECT 00246000
  253. * "VU" OR "VC" MODE GETMAIN 00247000
  254. * NOTE: THIS ROUTINE ALLOCATES THE BLOCK ITSELF - 00248000
  255. * IT DOES NOT CALL "GETBLK" 00249000
  256. GVMODE L R4,0(,R1) GET V(LENGTH LIST) @VA04199 00250000
  257. L R3,0(,R4) GET THE MINIMUM LENGTH REQUESTED @VA04199 00251000
  258. BAL R2,ROUNDUP ROUND IT TO A DOUBLEWORD @VA04199 00252000
  259. LR R0,R3 AND SAVE IT IN R0 @VA04199 00253000
  260. L R3,4(,R4) GET THE MAXIMUM LENGTH REQUESTED @VA04199 00254000
  261. BAL R2,ROUNDUP ROUND IT TO A DOUBLEWORD @VA04199 00255000
  262. BNZ NOTZERO IF MAX LENGTH NOT 0 GO ON @VA14218 00256000
  263. CR R3,R0 ARE MIN AND MAX EQUAL TO 0 ? @VA14218 00256100
  264. BNE ABEND8ZZ NO, ABEND X'804' @VA14218 00256200
  265. L R7,=X'00020000' ADDRESS IS PARTITION START @VA14218 00256300
  266. B SETUSER ...AND PREPARE TO RETURN @VA14218 00256400
  267. NOTZERO EQU * @VA14218 00256500
  268. SPACE 1 00257000
  269. SR R8,R8 ZERO R8 FOR LATER @VA04199 00258000
  270. LA R7,MAINLIST R7 -> V(FIRST FREE BLOCK) @VA04199 00259000
  271. SPACE 1 00260000
  272. NEXTS LR R9,R7 @VA04199 00261000
  273. ICM R7,B'1111',FREPTR(R9) R7 -> NEXT (OR 1ST) FB @VA04199 00262000
  274. BZ MN IF NONE LEFT, TRY HIMAIN @VA04199 00263000
  275. C R0,FRELEN(,R7) COMPARE MIN WITH FREE AREA SIZE @VA04199 00264000
  276. BH NEXTS FREE AREA TOO SMALL, GET NEXT ONE@VA04199 00265000
  277. LR R8,R9 R8 -> LAST BLOCK, FOR LATER @VA04199 00266000
  278. L R0,FRELEN(,R7) SET MIN TO ACTUAL SIZE OF BLOCK @VA04199 00267000
  279. CR R3,R0 COMPARE MAX WITH ACTUAL (NEW MIN)@VA04199 00268000
  280. BH NEXTS MAX STILL > NEW MIN; KEEP LOOKING@VA04199 00269000
  281. SPACE 1 00270000
  282. BAL R10,ALLOCATE MAX <= ACTUAL; GO ALLOCATE IT @VA04199 00271000
  283. B SETUSER RETURN @VA04199 00272000
  284. SPACE 1 00273000
  285. MN L R7,MAINHIGH GET ADDRESS OF AVAILABLE STORAGE @VA04199 00274000
  286. LH R2,FRERESPG GET # OF PAGES TO SAVE FOR CMS @VA04199 00275000
  287. SLL R2,12 CONVERT IT TO # OF BYTES @VA04199 00276000
  288. LA R2,X'800'(,R2) ADD A HALF PAGE (FOR FORTHX !?) @VA04199 00277000
  289. TM OSSFLAGS,COMPSWT CALLED FROM A COMPILER? @VA04911 00278000
  290. BZ GLOBLIBC RESERVE LESS DIRECTORY SPACE @VA10305 00279000
  291. A R2,TOTLIBS ALSO BYTES FROM GLOBALED LIBES @VA04102 00280000
  292. N R2,MASKB ROUND UP @VA04102 00281000
  293. B MNM ALL LIBRARIES ACCOUNTED FOR @VA10305 00281120
  294. GLOBLIBC EQU * @VA10305 00281240
  295. CLC TOTLIBS,TWOPAGES DIRECTORIES EXCEED TWO PAGES? @VA10305 00281360
  296. BL MNM NO, ASSUME SUFFICIENT SPACE @VA10305 00281480
  297. A R2,TOTLIBS YES, ALLOT MORE DIRECTORY SPACE @VA10305 00281600
  298. S R2,TWOPAGES BUT NOT TOO MUCH @VA10305 00281720
  299. N R2,MASKB ROUND UP @VA10305 00281840
  300. MNM L R6,FREELOWE HI END OF AVAILABLE FREE STORAGE @VA04911 00282000
  301. SR R6,R7 MINUS THE LOW END, @VA04199 00283000
  302. SR R6,R2 MINUS AMOUNT TO SAVE FOR CMS, @VA04199 00284000
  303. CR R6,R0 CAN BE USED; COMPARE IT WITH MIN @VA04199 00285000
  304. BNL MNOK >= MIN; GO CHECK AGAINST MAX @VA04199 00286000
  305. LTR R8,R8 < MIN; WAS A PREVIOUS BLOK FOUND?@VA04199 00287000
  306. BZ NOBLOCKV NO - ABEND OR RETURN WITH ERROR @VA04199 00288000
  307. SPACE 1 00289000
  308. * NEW MIN WON'T FIT WITHIN MAINHIGH, BUT SINCE A PREVIOUS 00290000
  309. * FREE BLOCK OF THAT SIZE EXISTS, WE USE IT: 00291000
  310. L R7,FREPTR(,R8) R7 -> BLOCK THAT WAS FOUND BEFORE@VA04199 00292000
  311. MVC FREPTR(4,R8),FREPTR(R7) REMOVE IT FROM CHAIN @VA04199 00293000
  312. LR R3,R0 RESTORE LENGTH FOR USE AT SETUSER@VA04199 00294000
  313. B SETUSER @VA04199 00295000
  314. EJECT 00296000
  315. MNOK CR R6,R3 AVAIL >= MIN; HOW ABOUT MAX? @VA04199 00297000
  316. BNL GETIT AVAIL >= MAX, SO JUST USE MAX @VA04199 00298000
  317. LR R3,R6 < MAX, SO TAKE ALL WE CAN GET @VA04199 00299000
  318. GETIT LR R6,R7 ADDRESS OF ALLOCATED BLOCK, @VA04199 00300000
  319. ALR R6,R3 PLUS ITS LENGTH, @VA04199 00301000
  320. ST R6,MAINHIGH IS MAINHIGH'S NEW VALUE @VA04199 00302000
  321. SPACE 1 00303000
  322. SETUSER L R2,4(,R1) R2 -> WHERE TO PUT ADDRESS,LENGTH@VA04199 00304000
  323. ST R7,0(,R2) SET ADDRESS OF BLOCK, @VA04199 00305000
  324. ST R3,4(,R2) AND ITS LENGTH, IN USER'S AREA @VA04199 00306000
  325. BR R14 RETURN @VA04199 00307000
  326. SPACE 2 00308000
  327. NOBLOCKV EQU * @VA14218 00309000
  328. LTR R0,R0 @VA14218 00309100
  329. BNZ MINNOT0 IF NO BLOCK AND MIN LENGTH @VA14218 00309200
  330. L R7,=X'00020000' ADDRESS PARTITION START @VA14218 00309300
  331. LA R3,0 ...AND 0 LENGTH @VA14218 00309400
  332. B SETUSER ...AND PREPARE TO RETURN @VA14218 00309500
  333. MINNOT0 EQU * @VA14218 00309600
  334. TM OSSFLAGS,OSSMNU UNCONDITIONAL REQUEST ? @VA14218 00309700
  335. BO ABEND8XX YES - THEN ABEND X'804' @VA04199 00310000
  336. MVI EGPR15+3,QUATRE NO - TELL USER VIA R15 @VA04199 00311000
  337. BR R14 RETURN WITH ERROR CODE IN EGPR15 @VA04199 00312000
  338. EJECT 00313000
  339. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00314000
  340. * 00315000
  341. * ALLOCATE A BLOCK OF STORAGE 00316000
  342. * (NOTE: THIS ROUTINE BRANCHES DIRECTLY TO "ABEND8XX" 00317000
  343. * IF AN UNCONDITIONAL REQUEST CANNOT BE SATISFIED) 00318000
  344. * 00319000
  345. * ON ENTRY: R3 = SIZE OF BLOCK DESIRED 00320000
  346. * ON EXIT: R7 -> ALLOCATED BLOCK 00321000
  347. * 00322000
  348. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00323000
  349. SPACE 1 00324000
  350. GETBLK LA R7,MAINLIST R7 -> V(FIRST FREE BLOCK) @VA04199 00325000
  351. SPACE 1 00326000
  352. NEXTG LR R9,R7 @VA04199 00327000
  353. ICM R7,B'1111',FREPTR(R9) R7 -> NEXT (OR 1ST) FB @VA04199 00328000
  354. BZ CKHIMAIN IF NONE LEFT, TRY HIMAIN @VA04199 00329000
  355. C R3,FRELEN(,R7) TEST SIZE OF FREE AREA @VA04199 00330000
  356. BH NEXTG IF NOT BIG ENOUGH GET NEXT BLOCK @VA04199 00331000
  357. SPACE 1 00332000
  358. * NOTE: "VU"/"VC" GETMAIN MAY ENTER HERE (R7, R9 OK): 00333000
  359. ALLOCATE BE DESBLK IF WHOLE AREA USED, DESTROY BLOCK@VA04199 00334000
  360. SPACE 1 00335000
  361. * REQUESTED LENGTH IS SHORTER THAN THIS BLOCK, 00336000
  362. * SO LEAVE LEFTOVER PART IN THE CHAIN: 00337000
  363. LR R6,R7 ADDRESS OF BLOCK, @VA04199 00338000
  364. ALR R6,R3 PLUS REQUESTED LENGTH, @VA04199 00339000
  365. ST R6,FREPTR(,R9) EQUALS ADDRESS OF LEFTOVER @VA04199 00340000
  366. MVC FREPTR(4,R6),FREPTR(R7) SET LEFTOVER'S POINTER @VA04199 00341000
  367. L R8,FRELEN(,R7) OLD LENGTH OF THIS BLOCK, @VA04199 00342000
  368. SLR R8,R3 MINUS REQUESTED LENGTH, @VA04199 00343000
  369. ST R8,FRELEN(,R6) EQUALS NEW LENGTH OF LEFTOVER @VA04199 00344000
  370. XC EGPR15,EGPR15 SET RETURN CODE @VA11172 00344100
  371. BR R10 RETURN @VA04199 00345000
  372. SPACE 1 00346000
  373. * LENGTH OF THIS BLOCK = REQUESTED LENGTH, 00347000
  374. * SO REMOVE THE WHOLE BLOCK FROM THE CHAIN: 00348000
  375. DESBLK MVC FREPTR(4,R9),FREPTR(R7) @VA04199 00349000
  376. BR R10 RETURN @VA04199 00350000
  377. SPACE 1 00351000
  378. CKHIMAIN L R7,MAINHIGH GET ADDRESS OF AVAILABLE STORAGE @VA04199 00352000
  379. LH R2,FRERESPG GET # OF PAGES TO SAVE FOR CMS @VA04199 00353000
  380. SLL R2,12 CONVERT IT TO # OF BYTES @VA04199 00354000
  381. TM OSSFLAGS,COMPSWT CALLED FROM A COMPILER? @VA04911 00355000
  382. BZ GLOBLIBU RESERVE LESS DIRECTORY SPACE @VA10305 00356000
  383. A R2,TOTLIBS ALSO BYTE COUNT FROM GLOBALED @VA04102 00357000
  384. N R2,MASKB ROUND UP @VA04102 00358000
  385. B CKM ALL LIBRARIES ACCOUNTED FOR @VA10305 00358120
  386. GLOBLIBU EQU * @VA10305 00358240
  387. CLC TOTLIBS,TWOPAGES DIRECTORIES EXCEED TWO PAGES? @VA10305 00358360
  388. BL CKM NO, ASSUME SUFFICIENT SPACE @VA10305 00358480
  389. A R2,TOTLIBS YES, ALLOT MORE DIRECTORY SPACE @VA10305 00358600
  390. S R2,TWOPAGES BUT NOT TOO MUCH @VA10305 00358720
  391. N R2,MASKB ROUND UP @VA10305 00358840
  392. CKM L R6,FREELOWE HI END OF AVAILABLE FREE STORAGE @VA04911 00359000
  393. SR R6,R7 MINUS THE LOW END, @VA04199 00360000
  394. SR R6,R2 MINUS AMOUNT TO SAVE FOR CMS, @VA04199 00361000
  395. CR R6,R3 CAN BE USED; COMPARE IT WITH MIN @VA04199 00362000
  396. BL NOBLOCK IF NOT ENOUGH, SET ERROR RETURN @VA04199 00363000
  397. LR R6,R7 ADDRESS OF ALLOCATED BLOCK, @VA04199 00364000
  398. ALR R6,R3 PLUS ITS LENGTH, @VA04199 00365000
  399. ST R6,MAINHIGH IS MAINHIGH'S NEW VALUE @VA04199 00366000
  400. XC EGPR15,EGPR15 SET RETURN CODE @VA11172 00366100
  401. BR R10 RETURN @VA04199 00367000
  402. SPACE 1 00368000
  403. NOBLOCK TM OSSFLAGS,OSSMNU UNCONDITIONAL GETMAIN? @VA04199 00369000
  404. BO ABEND8XX ABEND IF SO (X'804' OR X'80A') @VA04199 00370000
  405. MVI EGPR15+3,QUATRE IF NOT, INFORM USER VIA R15 @VA04199 00371000
  406. BR R10 RETURN @VA04199 00372000
  407. EJECT 00373000
  408. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00374000
  409. * 00375000
  410. * RETURN A FREED BLOCK ("FB") TO THE CHAIN OF 00376000
  411. * AVAILABLE FREE BLOCKS ("AFB") 00377000
  412. * 00378000
  413. * ON ENTRY: R1 -> FREED BLOCK 00379000
  414. * R3 = LENGTH OF FREED BLOCK 00380000
  415. * 00381000
  416. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00382000
  417. SPACE 1 00383000
  418. FREBLK LA R1,0(,R1) CLEAR R1'S HIGH-ORDER BYTE @VA04199 00384000
  419. C R1,MAINSTRT IS V(FB) < START OF GETMAIN AREA?@VA04199 00385000
  420. BL ABENDAXX ABEND IF SO (X'A05' OR X'A0A') @VA04199 00386000
  421. LA R8,MAINLIST R8 -> V(FIRST AFB) @VA04199 00387000
  422. SPACE 1 00388000
  423. NEXTF LR R9,R8 @VA04199 00389000
  424. ICM R8,B'1111',FREPTR(R9) R8 -> NEXT (OR 1ST) AFB@VA04199 00390000
  425. BZ CKMAIN NO MORE AFB'S - GO CHECK HIMAIN @VA04199 00391000
  426. CR R8,R1 IS AFB > FB ? @VA04199 00392000
  427. BH FRABVE YES, FB MUST BE INSERTED IN CHAIN@VA04199 00393000
  428. LR R6,R8 @VA04199 00394000
  429. AL R6,FRELEN(,R8) R6 -> END OF AFB @VA04199 00395000
  430. CR R1,R6 DOES FB OVERLAP THIS AFB? @VA04199 00396000
  431. BL ABENDAXX YES - ABEND X'A05' OR X'A0A' @VA04199 00397000
  432. BH NEXTF NOWHERE NEAR - TRY AGAIN @VA04199 00398000
  433. SPACE 1 00399000
  434. * THE FB IS CONTIGUOUS WITH THE END OF THE AFB, 00400000
  435. * SO WE JUST MERGE THEM INTO ONE AFB: 00401000
  436. L R7,FRELEN(,R8) GET LENGTH OF AFB, @VA04199 00402000
  437. ALR R7,R3 PLUS LENGTH OF FB @VA04199 00403000
  438. LR R6,R7 @VA04199 00404000
  439. ALR R6,R8 R6 -> END OF MERGED BLOCK @VA04199 00405000
  440. ICM R2,B'1111',FREPTR(R8) IS THERE ANOTHER AFB? @VA04199 00406000
  441. BNZ CKOVRLAP YES - GO SEE IF FB OVERLAPS IT @VA04199 00407000
  442. C R6,MAINHIGH NO; DOES IT OVERLAP MAINHIGH? @VA04199 00408000
  443. BL KPBLK NO - IT'S WITHIN MAINHIGH @VA04199 00409000
  444. BH ABENDAXX YES - ABEND X'A05' OR X'A0A' @VA04199 00410000
  445. ST R8,MAINHIGH JUST RESET MAINHIGH; THE FB @VA04199*00411000
  446. WAS CONTIGUOUS TO IT @VA04199 00412000
  447. SR 15,15 THE LAST AFB IS NOW AT @VA04199 00413000
  448. ST R15,FREPTR(,R9) THE END OF THE CHAIN @VA04199 00414000
  449. BR 10 RETURN @VA04199 00415000
  450. SPACE 1 00416000
  451. CKOVRLAP CR R6,R2 DOES FB OVERLAP THE NEXT AFB? @VA04199 00417000
  452. BH ABENDAXX ABEND IF SO (X'A05' OR X'A0A') @VA04199 00418000
  453. BL KPBLK NO - THERE'S A GAP @VA04199 00419000
  454. SPACE 1 00420000
  455. * THE NEXT AFB IS CONTIGUOUS WITH THE END OF THE FB, 00421000
  456. * SO WE MERGE THAT IN, TOO: 00422000
  457. MVC FREPTR(4,R8),FREPTR(R2) @VA04199 00423000
  458. AL R7,FRELEN(,R2) ADD ITS LENGTH TO OUR TOTAL @VA04199 00424000
  459. SPACE 1 00425000
  460. KPBLK ST R7,FRELEN(,R8) SET THE LENGTH OF THE NEW AFB @VA04199 00426000
  461. BR 10 RETURN @VA04199 00427000
  462. EJECT 00428000
  463. CKMAIN LR R7,R1 @VA04199 00429000
  464. ALR R7,R3 R7 -> END OF FB @VA04199 00430000
  465. C R7,MAINHIGH DOES THE FB OVERLAP MAINHIGH? @VA04199 00431000
  466. BL ADDBLK NO - IT'S WITHIN MAINHIGH @VA04199 00432000
  467. BH ABENDAXX YES - ABEND X'A05' OR X'A0A' @VA04199 00433000
  468. ST R1,MAINHIGH JUST RESET MAINHIGH; THE FB @VA04199*00434000
  469. WAS CONTIGUOUS TO IT @VA04199 00435000
  470. BR 10 RETURN @VA04199 00436000
  471. SPACE 1 00437000
  472. * THE FB MUST BE INSERTED BETWEEN TWO AFB'S IN THE CHAIN, 00438000
  473. * OR POSSIBLY AT THE BEGINNING OF THE CHAIN: 00439000
  474. FRABVE LR R6,R1 @VA04199 00440000
  475. ALR R6,R3 R6 -> END OF THE FB @VA04199 00441000
  476. CR R6,R8 DOES THE FB OVERLAP THE NEXT AFB?@VA04199 00442000
  477. BL ADDBLK NO - GO INSERT IT AS A NEW AFB @VA04199 00443000
  478. BH ABENDAXX YES - ABEND X'A05' OR X'A0A' @VA04199 00444000
  479. SPACE 1 00445000
  480. * THE NEXT AFB IS CONTIGUOUS WITH THE END OF THE FB, 00446000
  481. * SO WE MERGE THEM TOGETHER: 00447000
  482. ST R1,FREPTR(,R9) LAST AFB -> THIS (NEW) AFB @VA04199 00448000
  483. AL R3,FRELEN(,R8) TOTAL LENGTH = L'FB + L'AFB @VA04199 00449000
  484. ST R3,FRELEN(,R1) SET THE PROPER LENGTH AND @VA04199 00450000
  485. MVC FREPTR(4,R1),FREPTR(R8) ADDRESS FOR NEW AFB @VA04199 00451000
  486. BR 10 RETURN @VA04199 00452000
  487. SPACE 1 00453000
  488. * THE FB IS NOT CONTIGUOUS TO ANYTHING, 00454000
  489. * SO WE MAKE A NEW AFB OUT OF IT: 00455000
  490. ADDBLK ST R1,FREPTR(,R9) LAST AFB -> THIS NEW AFB @VA04199 00456000
  491. ST R8,FREPTR(,R1) THIS NEW AFB -> NEXT AFB @VA04199 00457000
  492. ST R3,FRELEN(,R1) WE MUSTN'T FORGET OUR SIZE @VA04199 00458000
  493. BR 10 RETURN @VA04199 00459000
  494. EJECT 00460000
  495. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00461000
  496. * 00462000
  497. * SUBROUTINE TO ROUND THE VALUE IN REGISTER 3 00463000
  498. * TO A DOUBLEWORD 00464000
  499. * 00465000
  500. * MAXIMUM FREE-BLOCK SIZE (MAXBLK) FOR A 16-MEGABYTE 00465100
  501. * SYSTEM IS EQUAL TO VMSIZE LESS: 00465200
  502. * 00465300
  503. * 276K RESERVED FOR CMS SYSTEM FREE STORAGE USE, 00465400
  504. * 128K FOR THE CMS NUCLEUS, AND 00465500
  505. * 12K FOR LOADER TABLES. 00465600
  506. * 00465700
  507. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00466000
  508. SPACE 1 00467000
  509. ROUNDUP LA R3,0(,R3) CLEAR ANY HIGH-ORDER BYTE @VA04199 00468000
  510. C R3,MAXBLK GREATER THAN MAXIMUM POSSIBLE? @VA04199 00469000
  511. BL ADD7 NO; SKIP @VA04199 00470000
  512. L R3,MAXBLK YES; THEN RESET IT TO MAXIMUM @VA04199 00471000
  513. ADD7 LA R3,7(,R3) @VA04199 00472000
  514. N R3,MASKB ROUND IT OFF (SETTING COND CODE) @VA04199 00473000
  515. BR R2 RETURN @VA04199 00474000
  516. EJECT 00475000
  517. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00476000
  518. * 00477000
  519. * ABENDS FOR GETMAIN AND FREEMAIN 00478000
  520. * 00479000
  521. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00480000
  522. SPACE 1 00481000
  523. ABEND7XX LA R5,X'700'(,R5) UNSUPPORTED GETMAIN/FREEMAIN @VA04199 00482000
  524. B MSG1 OPTION @VA04199 00483000
  525. SPACE 1 00484000
  526. ABEND8ZZ LA R5,X'800'(,R5) REQUESTED GETMAIN LENGTH = 0 @VA04199 00485000
  527. B MSG1 @VA04199 00486000
  528. SPACE 1 00487000
  529. ABEND9XX LA R5,X'900'(,R5) BLOCK TO BE FREED IS NOT @VA04199 00488000
  530. B MSG1 ON A DOUBLEWORD BOUNDARY @VA04199 00489000
  531. SPACE 1 00490000
  532. ABENDAXX LA R5,X'A00'(,R5) BLOCK TO BE FREED OVERLAPS @VA04199*00491000
  533. AN EXISTING FREE AREA @VA04199 00492000
  534. SPACE 1 00493000
  535. MSG1 DMSERR TEXT='INVALID GETMAIN OR FREEMAIN SPECIFICATION', @VA04199*00494000
  536. NUM=133,LET=S @VA04199 00495000
  537. B ABEND @VA04199 00496000
  538. SPACE 1 00497000
  539. ABEND8XX LA R5,X'800'(,R5) REQUESTED GETMAIN LENGTH @VA04199*00498000
  540. IS GREATER THAN AVAILABLE @VA04199 00499000
  541. SPACE 1 00500000
  542. DMSERR TEXT='VIRTUAL STORAGE CAPACITY EXCEEDED', @VA04199*00501000
  543. NUM=109,LET=S @VA04199 00502000
  544. SPACE 1 00503000
  545. ABEND ABEND (R5) @VA04199 00504000
  546. EJECT 00505000
  547. * EACH BLOCK OF FREE STORAGE CONTAINS, IN ITS FIRST TWO 00506000
  548. * WORDS, A POINTER TO THE NEXT FREE BLOCK IN THE CHAIN, 00507000
  549. * AND ITS OWN LENGTH IN BYTES: 00508000
  550. FREPTR EQU 0 DISPLACEMENT FOR THE POINTER @VA04199 00509000
  551. FRELEN EQU 4 DISPLACEMENT FOR THE LENGTH @VA04199 00510000
  552. SPACE 1 00511000
  553. * GETMAIN/FREEMAIN MODE BITS: 00512000
  554. MODE EQU X'C0' ("E" = X'00', "V" = X'C0') @VA04199 00513000
  555. CONDX EQU X'20' CONDITIONAL GETMAIN ("EC", "VC") @VA04199 00514000
  556. SPACE 1 00515000
  557. QUATRE EQU 4 RET. CODE IF COND. GETMAIN FAILS @VA04199 00516000
  558. SPACE 1 00517000
  559. DS 0F @VA04199 00518000
  560. MASKB DC X'00FFFFF8' MASK FOR ROUNDING TO A DOUBLEWORD@VA04199 00519000
  561. MAXBLK DC X'00F98000' MAXIMUM POSSIBLE FREE BLOCK SIZE @VA07758 00520000
  562. TWOPAGES DC F'8192' X'1000' PER PAGE @VA10305 00520500
  563. EJECT 00521000
  564. ********************************************************************* 00522000
  565. * 00523000
  566. * 'STORAGE HANDLER INITIALIZATION' 00524000
  567. * ******************************* 00525000
  568. * BEFORE ISSUING ANY 'GETMAIN /FREEMAIN',AVAILABLE CORE SHOULD BE 00526000
  569. * FREED.( VIA A CALL TO 'STRINIT'. 00527000
  570. * 00528000
  571. ***IF THE ROUTINE CALLING 'STRINIT' IS NUCLEUS RESIDENT, 00529000
  572. * L 15,ASTRINIT 00530000
  573. * BALR 14,15 00531000
  574. * 00532000
  575. ***IF THE ROUTINE IS NOT NUCLEUS RESIDENT THE MACRO INSTRUCTION 00533000
  576. * 'CMSYSREF' SHOULD APPEAR, AND THE CALL COULD BE 00534000
  577. * L 15,ASTRINIT 00535000
  578. * BALR 14,15 00536000
  579. * 00537000
  580. ********************************************************************* 00538000
  581. * 00539000
  582. DMSSMNSB DS 0H CMS STORAGE INITIALIZATION 00540000
  583. USING NUCON,R0 00541000
  584. USING *,R15 00542000
  585. STM R0,R15,BALRSAVE SAVE THE CALLER'S REGISTERS 00543000
  586. L R12,=A(DMSSMN) LOAD BASE ADDRESS @VA04199 00544000
  587. DROP R15 00545000
  588. USING DMSSMN,R12 00546000
  589. SR R0,R0 ZERO GETMAIN STORAGE POINTER 00547000
  590. ST R0,MAINLIST ... 00548000
  591. L R1,LOCCNT GET THE CURRENT LOCATION COUNTER 00549000
  592. LA R1,7(,R1) ROUND UP TO NEXT DOUBLE WORD BOUNDARY 00550000
  593. N R1,MASKB ... 00551000
  594. C R1,AUSRAREA MUST BE >= START OF USER AREA @VM03182 00552000
  595. BNL STRESET OK, IF SO @VM03182 00553000
  596. L R1,AUSRAREA ELSE, FORCE TO USER AREA START @VM03182 00554000
  597. SPACE 1 00555000
  598. STRESET ST R1,MAINSTRT INITIALIZE THE START AND @VM03182 00556000
  599. ST R1,MAINHIGH END OF MAIN STORAGE AREA 00557000
  600. L R1,ABGCOM POINT TO BGCOM AREA @V305032 00558000
  601. USING BGCOM,R1 REFERENCE SAME BRIEFLY @V305032 00559000
  602. ST R0,PPEND (R0 IS STILL 0) CLEAR 'PPEND' @V305032 00560000
  603. ST R0,EOCADR AND 'EOCADR' IN COMM. REGIOM @V305032 00561000
  604. DROP R1 THEN ... @V305032 00562000
  605. LM R0,R14,BALRSAVE RESTORE THE CALLER'S REGISTERS 00563000
  606. SR R15,R15 ZERO THE RETURN CODE 00564000
  607. BR R14 RETURN TO THE CALLER 00565000
  608. LTORG 00566000
  609. EJECT 00567000
  610. SVCSECT 00568000
  611. SVCSAVE 00569000
  612. NUCON 00570000
  613. BGCOM @V305032 00571000
  614. SYSCOM @V305101 00572000
  615. ANCHTAB @V305032 00573000
  616. PGMSECT 00574000
  617. EXTSECT P3036 00575000
  618. PDSSECT 00576000
  619. REGEQU 00577000
  620. END 00578000
ibm/vm370-lib/cms/dmssmn.assemble_src.txt ยท Last modified: 2023/08/06 13:35 by Site Administrator