Table of Contents

DMKTMR Source

References

Source Listing

DMKTMR.ASSEMBLE.txt
  1. TMR TITLE 'DMKTMR (CP) VM/370 - RELEASE 6' 00001000
  2. ISEQ 73,80 00002000
  3. COPY OPTIONS 00003000
  4. COPY LOCAL OPTIONS @V306638 00004000
  5. EJECT 00005000
  6. *. 00006000
  7. * 00007000
  8. * MODULE NAME - 00008000
  9. * 00009000
  10. * DMKTMR 00010000
  11. * 00011000
  12. * FUNCTION - 00012000
  13. * 00013000
  14. * TO SIMULATE THE CPU TIMER AND TIME OF DAY CLOCK COMPARATOR 00014000
  15. * INSTRUCTIONS FOR VIRTUAL SYSTEM 370'S OPERATING IN EXTENDED 00015000
  16. * CONTROL MODE 00016000
  17. * 00017000
  18. * ATTRIBUTES - 00018000
  19. * 00019000
  20. * REENTRANT, RESIDENT, ENTERED VIA GOTO FROM DMKPRV 00020000
  21. * 00021000
  22. * ENTRY POINTS - 00022000
  23. * 00023000
  24. * DMKTMRTN - SIMULATE TIMER INSTRUCTION 00024000
  25. * DMKTMRCK - SIMULATE VIRTUAL CLOCK COMPARATOR INTERRUPT 00025000
  26. * DMKTMRVT - SIMULATE VIRTUAL CPU TIMER INTERRUPTS 00026000
  27. * DMKTMRPT - CALCULATE USER'S TOTAL VIRTUAL PROBLEM TIME 00027000
  28. * DMKTMRSN - ENTRY TO UPDATE TOTAL VMTTIME USED BY PROCESSORS 00027100
  29. * 00028000
  30. * ENTRY CONDITIONS - 00029000
  31. * 00030000
  32. * GPR11 = ADDRESS OF USER'S VMBLOK 00031000
  33. * GPR12 = ADDRESS OF DMKTMR 00032000
  34. * GPR15 = ADDRESS OF DMKTMRPT (ONLY ON CALLS TO DMKTMRPT) 00033000
  35. * 00034000
  36. * THE FIELD VMINST CONTAINS THE INSTRUCTION TO BE SIMULATED 00035000
  37. * 00036000
  38. * EXIT CONDITIONS - 00037000
  39. * 00038000
  40. * NORMAL - 00039000
  41. * THE REQUESTED INSTRUCTION IS SIMULATED, ANY DATA REQUESTED BY 00040000
  42. * STORE INSTRUCTIONS IS MOVED TO THE USER MEMORY, AND THE PROPER 00041000
  43. * PENDING INTERRUPT STATUS IS POSTED IN THE VMBLOK 00042000
  44. * 00043000
  45. * ERROR - 00044000
  46. * IF OPERATION, ADDRESSING, SPECIFICATION OR PROTECTION VIOLA- 00045000
  47. * TIONS ARE DETECTED IN THE COURSE OF THE SIMULATION, THE 00046000
  48. * APPROPRIATE INTERRUPT CODE IS SET AND A PROGRAM INTERRUPT 00047000
  49. * IS REFLECTED TO THE USER VIA A GOTO TO DMKPRGSM 00048000
  50. * 00049000
  51. * FOR CALLS TO DMKTMRPT ON EXIT GPR 0-1 CONTAINS THE USER'S 00050000
  52. * TOTAL VIRTUAL PROBLEM TIME USED. 00051000
  53. * 00052000
  54. * CALLS TO OTHER ROUTINES - 00053000
  55. * 00054000
  56. * DMKPTRAN - TO LOCATE THE USER'S DATA AREA IN HIS VIRTUAL 00055000
  57. * MEMORY 00056000
  58. * DMKPSAFP - TO CHECK FOR FETCH PROTECTION 00057000
  59. * DMKPSASP - TO CHECK FOR STORAGE PROTECTION 00058000
  60. * INSTRUCTIONS 00059000
  61. * DMKSCHST - TO ESTABLISH A TOD COMPARATOR INTERRUPT REQUEST 00060000
  62. * DMKSCHRT - TO RESET A TOD COMPARATOR INTERRUPT REQUEST 00061000
  63. * DMKSTKIO - TO STACK A PENDING CLOCK COMPARATOR INTERRUPT 00062000
  64. * DMKDSPCH - EXIT VIA GOTO IF INTERRUPT IS PENDING 00063000
  65. * DMKPRGSM - EXIT VIA GOTO TO REFLECT A PROGRAM INTERRUPT 00064000
  66. * DMKSTKDE - TO STACK A DEFERRED USER TASK 00064100
  67. * DMKDSPRU - TO RUN USERS WITHOUT SYSTEM LOCK 00064200
  68. * 00065000
  69. * EXTERNAL REFERENCES - 00066000
  70. * 00067000
  71. * DMKSCHN1 - ADDRESS OF QUEUE 1 TIME INTERVAL 00068000
  72. * DMKSCHN2 - ADDRESS OF QUEUE 2 TIME INTERVAL 00069000
  73. * DMKLOKSY - SYSTEM LOCK WORD 00069100
  74. * 00070000
  75. * TABLES/WORKAREAS - 00071000
  76. * 00072000
  77. * TRQBLOK 00073000
  78. * 00074000
  79. * REGISTER USAGE - 00075000
  80. * 00076000
  81. * GPR0 - SCRATCH 00077000
  82. * GPR1 - VIRTUAL ADDRESS OF USER'S DATA AREA, TRQBLOK BASE 00078000
  83. * GPR2 - REAL ADDRESS OF USER'S DATA AREA 00079000
  84. * GPR3 - ADDRESS OF PROG. INT. ILC/CODE FIELD 00080000
  85. * GPR4-7 DOUBLE PRECISION TIMER ARITHMETIC 00081000
  86. * GPR8 - ECBLOK BASE 00082000
  87. * GPR9-10 UNUSED 00083000
  88. * GPR11 - VMBLOK BASE 00084000
  89. * GPR12 - DMKTMR BASE 00085000
  90. * GPR13 - INTERNAL LINKAGE 00086100
  91. * GPR14-15 EXTERNAL LINKAGE 00087000
  92. * 00088000
  93. * NOTES - 00089000
  94. * 00090000
  95. * NONE 00091000
  96. *. 00092000
  97. EJECT 00093000
  98. DMKTMR CSECT 00094000
  99. SPACE 3 00095000
  100. EXTRN DMKPSAFP CHECK FOR FETCH PROTECTION @V202232 00096000
  101. EXTRN DMKPSASP CHECK FOR STORAGE PROTECTION @V202232 00097000
  102. EXTRN DMKSCHST 00098000
  103. EXTRN DMKSCHRT 00099000
  104. EXTRN DMKPRGSM 00100000
  105. EXTRN DMKDSPA @VA04340 00100100
  106. EXTRN DMKSTKIO 00101000
  107. EXTRN DMKVATRN 00102000
  108. EXTRN DMKVATEX 00103000
  109. EXTRN DMKCVTAB @VA04301 00103100
  110. EXTRN DMKSTKDE @V407577 00103200
  111. AIF (NOT &AP).DSPRU4 00103280
  112. EXTRN DMKDSPRU @V407577 00103300
  113. EXTRN DMKLOKSY @V4M0016 00103310
  114. .DSPRU4 ANOP 00103320
  115. SPACE 00104000
  116. ENTRY DMKTMRTN 00105000
  117. ENTRY DMKTMRCK 00106000
  118. ENTRY DMKTMRVT 00107000
  119. ENTRY DMKTMRCC INTERNAL SYM. 'SCKC'(FOR EVMA) @V386198 00107300
  120. ENTRY DMKTMRSP INTERNAL SYM. 'SPT' " " @V386198 00107600
  121. ENTRY DMKTMRSN @V4M0203 00107700
  122. SPACE 2 00108000
  123. USING PSA,R0 00109000
  124. USING TRQBLOK,R1 00110000
  125. USING ECBLOK,R8 00111000
  126. USING VMBLOK,R11 00112000
  127. USING DMKTMRTN,R12 00113000
  128. EJECT 00114000
  129. *. 00115000
  130. * 00116000
  131. * OPERATION - 00117000
  132. * 00118000
  133. * SECTION A. - INITIALIZATION 00119000
  134. * 00120000
  135. * 1. IF THE OPERATION IS SCK, SKIP TO STEP 3; OTHERWISE, CON- 00121000
  136. * TINUE 00122000
  137. * 2. IF THE USER IS NOT IN EXTENDED PSW MODE, REFLECT AN OPER- 00123000
  138. * ATION EXCEPTION 00124000
  139. * 3. GET THE ADDRESS SPECIFIED IN THE INSTRUCTION; IF IT IS NOT 00125000
  140. * DOUBLE WORD ALIGNED, REFLECT A SPECIFICATION EXCEPTION 00126000
  141. * 4. TRANS FOR USER DATA PAGE; IF THE RESULTING CONDITION CODE 00127000
  142. * INDICATES A VIRTUAL ADDRESSING ERROR, REFLECT IT 00128000
  143. * 5. IF THE INSTRUCTION IS NOT A STORE (2ND OPCODE BYTE IS NOT 00129000
  144. * ODD), SKIP TO STEP 7; OTHERWISE, CONTINUE 00130000
  145. * 6. COMPARE THE VIRTUAL PSW KEY TO THE STORAGE KEY IN THE 00131000
  146. * USER'S PAGE; IF THEY DO NOT AGREE AND IF THE PSW KEY 00132000
  147. * IS NON-ZERO, REFLECT A PROTECTION EXCEPTION 00133000
  148. * 7. GET THE 2ND OPCODE BYTE AND BRANCH TO HANDLE THE REQUESTED 00134000
  149. * INSTRUCTION AS DESCRIBED IN SECTIONS B THROUGH F BELOW 00134200
  150. * 00134400
  151. * 00134600
  152. *********************************************************************** 00134800
  153. * 00135000
  154. * 00135200
  155. * EXPANDED VMA PARTIAL EMULATION FUNCTION FOR SCKC AND SPT: 00135400
  156. * 00135600
  157. * INVOKED BY THESE INSTRUCTIONS WHEN EXECUTED IN PROBLEM STATE 00135800
  158. * WITH CONTROL REGISTER 6 BYTE 0 SET TO B'10X0XX1X' (X = 0 OR 1) 00136000
  159. * AND BIT 2 OF THE ASSIST CONTROLS FULLWORD (OFFSET X'14' INTO 00136020
  160. * MICBLOK) SET TO 1. 00136040
  161. * 00136200
  162. * REGISTER INPUT: 00136400
  163. * CR 6 = BITS 0-7 ARE THE ASSIST FLAGS; BITS 8-28 ADDRESS 00136600
  164. * THE MICBLOK (THE VIRTUAL MACHINE POINTER LIST) 00136800
  165. * 00137000
  166. * SYSTEM DATA AREAS REFERENCED (BY MODULE WHERE APPLICABLE): 00137200
  167. * DMKPRV - 'DMKPRVMA' (EQUALS 'VMALIST') 00137400
  168. * DMKPSA - 'AVMALIST', 'PRNPSW', CPCREGS, TIMER FIELDS, 00137600
  169. * TRACING INFORMATION, 'CPSTATUS', 'PROPSW' 00137800
  170. * MICBLOK, VMBLOK 00138000
  171. * 00138200
  172. * 00138400
  173. * EXIT TO 'DMKTMRCC' (IF SCKC) OR 'DMKTMRSP' (IF SPT) 00138600
  174. * NOTE: THE CONTENT OF ANY UNSPECIFIED GPR IS UNPREDICTABLE. 00138800
  175. * REGISTER OUTPUT: 00139000
  176. * CR 0 = VALUE FROM 'CPCREG0' 00139200
  177. * CR 8 = VALUE FROM 'CPCREG8' 00139400
  178. * GPR 2 = REAL ADDRESS THAT MAPS OP. 2'S VIRTUAL ADDRESS 00139600
  179. * GPR 8 = VALUE FROM 'MICCREG0' (ECBLOK ADDRESS) 00139800
  180. * GPR 11 = X'A8' LESS THAN 'MICVPSW' (ADDRESS OF VMBLOK) 00140000
  181. * GPR 12 = ADDRESS OF 'DMKTMR' 00140200
  182. * 00140400
  183. *********************************************************************** 00140600
  184. *. 00140800
  185. EJECT 00141000
  186. DMKTMRTN EQU * %V3M4038 00141200
  187. CLI VMINST+1,X'04' SCK INSTRUCTION ?? %V3M4038 00141400
  188. BE GETADDR THIS OP ALLOWED FOR BC MODE VM. %V3M4038 00141600
  189. TM VMPSTAT,VMV370R FOR OTHERS MUST HAVE EC MODE %V3M4038 00141800
  190. BO GETADDR THIS GUY IS OK %V3M4038 00142000
  191. LA R0,1 SET OPERATION EXCEPTION 00143000
  192. GOTO DMKPRGSM AND GO REFLECT PROGRAM INTERRUPT 00144000
  193. SPACE 00145000
  194. GETADDR EQU * BUILD VIRTUAL ADDRESS OF OPERAND %V3M4038 00146000
  195. LH R7,VMINST+2 GET %V3M4038 00147000
  196. N R7,F4095 DISPLACEMENT %V3M4038 00148000
  197. IC R8,VMINST+2 GET %V3M4038 00149000
  198. SRL R8,2 BASE %V3M4038 00150000
  199. N R8,F60 REGISTER (F60 = X'3C' FOR MASK) %V3M4038 00151000
  200. BZ NOBASE IF ZERO, SKIP %V3M4038 00152000
  201. L R8,VMGPRS(R8) GET CONTENTS OF BASE REGISTER %V3M4038 00153000
  202. NOBASE LA R7,0(R8,R7) GET ADDRESS -- %V3M4038 00154000
  203. EX R7,TESTALIN TEST FOR DOUBLE WORD ALIGNMENT %V3M4038 00155000
  204. BZ CKADDR BRANCH IF OK TO TEST ADDRESS, %V3M4038 00156000
  205. LA R0,6 OTHERWISE, REFLECT SPECIFICATION 00157000
  206. GOTO DMKPRGSM EXCEPTION 00158000
  207. SPACE 00159000
  208. CKADDR EQU * CHECK OUT ADDRESS %V3M4038 00160000
  209. TM VMESTAT,VMEXTCM IN EC MODE NOW ? %V3M4038 00161000
  210. BZ LEVEL2 NO - GET 2ND LEVEL MEMORY %V3M4038 00162000
  211. TM VMPSW,TRANMODE IN VIRTUAL TRANSLATE MODE ? %V3M4038 00163000
  212. BO LEVEL3 YES - GET 3RD LEVEL MEMORY %V3M4038 00164000
  213. LEVEL2 EQU * %V3M4038 00165000
  214. LCTL C1,C1,VMSEG GET SEGMENT TABLE ORIGIN %V407577 00165100
  215. LRA R2,0(,R7) DO HARDWARE TRANSLATE %V407577 00165200
  216. BC 8,CKSTORE PAGE IS RESIDENT %V407577 00165300
  217. BAL R13,CKDEFER GO CHECK THE SYSTEM LOCK @V407577 00165400
  218. TRANS 2,7,OPT=(BRING,DEFER),ADEX=BADDR @V3M4038 00166000
  219. CKSTORE EQU * JOINED HERE AFTER CALL TO DMKVAT %V3M4038 00167000
  220. TM VMINST+1,1 IS IT A STORE OPERATION ? %V3M4038 00168000
  221. BZ CHKFETCH NO, TEST FOR FETCH PROT. CHECK %V3M4038 00169000
  222. CALL DMKPSASP YES, TEST FOR STORE PROT. CHECK @VA07223 00170000
  223. BNZ KEYUNEQ UNEQUAL, REFLECT PROT. VIOLATION @VA07223 00171000
  224. * 00172000
  225. * TEST FOR SIMULATED PER INTERRUPTS ON STORE TYPE INSTRUCTIONS 00173000
  226. * 00174000
  227. TM VMESTAT,VMPERCM VM ALLOWING PER INTERRUPTS @VA07223 00175000
  228. BZ GETCODE NO - PROCESS INSTRUCTION @VA07223 00176000
  229. TM VMTRCTL,VMTRPER CP PER? PER001 00176100
  230. BZ CHKUSPER NO, USER PER, GO CHECK IT OUT PER001 00176200
  231. L R10,VMPERCTL EXTENSION BLOCK IF TRACING PER.. PER001 00176300
  232. USING PERBLOK,R10 PER001 00176400
  233. LA R15,PERCR9 START OF CR9, CR10, CR11 PER001 00176500
  234. LA R14,PERADDR START OF PERADD, PERCODE PER001 00176600
  235. B TRAPPER GO CHECK OUT THE TRAPS. PER001 00176700
  236. CHKUSPER DS 0H HERE TO CHECK FOR USER PER. PER001 00176800
  237. NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00178200
  238. L R10,VMECEXT EXTENSION VMBLOK ADDRESS 00185000
  239. USING ECBLOK,R10 00186000
  240. LA R15,EXTCR9 START OF CR-9, CR-10, CR-11 00187000
  241. LA R14,EXTPERAD START OF PERADD, PERCODE 00188000
  242. DROP R10 00189000
  243. SPACE 00190000
  244. TRAPPER EQU * GPR-15 = ADDRESS OF CR-9, CR-10, CR-11 00191000
  245. TM 0(R15),PERSALT TRAPPING ON STORAGE ALTERATIONS 00192000
  246. BZ GETCODE NO - PROCESSING INSTRUCTION 00193000
  247. L R0,4(,R15) VIRTUAL START ADDRESS (CR-10) 00194000
  248. CL R0,8(,R15) DOES IT WRAP-AROUND (CL CR-10 CR-11) 00195000
  249. BH PERCH03 YES - MAKES FOR EXTRA WORK 00196000
  250. CLR R0,R7 VIRTUAL ADDRESS IS IN R7 00197000
  251. BL PERCH02 R7 ABOVE LOW BOUNDARY 00198000
  252. BE PERDONE ADDRESSES ARE A PERFECT MATCH. 00199000
  253. LA R4,8(,R7) ADD DW COUNT TO VIRTUAL ADDRESS 00200000
  254. CLR R4,R0 CHECK END OF FIELD 00201000
  255. BH PERDONE HIT IT FOR PER INTERRUPT 00202000
  256. B GETCODE NO PER EVENTS @VA01687 00203000
  257. PERCH02 EQU * R7 ABOVE LOW BOUNDARY 00204000
  258. CL R7,8(,R15) VIRTUAL ADDRESS BELOW TOP END (CR-11) 00205000
  259. BNH PERDONE YES - HIT IT FOR PER INTERRUPT 00206000
  260. B GETCODE NO - NO PER EVENT HERE 00207000
  261. PERCH03 EQU * HERE FOR STORAGE WRAP-AROUND CASE 00208000
  262. CLR R0,R7 BELOW FIRST VALUE (CR-10) 00209000
  263. BNH PERDONE NO, FOUND PER EVENT @VA01687 00210000
  264. CL R7,8(,R15) OR ABOVE LAST VALUE (CR-11) 00211000
  265. BNH PERDONE NO, FOUND PER EVENT @VA01687 00212000
  266. LA R4,8(,R7) ADD DW. FOR FIELD LENGHT. 00213000
  267. CLR R4,R0 BELOW START ADDRESS @VA01687 00214000
  268. BNL PERDONE NO, FOUND PER EVENT @VA01687 00215000
  269. B GETCODE @VA01687 00216000
  270. PERDONE EQU * REFLECT PER INTERRUPT TO USER 00217000
  271. OI 4(R14),PERSALT SET STORAGE ALTERATION FLAG 00218000
  272. TM VMPEND,VMPERPND IS PER EVENT ALREADY PENDING 00219000
  273. BO GETCODE YES - NO NEED TO DO ANY MORE HERE 00220000
  274. MVI 4(R14),PERSALT SET STORAGE ALTERATION FLAG BIT 00221000
  275. MVI 5(R14),X'00' AND CLEAR ALL OTHERS 00222000
  276. L R1,VMPSW+4 LOAD VIRTUAL INSTRUCTION ADDRESS 00223000
  277. SL R1,F4 BACK IT UP WITH INSTRUCTION LENGTH. 00224000
  278. ST R1,0(,R14) STORE ADDRESS IN EXTENSION BLOK 00225000
  279. OI VMPEND,VMPERPND FLAG SUMMARY BIT 00226000
  280. B GETCODE NOW SIMULATE THE INSTRUCTION 00227000
  281. SPACE 00228000
  282. KEYUNEQ EQU * REFLECT PROTECTION ERROR ( MISMATCHED KEYS) 00229000
  283. LA R0,4 OTHERWISE, REFLECT PROTECTION 00230000
  284. GOTO DMKPRGSM VIOLATION 00231000
  285. LEVEL3 EQU * HERE FOR VIRTUAL TRANSLATE MODE 00232000
  286. LR R3,R7 GET VIRTUAL ADDRESS IN GPR3 00233000
  287. TM VMESTAT,VMINVPAG SHADOW TABLES VALID? @VM01060 00234000
  288. BNZ CALLVAT NOPE, TO CALL VAT FOR THIS @VM01060 00235000
  289. L R10,VMECEXT GET ECBLOK ADDRESS @VM01060 00236000
  290. LCTL C0,C1,EXTSHCR0-ECBLOK(R10) GET CREGS @VM01060 00237000
  291. LRA R2,0(,R3) ATTEMPT QUICK TRANSLATE @VM01060 00238000
  292. LCTL C0,C0,CPCREG0 RETURN TO STANDARD... @VM01060 00239000
  293. LCTL C1,C1,VMSEG CONTROL REGS. @VM01060 00240000
  294. BZ CKSTORE PAGE RESIDENT, WALLA @VM01060 00241000
  295. CALLVAT EQU * @VM01060 00242000
  296. BAL R13,CKDEFER GO CHECK THE SYSTEM LOCK @V407577 00242100
  297. CALL DMKVATRN AND GET VIRTUAL-VIRTUAL 00243000
  298. LTR R0,R0 CHECK RETURN CODE 00244000
  299. BZ CKSTORE TRANSLATE OK - CONTINUE 00245000
  300. CL R1,F5 RELOCATION INTERRUPT ? @VA03696 00246000
  301. BE BADDR NO..DONT BACK OFF PSW.. @VA03696 00247000
  302. L R4,VMPSW+4 SET TO BACK UP PSW ADDRESS 00248000
  303. SH R4,VMPRGIL ILC DATA SAVED IN VMBLOK 00249000
  304. ST R4,VMPSW+4 ... 00250000
  305. GOTO DMKVATEX SIMULATE RELOCATION EXCEPTION 00251000
  306. SPACE 3 00252000
  307. CHKFETCH DS 0H SCK - SCKC - SPT %VA07223 00253000
  308. CALL DMKPSAFP CHECK FOR FETCH PROTECT VIOLATION%VA07223 00254000
  309. BNZ KEYUNEQ OOPS - REFLECT PROTECTION ERROR %VA07223 00255000
  310. * OK - CONTINUE: 00256000
  311. GETCODE EQU * GET OP-CODE 2ND BYTE AND GO SIM. %V3M4038 00257000
  312. SR R7,R7 CLEAR BRANCH INDEX %V3M4038 00258000
  313. IC R7,VMINST+1 GET CODE %V3M4038 00259000
  314. SLL R7,2 TIMES 4 %V3M4038 00260000
  315. L R8,VMECEXT POINT TO VMBLOK EXTENSION %V3M4038 00261000
  316. B TIMETABL(R7) GO TO SIMULATION ROUTINE %V3M4038 00262000
  317. SPACE 00263000
  318. ORG *-16 SKIP CODES 0-3 00264000
  319. TIMETABL EQU * 00265000
  320. ORG 00266000
  321. B SCK CODE 04 - "SET TOD CLOCK" 00267000
  322. DC 2H'0' CODE 05 - "STORE TOD CLOCK" NOT TRAPPED 00268000
  323. B SCKC "SET CLOCK COMPARATOR" %V3M4038 00269000
  324. B STCKC CODE 07 - "STORE TOD CLOCK COMPARATOR" 00270000
  325. B SPT CODE 08 - "SET CPU TIMER" %V3M4038 00271000
  326. B STPT CODE 09 - "STORE CPU TIMER" 00272000
  327. SPACE 00273000
  328. BADDR EQU * HERE ON VIRTUAL ADDRESSING EXCEPTION 00274000
  329. LA R0,5 SET ADDRESSING EXCEPTION 00275000
  330. GOTO DMKPRGSM AND REFLECT INTERRUPT 00276000
  331. SPACE 00277000
  332. TESTALIN TM F7+3,0 EXECUTED TO TEST DBLWD ALIGNMENT %V3M4038 00278000
  333. EJECT 00279000
  334. *. 00280000
  335. * OPERATION - 00281000
  336. * 00282000
  337. * SECTION B. - SCK 00283000
  338. * 00284000
  339. * 1. SET CONDITION CODE 0 IN THE USER'S PSW 00285000
  340. * 2. EXIT VIA DMKDSPCH 00286000
  341. * 00287000
  342. * 00288000
  343. *. 00289000
  344. SPACE 2 00290000
  345. SCK EQU * 00291000
  346. TM VMESTAT,VMEXTCM EXTENDED MACHINE ?? 00292000
  347. BZ *+12 NO -- USE VANILLA PSW 00293000
  348. NI VMPSW+2,X'FF'-X'30' SET CC = 0 00294000
  349. B *+8 AND EXIT 00295000
  350. NI VMPSW+4,X'FF'-X'30' SET CC = 0 00296000
  351. B TMRDSPA FAST RE-DISPATCH PATH @VA04340 00297100
  352. EJECT 00298000
  353. *. 00299000
  354. * OPERATION - 00300000
  355. * 00301000
  356. * SECTION C. - SCKC 00302000
  357. * 00303000
  358. * 1. LOCATE THE TRQBLOK FOR THE VIRTUAL CLOCK COMPARATOR; IF THE 00304000
  359. * BLOCK IS QUEUED FOR AN ACTIVE REQUEST, RESET IT VIA A CALL 00305000
  360. * TO DMKSCHRT; OTHERWISE, CONTINUE 00306000
  361. * 2. SAVE THE CURRENT VALUE OF THE TIME OF DAY CLOCK, AND STORE 00307000
  362. * THE NEW VALUE OF THE CLOCK COMPARATOR IN THE TRQBLOK 00308000
  363. * 3. IF THE NEW COMPARATOR VALUE IS LESS THAN OR EQUAL TO THE 00309000
  364. * TOD CLOCK VALUE, STACK THE BLOCK VIA DMKSTKIO, AND EXIT TO 00310000
  365. * DISPATCH; OTHERWISE, 00311000
  366. * 4. SCHEDULE THE BLOK FOR A CLOCK COMPARATOR INTERRUPT VIA DMK- 00312000
  367. * SCHST, AND 00313000
  368. * 5. RESET ANY PENDING CLOCK COMPARATOR INTERRUPT IN THE VMBLOK 00314000
  369. * 00315000
  370. * 00316000
  371. *. 00317000
  372. SPACE 00317500
  373. DMKTMRCC DS 0H NO FAST REDSP ON MICROCODE PATH %V408246 00318000
  374. SCKC EQU * 00319000
  375. L R1,EXTCCTRQ POINT TO TRQBLOK FOR CLOCK COMPARATOR REQ 00320000
  376. L R3,TRQBFPNT IS THE REQUEST ACTIVE ?? 00321000
  377. LTR R3,R3 ?? 00322000
  378. BZ SETREQ NO -- NO NEED TO RESET - 00323000
  379. CALL DMKSCHRT RESET THE OUTSTANDING REQUEST 00324000
  380. SPACE 00325000
  381. SETREQ EQU * 00326000
  382. STCK TRQBTOD SAVE CURRENT VALUE OF TOD CLOCK 00327000
  383. BC 12,CLOCKOK IS CLOCK FUNCTIONING? @VA04301 00327250
  384. GOTO DMKCVTAB CLOCK DAMAGED...ABEND CVT001 @VA04301 00327500
  385. CLOCKOK EQU * @VA04301 00327750
  386. MVC TRQBVAL,0(R2) SET VALUE OF REQUESTED INTERRUPT 00328000
  387. CLC TRQBVAL,TRQBTOD INTERRUPT ALREADY PENDING ?? 00329000
  388. LR R10,R1 POINT TO BLOCK FOR STACK @V200198 00330000
  389. BH QREQUEST GO QUEUE THE TIMER REQUEST @V200198 00331000
  390. CALL DMKSTKIO ALREADY GIVEN 00332000
  391. NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00332400
  392. B TMREXIT DISPATCH WILL UNSTACK FOR IRA 00333000
  393. SPACE 00334000
  394. QREQUEST EQU * 00335000
  395. L R0,=X'10400000' GET CLOCK COMPARATOR COLLATING @V200198 00336000
  396. * VALUE 00337000
  397. LA R1,VMPXINT @V200198 00338000
  398. CKCLOOP LR R2,R1 @V200198 00339000
  399. L R1,XINTNEXT-XINTBLOK(,R2) @V200198 00340000
  400. LTR R1,R1 @V200198 00341000
  401. BZ CKCLEND @V200198 00342000
  402. C R0,XINTSORT-XINTBLOK(,R1) @V200198 00343000
  403. BH CKCLOOP @V200198 00344000
  404. BL CKCLEND @V200198 00345000
  405. L R0,XINTNEXT-XINTBLOK(,R1) @V200198 00346000
  406. ST R0,XINTNEXT-XINTBLOK(,R2) @V200198 00347000
  407. LA R0,XINTSIZE @V200198 00348000
  408. CALL DMKFRET @V200198 00349000
  409. CKCLEND LR R1,R10 POINT TO TRQBLOK @V200198 00350000
  410. CALL DMKSCHST SET UP INTERRUPT REQUEST @V200198 00351000
  411. B TMREXIT AND GO DISPATCH - PSW UNCHANGED 00352000
  412. EJECT 00353000
  413. *. 00354000
  414. * 00355000
  415. * OPERATION - 00356000
  416. * 00357000
  417. * SECTION D. - STCKC 00358000
  418. * 00359000
  419. * 1. GET TRQBLOK FOR CLOCK COMPARATOR 00360000
  420. * 2. MOVE CLOCK COMPARATOR VALUE TO USER 00361000
  421. * 3. EXIT VIA GOTO TO DMKDSPCH- PSW UNCHANGED 00362000
  422. * 00363000
  423. *. 00364000
  424. SPACE 2 00365000
  425. STCKC EQU * 00366000
  426. L R1,EXTCCTRQ POINT TO TRQBLOK FOR CKC 00367000
  427. MVC 0(8,R2),TRQBVAL MOVE VALUE IN COMPARATOR TO USER 00368000
  428. B TMREXIT AND GO TO DISPATCH 00369000
  429. EJECT 00370000
  430. *. 00371000
  431. * 00372000
  432. * OPERATION - 00373000
  433. * 00374000
  434. * SECTION E. - SPT 00375000
  435. * 00376000
  436. * 1. IF THE VIRTUAL CPU TIMER IS IN THE REAL CPU TIMER; 00377000
  437. * SUBTRACT THE VALUE IN VMTMOUYQ FROM EXTCPTMR. WITH 00378000
  438. * THE DIFFERENCE SUBTRACT FROM TRQBQUE; TRQBQUE WILL NOW 00379000
  439. * CONTAIN THE AMOUNT OF TIME THAT THIS USER IS ALLOWED 00380000
  440. * TO STAY IN THE SCHEDULAR QUEUE. STORE THIS USER'S NEW 00381000
  441. * TIMER VALUE IN EXTCPTMR. IF THE NEW TIMER VALUE IS LESS 00382000
  442. * THAN THE QUEUE DROP INTERVAL (TRQBQUE), STORE USER'S NEW 00383000
  443. * TIMER VALUE IN VMTMOUTQ AND FLAG THE VMBLOK THAT THE SYSTEM 00384000
  444. * IS TRACKING HIS VIRTUAL CPU TIMER. IF THE NEW VIRTUAL CPU 00385000
  445. * TIMER VALUE IS GREATER THAN THE VALUE IN TRQBQUE MOVE 00386000
  446. * TRQBQUE TO VMTMOUTQ. VMTMOUTQ WILL ALWAYS CONTAIN EITHER 00387000
  447. * A VIRTUAL CPU TIMER VALUE OR QUEUE DROP TIME INTERVAL. 00388000
  448. * 00389000
  449. * 2. IF THE VIRTUAL CPU TIMER IS NOT IN THE REAL CPU TIMER; 00390000
  450. * MOVE VMTMOUTQ TO TRQBQUE, THE RESULT IN THE AMOUNT 00391000
  451. * OF TIME STILL ALLOWED TO REMAIN IN A QUEUE. IF THE USER'S 00392000
  452. * NEW VIRTUAL CPU TIMER IF LESS THAN THE VALUE IN TRQBQUE 00393000
  453. * STORE HIS TIMER VALUE IN VMTMOUTQ. OTHERWISE LEAVE VMTMOUTQ 00394000
  454. * EQUAL TO TRQBQUE. IN ANY CASE EXTCPTMR WILL CONTAIN HIS 00395000
  455. * NEW VIRTUAL CPU TIMER VALUE. 00396000
  456. * 00397000
  457. * 3. EXIT TO DISPATCHER 00398000
  458. * 00399000
  459. *. 00400000
  460. SPACE 00400500
  461. DMKTMRSP DS 0H NO FAST REDSP ON MICROCODE PATH %V408246 00401000
  462. SPT EQU * 00402000
  463. DROP R1,R8 00403000
  464. L R10,VMECEXT 00404000
  465. USING ECBLOK,R10 00405000
  466. L R9,EXTCPTRQ 00406000
  467. USING TRQBLOK,R9 00407000
  468. SPACE 00408000
  469. LA R1,1 CONSTANT FOR ARITHMETIC 00409000
  470. LM R3,R4,VMTMOUTQ REMAINING TIME LEFT IN QUEUE 00410000
  471. LTR R3,R3 DID IT GO NEGATIVE DURING SIMULATION 00411000
  472. BNM *+8 NO, ITS OK TO USE IT 00412000
  473. LM R3,R4,ZEROES MUST NOT BE NEGATIVE 00413000
  474. LM R5,R6,TRQBQUE TIME OF LAST VALUE USER WAS RUNNING 00414000
  475. TM VMTLEVEL,VMCPUTMR ARE WE TRACKING VIRTUAL CPU TIMER 00415000
  476. BO TRKTMR YES - SPECIAL HANDLING 00416000
  477. LR R5,R3 REMAINING TIME TO LEAVE IN QUEUE 00417000
  478. LR R6,R4 ..... 00418000
  479. B NOTRKTMR 00419000
  480. SPACE 00420000
  481. TRKTMR EQU * HERE IF TRACKING VIRTUAL CPU TIMER 00421000
  482. LM R7,R8,EXTCPTMR USERS VIRTUAL CPU TIMER VALUE 00422000
  483. SLR R8,R4 CALCULATE HOW LONG USER 00423000
  484. BC 8+2+1,*+6 HAS BEEN RUNNING IN 00424000
  485. SLR R7,R1 PROBLEM STATE SINCE LAST 'STPT' OR 'SPT' 00425000
  486. SLR R7,R3 INSTRUCTION ..... 00426000
  487. SLR R6,R8 USE THIS FACTOR SO THAT WHEN 00427000
  488. BC 8+2+1,*+6 SCHEDULAR DROP'S HIM FROM THE QUEUE 00428000
  489. SLR R5,R1 WE WON'T FOWL UP VIRTUAL CPU TIME... 00429000
  490. SLR R5,R7 ..... 00430000
  491. NOTRKTMR NI VMTLEVEL,X'FF'-VMCPUTMR NOLONGER TRACKING CPU TIMER 00431000
  492. TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00431100
  493. BZ NOPROBT NO, CONTINUE NORMALLY @VA07582 00431200
  494. BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00431300
  495. * VMTMOUTQ IS TO BE CHANGED 00431400
  496. STM R5,R6,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00431500
  497. NOPROBT DS 0H @VA07582 00431600
  498. STM R5,R6,TRQBQUE SAVE RESULT FOR SCHEDULAR.. 00432000
  499. STM R5,R6,VMTMOUTQ SAVE TIME TILL QUEUE DROP.. 00433000
  500. LM R7,R8,0(R2) GET NEW TIMER VALUE FROM USER 00434000
  501. STM R7,R8,EXTCPTMR STORE NEW VALUE IN EXTENSION BLOK 00435000
  502. LTR R7,R7 IS NEW TIMER VALUE POSITIVE 00436000
  503. BNM TMRPLUS YES - RESET PENDING FLAGS 00437000
  504. CPTADD LM R5,R6,=X'1050000010050400' SORT VALUE, CODE @V200198 00438000
  505. * AND MASK 00439000
  506. LA R2,VMPXINT BEGINNING OF CHAIN @V200198 00440000
  507. CPTINT LR R4,R2 SAVE THIS @V200198 00441000
  508. TM VMPSW,EXTMASK ENABLED FOR EXTERNAL INT. @VA04340 00441100
  509. BZ TMR001 NO - @VA04340 00441200
  510. NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00441310
  511. TMR001 EQU * @VA04340 00441400
  512. L R2,XINTNEXT-XINTBLOK(,R4) GET NEXT BLOK @V200198 00442000
  513. LTR R2,R2 ANYTHING THERE? @V200198 00443000
  514. BZ INTADD NO, ADD ONE @V200198 00444000
  515. C R5,XINTSORT-XINTBLOK(,R2) A MATCH? @V200198 00445000
  516. BH CPTINT NO, KEEP LOOKING @V200198 00446000
  517. BE TMREXIT ALREADY ONE PENDING @V200198 00447000
  518. INTADD LA R0,XINTSIZE SIZE OF NEEDED BLOCK @V200198 00448000
  519. CALL DMKFREE @V200198 00449000
  520. ST R1,XINTNEXT-XINTBLOK(,R4) CHAIN IN NEW BLOCK @V200198 00450000
  521. ST R2,XINTNEXT-XINTBLOK(,R1) .. @V200198 00451000
  522. STM R5,R6,XINTSORT-XINTBLOK(R1) FILL IN SORT FIELD, @V200198 00452000
  523. * INTERRUPT CODE AND MASK 00453000
  524. SLR R0,R0 @V200198 00454000
  525. ST R0,XINTPARM-XINTBLOK(,R1) ZERO FIELD @V200198 00455000
  526. B TMREXIT EXIT TO DISPATCHER 00456000
  527. TMRPLUS L R5,=X'10500000' COLLATING VALUE @V200198 00457000
  528. LA R1,VMPXINT CHAIN ANCHOR @V200198 00458000
  529. CPTLOOP LR R2,R1 SAVE HERE @V200198 00459000
  530. L R1,XINTNEXT-XINTBLOK(,R2) GET NEXT BLOCK @V200198 00460000
  531. LTR R1,R1 ANYTHING THERE? @V200198 00461000
  532. BZ CPTLEND NO, ALL DONE @V200198 00462000
  533. C R5,XINTSORT-XINTBLOK(,R1) A MATCH? @V200198 00463000
  534. BH CPTLOOP NO, KEEP LOOKING @V200198 00464000
  535. BL CPTLEND NONE HERE @V200198 00465000
  536. L R0,XINTNEXT-XINTBLOK(,R1) UNCHAIN BLOCK @V200198 00466000
  537. ST R0,XINTNEXT-XINTBLOK(,R2) .. @V200198 00467000
  538. LA R0,XINTSIZE SIZE OF BLOCK @V200198 00468000
  539. CALL DMKFRET @V200198 00469000
  540. CPTLEND EQU * @V200198 00470000
  541. CLC EXTCPTMR,TRQBQUE IS VIRT TIMER < QUEUE DROP TIME 00471000
  542. BH TMREXIT NO - 00472000
  543. STM R7,R8,VMTMOUTQ YES - STORE VIRTUAL CPU TIMER 00473000
  544. OI VMTLEVEL,VMCPUTMR INDICATE TRACKING VIRTUAL CPU TIMER 00474000
  545. TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00474100
  546. BZ TMREXIT NO, CONTINUE NORMALLY @VA07582 00474200
  547. STM R7,R8,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00474300
  548. B TMREXIT AND TO TO DISPATCH, PSW UNCHANGED 00475000
  549. SPACE 00475100
  550. INCPROBT DS 0H INCREMENT PROBLEM STATE TIME @VA07582 00475200
  551. LM R0,R1,VMTMOUTQ GET TIMER AT PROBLEM STATE END @VA07582 00475300
  552. LM R7,R8,PROBSTRT GET TIMER AT PROBLEM STATE START @VA07582 00475400
  553. SLR R8,R1 CALC 2ND HALF OF ELAPSED TIME @VA07582 00475500
  554. BNM *+6 WAS THERE A CARRY? @VA07582 00475600
  555. BCTR R7,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00475700
  556. SLR R7,R0 CALC 1ST HALF OF ELAPSED TIME @VA07582 00475800
  557. LM R0,R1,PROBTIME GET TOTAL PROBLEM TIME @VA07582 00475900
  558. SLR R1,R8 SUBTRCT 2ND HALF OF ELAPSED TIME @VA07582 00476000
  559. BNM *+6 WAS THERE A CARRY? @VA07582 00476100
  560. BCTR R0,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00476200
  561. SLR R0,R7 SUBTRCT 1ST HALF OF ELAPSED TIME @VA07582 00476300
  562. STM R0,R1,PROBTIME STORE NEW TOTAL PROBLEM TIME @VA07582 00476400
  563. BR R14 RETURN TO CALLER @VA07582 00476500
  564. EJECT 00476600
  565. *. 00477000
  566. * 00478000
  567. * OPERATION - 00479000
  568. * 00480000
  569. * SECTION F. - STPT 00481000
  570. * 00482000
  571. * 1. IF THE VIRTUAL CPU TIMER IS IN THE REAL CPU TIMER; 00483000
  572. * SUBTRACT THE VALUE IN VMTMOUTQ FROM EXTCPTMR WHICH RESULTS 00484000
  573. * IN A TIME DIFFERENCE, SINCE TRQBQUE WAS LAST UPDATED. 00485000
  574. * WITH THIS DIFFERENCE SUBTRACT IT FROM TRQBQUE. THE VALUE 00486000
  575. * LEFT IN TRQBQUE IS THE AMOUNT OF TIME REMAINING THAT THIS 00487000
  576. * USER WILL BE ALLOWED TO STAY IN A QUEUE. LASTLY MOVE THE 00488000
  577. * VALUE IN VMTMOUTQ TO EXTCPTMR WHICH IS THIS USER'S VIRTUAL 00489000
  578. * CPU TIMER VALUE. STORE EXTCPTMR IN USER'S VIRTUAL MEMORY. 00490000
  579. * 00491000
  580. * 2. IF THE VIRTUAL CPU TIMER IS NOT IN THE REAL CPU TIMER; 00492000
  581. * SUBTRACT THE VALUE IN VMTMOUTQ FROM TRQBQUE. THE DIFFERENCE 00493000
  582. * IS THE AMOUNT OF TIME THAT WILL BE SUBTRACTED FROM EXTCPTMR 00494000
  583. * TO UPDATE HIS VIRTUAL TIMER. STORE THIS NEW VALUE IN THE 00495000
  584. * USER'S VIRTUAL MEMORY. LASTLY MOVE VMTMOUTQ TO TRQBQUE TO 00496000
  585. * RE-ESTABLISH A TIME INTERVAL DIFFERENCE. 00497000
  586. * 00498000
  587. * 3. EXIT TO DISPATCHER 00499000
  588. * 00500000
  589. *. 00501000
  590. SPACE 2 00502000
  591. STPT EQU * 00503000
  592. L R10,VMECEXT 00504000
  593. USING ECBLOK,R10 00505000
  594. L R9,EXTCPTRQ GET TIMER REQUEST BLOK 00506000
  595. USING TRQBLOK,R9 ... 00507000
  596. SPACE 00508000
  597. LA R1,1 CONSTANT 00509000
  598. LM R3,R4,VMTMOUTQ GET TIME REMAINING IN QUEUE 00510000
  599. LTR R3,R3 DID IT GO NEGATIVE DURING SIMULATION 00511000
  600. BNM *+8 NO, ITS OK TO USE IT 00512000
  601. LM R3,R4,ZEROES MUST NOT BE A NEGATIVE NUMBER 00513000
  602. SPACE 00516000
  603. TM VMTLEVEL,VMCPUTMR IS VIRTUAL CPU TIMER EQUAL REAL ? 00517000
  604. BO TRKSTPT YES - THATS EASY @VA04340 00518100
  605. LM R5,R6,TRQBQUE GET LAST TIME PUT IN QUE @VA04340 00518200
  606. LM R7,R8,EXTCPTMR GET HIS VIRTUAL CPU TIMER @VA04340 00518300
  607. SPACE 00519000
  608. SLR R6,R4 CALCULATE AMOUNT OF TIME ELAPSED 00520000
  609. BC 8+2+1,*+6 SINCE QUEUE WAS UPDATED 00521000
  610. SLR R5,R1 ... 00522000
  611. SLR R5,R3 ... 00523000
  612. SPACE 00524000
  613. SLR R8,R6 WITH RESULT SUBTRACT FROM 00525000
  614. BC 8+2+1,*+6 VIRTUAL CPU TIMER ,, GIVING 00526000
  615. SLR R7,R1 TRUE TIME FOR THIS USER.. 00527000
  616. SLR R7,R5 ... 00528000
  617. SPACE 00529000
  618. STM R7,R8,0(R2) STORE HIS CPU TIMER @VA04340 00530100
  619. B TMREXIT GOTO DISPATCHER 00533000
  620. SPACE 00534000
  621. TRKSTPT EQU * HERE IF TRACKING VIRTUAL CPU TIMER 00535000
  622. STM R3,R4,0(R2) STORE HIS CPU TIMER @VA04340 00536100
  623. B TMREXIT AND EXIT TO DISPATCH 00551000
  624. EJECT 00552000
  625. *. 00553000
  626. * 00554000
  627. * OPERATION - 00555000
  628. * 00556000
  629. * SECTION G. - VIRTUAL CLOCK COMPARATOR INTERRUPT 00557000
  630. * 00558000
  631. * 1. FLAG THE TRQBLOK AS NO LONGER OUTSTANDING 00559000
  632. * 2. FLAG THE USER'S VMBLOK WITH A CLOCK COMPARATOR INTERRUPT 00560000
  633. * PENDING 00561000
  634. * 3. EXIT TO THE DISPATCHER 00562000
  635. * 00563000
  636. *. 00564000
  637. SPACE 2 00565000
  638. USING TRQBLOK,R10 00566000
  639. USING *,R12 00567000
  640. DMKTMRCK EQU * 00568000
  641. L R12,=A(DMKTMRTN) STANDARD 00569000
  642. USING DMKTMRTN,R12 ADDRESSABILITY -- 00570000
  643. NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00570200
  644. SR R0,R0 CLEAR OUT 00571000
  645. ST R0,TRQBFPNT QUEUE POINTER TO INDICATE INACTIVE BLOK 00572000
  646. XINTQUE SLR R5,R5 PARAMETER IS MEANINGLESS HERE @V200198 00573000
  647. LM R3,R4,=X'1040000010040800' SET UP SORT FIELD @V200198 00574000
  648. * AND CODE 00575000
  649. LA R2,VMPXINT START OF EXTERNAL INTERRUPT @V200198 00576000
  650. * BLOCKS 00577000
  651. XINTLOOP LR R6,R2 PRESERVE POINTER TO PREVIOUS @V200198 00578000
  652. L R2,XINTNEXT-XINTBLOK(,R6) NEXT? @V200198 00579000
  653. LTR R2,R2 @V200198 00580000
  654. BZ XINTADD NOPE, ADD TO END OF CHAIN @V200198 00581000
  655. C R3,XINTSORT-XINTBLOK(,R2) @V200198 00582000
  656. BH XINTLOOP KEEP LOOKING... @V200198 00583000
  657. BZ TMRDSPCH TAKE LONG DISPATCHER PATH. @VA05296 00584100
  658. XINTADD LA R0,XINTSIZE NUMBER OF DOUBLEWORDS @V200198 00585000
  659. CALL DMKFREE GET BLOCK FORM FREE STORAGE @V200198 00586000
  660. ST R1,XINTNEXT-XINTBLOK(,R6) @V200198 00587000
  661. STM R2,R5,XINTNEXT-XINTBLOK(R1) BUILD NEW @V200198 00588000
  662. * INTERRUPT BLOCK 00589000
  663. B TMRDSPCH TAKE LONG DISPATCHER PATH. @VA05296 00590100
  664. EJECT 00591000
  665. *. 00592000
  666. * 00593000
  667. * OPERATION - 00594000
  668. * 00595000
  669. * SECTION H. - REAL CPU TIMER INTERRUPTS ARE PROCESSED HERE 00596000
  670. * WHEN THE REAL CPU TIMER CONTAINS THE VIRTUAL 00597000
  671. * CPU TIMER INTERVAL. THIS DECISION IS MADE WHEN 00598000
  672. * THE VIRTUAL MACHINE IS PUT INTO A QUEUE BY 00599000
  673. * THE SCHEDULAR OR 'STPT' INSTRUCTION IS MADE. 00600000
  674. * 00601000
  675. * 1. ON CPU TIMER INTERRUPTS CALCULATE THE PROBLEM STATE TIME 00602000
  676. * USED; SUBTRACT THE VALUE IN EXTCPTMR FROM TRQBQUE. 00603000
  677. * THE RESULT IS THE TIME THIS USER IS ALLOWED TO REMAIN 00604000
  678. * IN A QUEUE. MOVE VMTMOUTQ TO EXTCPTMR AND STORE THE 00605000
  679. * REMAINING QUEUE TIME IN VMTMOUTQ. 00606000
  680. * 00607000
  681. * 2. FLAG VMBLOK THAT AN EXTERNAL INTERRUPT IS PENDING. 00608000
  682. * 00609000
  683. * 3. RESET VMCPUTMR FLAG IN THE VMBLOK TO INDICATE THAT 00610000
  684. * REAL CPU TIMER IS NO-LONGER TRACKING VIRTUAL CPU TIMER. 00611000
  685. * 00612000
  686. * 4. GOTO DISPATCHER TO PROCESS THE INTERRUPT FOR THIS 00613000
  687. * VIRTUAL MACHINE. 00614000
  688. * 00615000
  689. *. 00616000
  690. DMKTMRVT EQU * PROCESS CPU TIMER INTERRUPTS FOR VIRTUAL MACHINES 00617000
  691. USING *,R12 00618000
  692. DROP R10 00619000
  693. L R12,=A(DMKTMRTN) STANDARD ADDRESSABILITY 00620000
  694. USING DMKTMRTN,R12 ... 00621000
  695. L R10,VMECEXT GET EC VMBLOK EXTENSION 00622000
  696. USING ECBLOK,R10 ... 00623000
  697. L R9,EXTCPTRQ GET TIMER REQUEST BLOK 00624000
  698. USING TRQBLOK,R9 ... 00625000
  699. NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00625200
  700. LM R4,R5,TRQBQUE GET TIME REMAINING IN QUEUE FOR USER 00626000
  701. LM R6,R7,EXTCPTMR GET CPU TIMER VALUE BEFORE INTERRUPT 00627000
  702. SPACE 00628000
  703. LA R3,1 CONSTANT FOR PRECISION ARITHMETIC 00629000
  704. SLR R5,R7 CALCULATE TIME REMAINING FOR 00630000
  705. BC 8+2+1,*+6 USER TO BE ALLOWED TO STAY 00631000
  706. SLR R4,R3 IN THIS QUEUE. 00632000
  707. SLR R4,R6 ... 00633000
  708. LM R6,R7,VMTMOUTQ MOVE REAL TIMER VALUE TO VIRT. CPU TIMER 00634000
  709. STM R6,R7,EXTCPTMR ... 00635000
  710. STM R4,R5,TRQBQUE SAVE CPU TIMER NOW 00636000
  711. BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00636100
  712. * VMTMOUTQ IS TO BE CHANGED @VA07582 00636200
  713. STM R4,R5,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00636300
  714. STM R4,R5,VMTMOUTQ SAVE REMAINING TIME ALLOWED IN QUEUE 00637000
  715. NI VMTLEVEL,X'FF'-(VMCPUTMR+VMTMRINT) RESET TIMER FLAGS 00638000
  716. B CPTADD GO STACK CPU TIMER INTERRUPT @V200198 00639000
  717. SPACE 2 00640000
  718. EJECT 00641000
  719. TMREXIT EQU * GENERAL EXIT FROM DMKTMR 00642000
  720. SPACE 00643000
  721. LA R13,TMRNIEX EXIT POINT WITH SYSTEM LOCK @V407577 00644100
  722. AIF (NOT &AP).APCHK4 00644110
  723. TM APSTAT1,APUOPER RUNNING IN AP MODE? @VA07493 00644150
  724. BZR R13 NO FORGET ABOUT LOCKS @VA08029 00644210
  725. L R1,=A(DMKLOKSY+2) ADDRESS OF LOCKWORD @VA07493 00644250
  726. CLC LPUADDR,0(R1) LOCK ALREADY HELD? @VA07493 00644300
  727. BER R13 YES..DO NOT FAST REFLECT @V407577 00644500
  728. B GETLOCK TRY TO OBTAIN SYSTEM LOCK @VA08029 00644850
  729. AGO .APCHK5 00645000
  730. .APCHK4 ANOP 00645050
  731. BR R13 NORMAL EXIT FROM DMKTMR @VA07493 00645100
  732. .APCHK5 ANOP 00645150
  733. SPACE 1 00645375
  734. TMRDSPA NI VMRSTAT,X'FF'-VMEXWAIT REMOVE FROM SIMULATION @VA04340 00645400
  735. * WAIT 00645425
  736. GOTO DMKDSPA TRY FAST RE-DISPATCH @VA04340 00645450
  737. SPACE 1 00645475
  738. TMRNIEX NI VMRSTAT,X'FF'-VMEXWAIT REMOVE FROM SIMULATION @V407577 00645520
  739. * WAIT 00645540
  740. TMRDSPCH GOTO DMKDSPCH TAKE LONG DISPATCHER PATH @V407577 00645560
  741. AIF (NOT &AP).APCHK6 00645575
  742. CKDEFER TM CPSTATUS,CPRUN ENTERED FROM FLIH? @V407577 00645580
  743. BNOR R13 NO...SYSTEM LOCK IS HELD @V407577 00645600
  744. TM APSTAT1,APUOPER RUNNING IN AP MODE? @VA07493 00645605
  745. BZR R13 NO, SKIP LOCK LOGIC @VA07493 00645610
  746. L R15,=A(DMKLOKSY+2) ADDRESS OF LOCKWORD @VA07493 00645615
  747. CLC LPUADDR,0(R15) LOCK ALREADY HELD? @VA07493 00645620
  748. BER R13 YES, DON'T TRY TO OBTAIN @VA07493 00645625
  749. GETLOCK LOCK OBTAIN,TYPE=SYS,SPIN=NO,SAVE @VA07480 00645630
  750. BZR R13 GOT IT..RETURN TO CALLER @V407577 00645640
  751. L R1,VMDFTPNT POINTER TO THE DEFER BLOCK @V407577 00645660
  752. USING CPEXBLOK,R1 @V407577 00645680
  753. STM R0,R15,CPEXREGS SAVE THE REGISTERS @V407577 00645700
  754. ST R13,CPEXADD AND THE EXECUTION ADDRESS @V407577 00645720
  755. CALL DMKSTKDE AND STACK FOR DISPATCH @V407577 00645740
  756. GOTO DMKDSPRU EXIT TO RUN USERS @V407577 00645760
  757. AGO .APCHK7 00645800
  758. .APCHK6 ANOP 00645820
  759. CKDEFER BR R13 IS NO SYSTEM LOCK IN UP MODE @V407577 00645840
  760. .APCHK7 ANOP 00645860
  761. EJECT 00646000
  762. LTORG 00647000
  763. *. 00648000
  764. * 00649000
  765. * OPERATION - 00650000
  766. * 00651000
  767. * SECTION I. CALLED BY OTHER SYSTEM ROUTINES TO CALCULATE 00652000
  768. * THE AMOUNT OF VIRTUAL PROBLEM TIME USED. 00653000
  769. * 00654000
  770. * 00655000
  771. * 1. IF USER IS NOT THE DISPATCH RUNUSER LOAD R0-1 WITH VMVTIME 00656000
  772. * AND RETURN TO THE CALLER. 00657000
  773. * 00658000
  774. * 2. IF USER IS NOT RUNNING WITH EC-MODE OPTION, SUBTRACT 00659000
  775. * VMTMOUTQ FROM QUEUE DROP TIME INTERVAL. ADD TO THIS THE 00660000
  776. * VALUE IN VMVTIME AND LOAD R0-1 WITH THE RESULT. 00661000
  777. * 3. IF USER IS RUNNING WITH EC-MODE OPTION AND THE REAL CPU 00662000
  778. * TIMER IS NOT TRACKING THE VIRTUAL CPU TIMER DO SAME 00663000
  779. * AS IDEM 2. 00664000
  780. * 00665000
  781. * 4. FOR EC-MODE MACHINES WHEN THE REAL CPU TIMER IS TRACKING 00666000
  782. * THE VIRTUAL CPU TIMER DO THE FOLLOWING.. 00667000
  783. * A. SUBTRACT VMTMOUTQ FROM EXTCPTMR AND WITH THE RESULT 00668000
  784. * SUBTRACT FROM TRQBQUE. WITH THIS DIFFERENCE SUBTRACT 00669000
  785. * FROM THE SCHEDULAR QUEUE DROP INTERVAL. THE RESULTING 00670000
  786. * VALUE WILL BE THE AMOUNT THAT THE SCHEDULAR WILL ADD 00671000
  787. * TO VMVTIME FIELD. WITHOUT UPDATING VMVTIME ADD VMVTIME 00672000
  788. * TO THE FACTOR THAT WAS JUST CALCULATED. LOAD R0-1 00673000
  789. * WITH THIS VALUE AND RETURN TO THE CALLER. 00674000
  790. * 00675000
  791. * 00676000
  792. *. 00677000
  793. EJECT 00678000
  794. ENTRY DMKTMRPT 00679000
  795. DMKTMRPT DS 0F 00680000
  796. USING *,R15 ADDRESSABILTY 00681000
  797. L R15,=A(DMKTMRTN) ... 00682000
  798. DROP R12 00683000
  799. USING DMKTMRTN,R15 00684000
  800. LM R0,R1,VMVTIME GET PROBLEM TIME ALREADY USED 00685000
  801. TM VMDSTAT,VMINQ IS USER IN A QUEUE? @VA05287 00686100
  802. BNO TIMEXIT NO - VMVTIME FIELD IS CORRECT AS STANDS 00687000
  803. SPACE 00688000
  804. STM R2,R8,BALR2 SAVE USER'S REGISTER'S 00689000
  805. LA R8,1 CONSTANT FOR AIRTHMETIC 00690000
  806. LM R2,R3,VMTMOUTQ GET TIME REMAINING IN THE QUEUE 00691000
  807. LTR R2,R2 WAS ALL THE ALLOCATED TIME USED? @VA04063 00692300
  808. BNM *+8 NO...USE VALUE THAT REMAINS @VA04063 00692600
  809. LM R2,R3,ZEROES CAN'T USE A NEGATIVE NUMBER @VA04063 00692900
  810. TM VMTLEVEL,VMCPUTMR IS VIRTUAL CPU TIMER IN REAL TIMER 00693000
  811. BNO NOTVIRT NO - NO INVOLVED AIRTHMETIC IS NEEDED 00694000
  812. SPACE 00695000
  813. L R7,VMECEXT GET VMBLOK EXTENSION 00696000
  814. LM R4,R5,EXTCPTMR-ECBLOK(R7) LOAD UP VIRTUAL CPU TIMER 00697000
  815. L R7,EXTCPTRQ-ECBLOK(,R7) GET ADDR. OF TIMER BLOK 00698000
  816. LM R6,R7,TRQBQUE-TRQBLOK(R7) GET TIME REMAINING IN QUEUE 00699000
  817. SPACE 00700000
  818. SLR R5,R3 FIND DIFFERENCE IN 'TIME' BETWEEN 00701000
  819. BC 8+2+1,*+6 THE VALUES IN VMTMOUTQ AND 00702000
  820. SLR R4,R8 EXTCPTMR FIELDS.. 00703000
  821. SLR R4,R2 ... 00704000
  822. SPACE 00705000
  823. SLR R7,R5 WITH THIS DIFFERENCE; SUBTRACT 00706000
  824. BC 8+2+1,*+6 THIS VALUE FROM TRQBQUE; THE RESULT 00707000
  825. SLR R6,R8 IS THE AMOUNT OF TIME WHICH IS 00708000
  826. SLR R6,R4 LEFT BEFORE BEING DROPPED FROM QUEUE. 00709000
  827. SPACE 00710000
  828. LR R2,R6 PUT IN R2 00711000
  829. LR R3,R7 PUT IN R3 00712000
  830. SPACE 00713000
  831. NOTVIRT TM VMQLEVEL,VMQ1 IS USER IN Q1? @V408246 00714000
  832. BZ QUEUE2 NO - MUST BE IN QUEUE 2. 00715000
  833. L R7,=V(DMKSCHN1) ADDR. OF QUEUE 1 TIME INTERVAL 00716000
  834. SL R7,F8 .... 00717000
  835. LM R4,R5,0(R7) GET ACTUAL TIME INTERVAL FOR QUEUE 1 00718000
  836. B COMPVTM PROCESS VIRTUAL PROBLEM TIME. 00719000
  837. SPACE 00720000
  838. QUEUE2 L R7,=V(DMKSCHN2) ADDR. OF QUEUE 2 TIME INTERVAL 00721000
  839. SL R7,F8 ... 00722000
  840. LM R4,R5,0(R7) GET ACTUAL TIME INTERVAL FOR QUEUE 2. 00723000
  841. SPACE 00724000
  842. COMPVTM SLR R5,R3 FIND THE TIME INTERVAL THAT 00725000
  843. BC 8+2+1,*+6 USER ACTUALLY RAN; 00726000
  844. SLR R4,R8 IN PROBLEM STATE CONDITION. 00727000
  845. SLR R4,R2 ... 00728000
  846. LTR R4,R4 TRAP NEGATIVE VALUE @V408246 00728100
  847. BNM *+8 OK @V408246 00728200
  848. LM R4,R5,0(R7) RECOVER WITH 'POSSIBLE' VALUE @V408246 00728300
  849. SPACE 00729000
  850. ALR R1,R5 ADD THIS TIME SLICE TO THE TOTAL 00730000
  851. BC 8+4,*+6 VIRTUAL PROBLEM STATE TIME FOR 00731000
  852. ALR R0,R8 THIS USER. 00732000
  853. ALR R0,R4 PASS RESULT BACK IN R0-1. 00733000
  854. SPACE 00734000
  855. LM R2,R8,BALR2 RESTORE CALLER'S REGISTERS 00735000
  856. TIMEXIT ST R14,BALR14 SAVE CALLER'S R14 @V4M0203 00736100
  857. CHARGE SYNC UPDATE VMTTIME @V4M0203 00736200
  858. L R14,BALR14 RESTORE CALLER'S R14 @V4M0203 00736300
  859. BR R14 RETURN TO CALLER @V4M0203 00736400
  860. EJECT 00737010
  861. *. 00737020
  862. * OPERATION - 00737030
  863. * 00737040
  864. * SECTION J. CALLED BY OTHER SYSTEM ROUTINES TO AGGREGATE THE 00737050
  865. * SUPERVISOR STATE CHARGES OF EACH OF THE PROCESSORS 00737060
  866. * AND UPDATE VMTTIME TO REFLECT TOTAL SUPERVISOR 00737070
  867. * STATE. 00737080
  868. * 00737090
  869. * AT ENTRY: 00737100
  870. * GPR 11 = VMBLOK OF THE USER TO BE CHARGED 00737110
  871. * GPR 14 = RETURN REGISTER 00737120
  872. * AT EXIT: 00737130
  873. * THE VMTTIME FIELD OF R11 VMBLOK HAS BEEN UPDATED 00737140
  874. *. 00737150
  875. DMKTMRSN DS 0F @V4M0203 00737160
  876. USING *,R15 ADDRESSABILITY @V4M0203 00737170
  877. TM APSTAT1,APUOPER TEST FOR MULTIPLE PROCS @V4M0203 00737180
  878. BZR R14 ONE PROCESSOR UPDATE UNNECESSARY @V4M0203 00737190
  879. STM R0,R1,CHGREGS PRESERVE REGS DURING UPDATE @V4M0203 00737200
  880. LM R0,R1,VMCPTIME PICK UP MAIN PROCESSOR VALUE @V4M0203 00737210
  881. AL R1,VMAPTIME+4 ADD ATTACHED PROCESSOR VALUE @V4M0203 00737220
  882. BC 12,*+8 .. @V4M0203 00737230
  883. AL R0,F1 .. (CARRY) @V4M0203 00737240
  884. AL R0,VMAPTIME .. @V4M0203 00737250
  885. STM R0,R1,VMTTIME STORE SYNCHRONIZED TOTAL SUPERV. @V4M0203 00737260
  886. LM R0,R1,CHGREGS RESTORE REGS USED @V4M0203 00737270
  887. BR R14 @V4M0203 00737280
  888. SPACE 3 00737290
  889. LTORG 00738000
  890. EJECT 00739000
  891. COPY VMBLOK 00740000
  892. COPY XINTBLOK @V200198 00741000
  893. COPY PERBLOKS PER001 00742000
  894. COPY TIMER 00743000
  895. PSA 00744000
  896. COPY EQU 00745000
  897. COPY SAVE @V407577 00745100
  898. END 00746000