TMR TITLE 'DMKTMR (CP) VM/370 - RELEASE 6' 00001000
ISEQ 73,80 00002000
COPY OPTIONS 00003000
COPY LOCAL OPTIONS @V306638 00004000
EJECT 00005000
*. 00006000
* 00007000
* MODULE NAME - 00008000
* 00009000
* DMKTMR 00010000
* 00011000
* FUNCTION - 00012000
* 00013000
* TO SIMULATE THE CPU TIMER AND TIME OF DAY CLOCK COMPARATOR 00014000
* INSTRUCTIONS FOR VIRTUAL SYSTEM 370'S OPERATING IN EXTENDED 00015000
* CONTROL MODE 00016000
* 00017000
* ATTRIBUTES - 00018000
* 00019000
* REENTRANT, RESIDENT, ENTERED VIA GOTO FROM DMKPRV 00020000
* 00021000
* ENTRY POINTS - 00022000
* 00023000
* DMKTMRTN - SIMULATE TIMER INSTRUCTION 00024000
* DMKTMRCK - SIMULATE VIRTUAL CLOCK COMPARATOR INTERRUPT 00025000
* DMKTMRVT - SIMULATE VIRTUAL CPU TIMER INTERRUPTS 00026000
* DMKTMRPT - CALCULATE USER'S TOTAL VIRTUAL PROBLEM TIME 00027000
* DMKTMRSN - ENTRY TO UPDATE TOTAL VMTTIME USED BY PROCESSORS 00027100
* 00028000
* ENTRY CONDITIONS - 00029000
* 00030000
* GPR11 = ADDRESS OF USER'S VMBLOK 00031000
* GPR12 = ADDRESS OF DMKTMR 00032000
* GPR15 = ADDRESS OF DMKTMRPT (ONLY ON CALLS TO DMKTMRPT) 00033000
* 00034000
* THE FIELD VMINST CONTAINS THE INSTRUCTION TO BE SIMULATED 00035000
* 00036000
* EXIT CONDITIONS - 00037000
* 00038000
* NORMAL - 00039000
* THE REQUESTED INSTRUCTION IS SIMULATED, ANY DATA REQUESTED BY 00040000
* STORE INSTRUCTIONS IS MOVED TO THE USER MEMORY, AND THE PROPER 00041000
* PENDING INTERRUPT STATUS IS POSTED IN THE VMBLOK 00042000
* 00043000
* ERROR - 00044000
* IF OPERATION, ADDRESSING, SPECIFICATION OR PROTECTION VIOLA- 00045000
* TIONS ARE DETECTED IN THE COURSE OF THE SIMULATION, THE 00046000
* APPROPRIATE INTERRUPT CODE IS SET AND A PROGRAM INTERRUPT 00047000
* IS REFLECTED TO THE USER VIA A GOTO TO DMKPRGSM 00048000
* 00049000
* FOR CALLS TO DMKTMRPT ON EXIT GPR 0-1 CONTAINS THE USER'S 00050000
* TOTAL VIRTUAL PROBLEM TIME USED. 00051000
* 00052000
* CALLS TO OTHER ROUTINES - 00053000
* 00054000
* DMKPTRAN - TO LOCATE THE USER'S DATA AREA IN HIS VIRTUAL 00055000
* MEMORY 00056000
* DMKPSAFP - TO CHECK FOR FETCH PROTECTION 00057000
* DMKPSASP - TO CHECK FOR STORAGE PROTECTION 00058000
* INSTRUCTIONS 00059000
* DMKSCHST - TO ESTABLISH A TOD COMPARATOR INTERRUPT REQUEST 00060000
* DMKSCHRT - TO RESET A TOD COMPARATOR INTERRUPT REQUEST 00061000
* DMKSTKIO - TO STACK A PENDING CLOCK COMPARATOR INTERRUPT 00062000
* DMKDSPCH - EXIT VIA GOTO IF INTERRUPT IS PENDING 00063000
* DMKPRGSM - EXIT VIA GOTO TO REFLECT A PROGRAM INTERRUPT 00064000
* DMKSTKDE - TO STACK A DEFERRED USER TASK 00064100
* DMKDSPRU - TO RUN USERS WITHOUT SYSTEM LOCK 00064200
* 00065000
* EXTERNAL REFERENCES - 00066000
* 00067000
* DMKSCHN1 - ADDRESS OF QUEUE 1 TIME INTERVAL 00068000
* DMKSCHN2 - ADDRESS OF QUEUE 2 TIME INTERVAL 00069000
* DMKLOKSY - SYSTEM LOCK WORD 00069100
* 00070000
* TABLES/WORKAREAS - 00071000
* 00072000
* TRQBLOK 00073000
* 00074000
* REGISTER USAGE - 00075000
* 00076000
* GPR0 - SCRATCH 00077000
* GPR1 - VIRTUAL ADDRESS OF USER'S DATA AREA, TRQBLOK BASE 00078000
* GPR2 - REAL ADDRESS OF USER'S DATA AREA 00079000
* GPR3 - ADDRESS OF PROG. INT. ILC/CODE FIELD 00080000
* GPR4-7 DOUBLE PRECISION TIMER ARITHMETIC 00081000
* GPR8 - ECBLOK BASE 00082000
* GPR9-10 UNUSED 00083000
* GPR11 - VMBLOK BASE 00084000
* GPR12 - DMKTMR BASE 00085000
* GPR13 - INTERNAL LINKAGE 00086100
* GPR14-15 EXTERNAL LINKAGE 00087000
* 00088000
* NOTES - 00089000
* 00090000
* NONE 00091000
*. 00092000
EJECT 00093000
DMKTMR CSECT 00094000
SPACE 3 00095000
EXTRN DMKPSAFP CHECK FOR FETCH PROTECTION @V202232 00096000
EXTRN DMKPSASP CHECK FOR STORAGE PROTECTION @V202232 00097000
EXTRN DMKSCHST 00098000
EXTRN DMKSCHRT 00099000
EXTRN DMKPRGSM 00100000
EXTRN DMKDSPA @VA04340 00100100
EXTRN DMKSTKIO 00101000
EXTRN DMKVATRN 00102000
EXTRN DMKVATEX 00103000
EXTRN DMKCVTAB @VA04301 00103100
EXTRN DMKSTKDE @V407577 00103200
AIF (NOT &AP).DSPRU4 00103280
EXTRN DMKDSPRU @V407577 00103300
EXTRN DMKLOKSY @V4M0016 00103310
.DSPRU4 ANOP 00103320
SPACE 00104000
ENTRY DMKTMRTN 00105000
ENTRY DMKTMRCK 00106000
ENTRY DMKTMRVT 00107000
ENTRY DMKTMRCC INTERNAL SYM. 'SCKC'(FOR EVMA) @V386198 00107300
ENTRY DMKTMRSP INTERNAL SYM. 'SPT' " " @V386198 00107600
ENTRY DMKTMRSN @V4M0203 00107700
SPACE 2 00108000
USING PSA,R0 00109000
USING TRQBLOK,R1 00110000
USING ECBLOK,R8 00111000
USING VMBLOK,R11 00112000
USING DMKTMRTN,R12 00113000
EJECT 00114000
*. 00115000
* 00116000
* OPERATION - 00117000
* 00118000
* SECTION A. - INITIALIZATION 00119000
* 00120000
* 1. IF THE OPERATION IS SCK, SKIP TO STEP 3; OTHERWISE, CON- 00121000
* TINUE 00122000
* 2. IF THE USER IS NOT IN EXTENDED PSW MODE, REFLECT AN OPER- 00123000
* ATION EXCEPTION 00124000
* 3. GET THE ADDRESS SPECIFIED IN THE INSTRUCTION; IF IT IS NOT 00125000
* DOUBLE WORD ALIGNED, REFLECT A SPECIFICATION EXCEPTION 00126000
* 4. TRANS FOR USER DATA PAGE; IF THE RESULTING CONDITION CODE 00127000
* INDICATES A VIRTUAL ADDRESSING ERROR, REFLECT IT 00128000
* 5. IF THE INSTRUCTION IS NOT A STORE (2ND OPCODE BYTE IS NOT 00129000
* ODD), SKIP TO STEP 7; OTHERWISE, CONTINUE 00130000
* 6. COMPARE THE VIRTUAL PSW KEY TO THE STORAGE KEY IN THE 00131000
* USER'S PAGE; IF THEY DO NOT AGREE AND IF THE PSW KEY 00132000
* IS NON-ZERO, REFLECT A PROTECTION EXCEPTION 00133000
* 7. GET THE 2ND OPCODE BYTE AND BRANCH TO HANDLE THE REQUESTED 00134000
* INSTRUCTION AS DESCRIBED IN SECTIONS B THROUGH F BELOW 00134200
* 00134400
* 00134600
*********************************************************************** 00134800
* 00135000
* 00135200
* EXPANDED VMA PARTIAL EMULATION FUNCTION FOR SCKC AND SPT: 00135400
* 00135600
* INVOKED BY THESE INSTRUCTIONS WHEN EXECUTED IN PROBLEM STATE 00135800
* WITH CONTROL REGISTER 6 BYTE 0 SET TO B'10X0XX1X' (X = 0 OR 1) 00136000
* AND BIT 2 OF THE ASSIST CONTROLS FULLWORD (OFFSET X'14' INTO 00136020
* MICBLOK) SET TO 1. 00136040
* 00136200
* REGISTER INPUT: 00136400
* CR 6 = BITS 0-7 ARE THE ASSIST FLAGS; BITS 8-28 ADDRESS 00136600
* THE MICBLOK (THE VIRTUAL MACHINE POINTER LIST) 00136800
* 00137000
* SYSTEM DATA AREAS REFERENCED (BY MODULE WHERE APPLICABLE): 00137200
* DMKPRV - 'DMKPRVMA' (EQUALS 'VMALIST') 00137400
* DMKPSA - 'AVMALIST', 'PRNPSW', CPCREGS, TIMER FIELDS, 00137600
* TRACING INFORMATION, 'CPSTATUS', 'PROPSW' 00137800
* MICBLOK, VMBLOK 00138000
* 00138200
* 00138400
* EXIT TO 'DMKTMRCC' (IF SCKC) OR 'DMKTMRSP' (IF SPT) 00138600
* NOTE: THE CONTENT OF ANY UNSPECIFIED GPR IS UNPREDICTABLE. 00138800
* REGISTER OUTPUT: 00139000
* CR 0 = VALUE FROM 'CPCREG0' 00139200
* CR 8 = VALUE FROM 'CPCREG8' 00139400
* GPR 2 = REAL ADDRESS THAT MAPS OP. 2'S VIRTUAL ADDRESS 00139600
* GPR 8 = VALUE FROM 'MICCREG0' (ECBLOK ADDRESS) 00139800
* GPR 11 = X'A8' LESS THAN 'MICVPSW' (ADDRESS OF VMBLOK) 00140000
* GPR 12 = ADDRESS OF 'DMKTMR' 00140200
* 00140400
*********************************************************************** 00140600
*. 00140800
EJECT 00141000
DMKTMRTN EQU * %V3M4038 00141200
CLI VMINST+1,X'04' SCK INSTRUCTION ?? %V3M4038 00141400
BE GETADDR THIS OP ALLOWED FOR BC MODE VM. %V3M4038 00141600
TM VMPSTAT,VMV370R FOR OTHERS MUST HAVE EC MODE %V3M4038 00141800
BO GETADDR THIS GUY IS OK %V3M4038 00142000
LA R0,1 SET OPERATION EXCEPTION 00143000
GOTO DMKPRGSM AND GO REFLECT PROGRAM INTERRUPT 00144000
SPACE 00145000
GETADDR EQU * BUILD VIRTUAL ADDRESS OF OPERAND %V3M4038 00146000
LH R7,VMINST+2 GET %V3M4038 00147000
N R7,F4095 DISPLACEMENT %V3M4038 00148000
IC R8,VMINST+2 GET %V3M4038 00149000
SRL R8,2 BASE %V3M4038 00150000
N R8,F60 REGISTER (F60 = X'3C' FOR MASK) %V3M4038 00151000
BZ NOBASE IF ZERO, SKIP %V3M4038 00152000
L R8,VMGPRS(R8) GET CONTENTS OF BASE REGISTER %V3M4038 00153000
NOBASE LA R7,0(R8,R7) GET ADDRESS -- %V3M4038 00154000
EX R7,TESTALIN TEST FOR DOUBLE WORD ALIGNMENT %V3M4038 00155000
BZ CKADDR BRANCH IF OK TO TEST ADDRESS, %V3M4038 00156000
LA R0,6 OTHERWISE, REFLECT SPECIFICATION 00157000
GOTO DMKPRGSM EXCEPTION 00158000
SPACE 00159000
CKADDR EQU * CHECK OUT ADDRESS %V3M4038 00160000
TM VMESTAT,VMEXTCM IN EC MODE NOW ? %V3M4038 00161000
BZ LEVEL2 NO - GET 2ND LEVEL MEMORY %V3M4038 00162000
TM VMPSW,TRANMODE IN VIRTUAL TRANSLATE MODE ? %V3M4038 00163000
BO LEVEL3 YES - GET 3RD LEVEL MEMORY %V3M4038 00164000
LEVEL2 EQU * %V3M4038 00165000
LCTL C1,C1,VMSEG GET SEGMENT TABLE ORIGIN %V407577 00165100
LRA R2,0(,R7) DO HARDWARE TRANSLATE %V407577 00165200
BC 8,CKSTORE PAGE IS RESIDENT %V407577 00165300
BAL R13,CKDEFER GO CHECK THE SYSTEM LOCK @V407577 00165400
TRANS 2,7,OPT=(BRING,DEFER),ADEX=BADDR @V3M4038 00166000
CKSTORE EQU * JOINED HERE AFTER CALL TO DMKVAT %V3M4038 00167000
TM VMINST+1,1 IS IT A STORE OPERATION ? %V3M4038 00168000
BZ CHKFETCH NO, TEST FOR FETCH PROT. CHECK %V3M4038 00169000
CALL DMKPSASP YES, TEST FOR STORE PROT. CHECK @VA07223 00170000
BNZ KEYUNEQ UNEQUAL, REFLECT PROT. VIOLATION @VA07223 00171000
* 00172000
* TEST FOR SIMULATED PER INTERRUPTS ON STORE TYPE INSTRUCTIONS 00173000
* 00174000
TM VMESTAT,VMPERCM VM ALLOWING PER INTERRUPTS @VA07223 00175000
BZ GETCODE NO - PROCESS INSTRUCTION @VA07223 00176000
TM VMTRCTL,VMTRPER CP PER? PER001 00176100
BZ CHKUSPER NO, USER PER, GO CHECK IT OUT PER001 00176200
L R10,VMPERCTL EXTENSION BLOCK IF TRACING PER.. PER001 00176300
USING PERBLOK,R10 PER001 00176400
LA R15,PERCR9 START OF CR9, CR10, CR11 PER001 00176500
LA R14,PERADDR START OF PERADD, PERCODE PER001 00176600
B TRAPPER GO CHECK OUT THE TRAPS. PER001 00176700
CHKUSPER DS 0H HERE TO CHECK FOR USER PER. PER001 00176800
NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00178200
L R10,VMECEXT EXTENSION VMBLOK ADDRESS 00185000
USING ECBLOK,R10 00186000
LA R15,EXTCR9 START OF CR-9, CR-10, CR-11 00187000
LA R14,EXTPERAD START OF PERADD, PERCODE 00188000
DROP R10 00189000
SPACE 00190000
TRAPPER EQU * GPR-15 = ADDRESS OF CR-9, CR-10, CR-11 00191000
TM 0(R15),PERSALT TRAPPING ON STORAGE ALTERATIONS 00192000
BZ GETCODE NO - PROCESSING INSTRUCTION 00193000
L R0,4(,R15) VIRTUAL START ADDRESS (CR-10) 00194000
CL R0,8(,R15) DOES IT WRAP-AROUND (CL CR-10 CR-11) 00195000
BH PERCH03 YES - MAKES FOR EXTRA WORK 00196000
CLR R0,R7 VIRTUAL ADDRESS IS IN R7 00197000
BL PERCH02 R7 ABOVE LOW BOUNDARY 00198000
BE PERDONE ADDRESSES ARE A PERFECT MATCH. 00199000
LA R4,8(,R7) ADD DW COUNT TO VIRTUAL ADDRESS 00200000
CLR R4,R0 CHECK END OF FIELD 00201000
BH PERDONE HIT IT FOR PER INTERRUPT 00202000
B GETCODE NO PER EVENTS @VA01687 00203000
PERCH02 EQU * R7 ABOVE LOW BOUNDARY 00204000
CL R7,8(,R15) VIRTUAL ADDRESS BELOW TOP END (CR-11) 00205000
BNH PERDONE YES - HIT IT FOR PER INTERRUPT 00206000
B GETCODE NO - NO PER EVENT HERE 00207000
PERCH03 EQU * HERE FOR STORAGE WRAP-AROUND CASE 00208000
CLR R0,R7 BELOW FIRST VALUE (CR-10) 00209000
BNH PERDONE NO, FOUND PER EVENT @VA01687 00210000
CL R7,8(,R15) OR ABOVE LAST VALUE (CR-11) 00211000
BNH PERDONE NO, FOUND PER EVENT @VA01687 00212000
LA R4,8(,R7) ADD DW. FOR FIELD LENGHT. 00213000
CLR R4,R0 BELOW START ADDRESS @VA01687 00214000
BNL PERDONE NO, FOUND PER EVENT @VA01687 00215000
B GETCODE @VA01687 00216000
PERDONE EQU * REFLECT PER INTERRUPT TO USER 00217000
OI 4(R14),PERSALT SET STORAGE ALTERATION FLAG 00218000
TM VMPEND,VMPERPND IS PER EVENT ALREADY PENDING 00219000
BO GETCODE YES - NO NEED TO DO ANY MORE HERE 00220000
MVI 4(R14),PERSALT SET STORAGE ALTERATION FLAG BIT 00221000
MVI 5(R14),X'00' AND CLEAR ALL OTHERS 00222000
L R1,VMPSW+4 LOAD VIRTUAL INSTRUCTION ADDRESS 00223000
SL R1,F4 BACK IT UP WITH INSTRUCTION LENGTH. 00224000
ST R1,0(,R14) STORE ADDRESS IN EXTENSION BLOK 00225000
OI VMPEND,VMPERPND FLAG SUMMARY BIT 00226000
B GETCODE NOW SIMULATE THE INSTRUCTION 00227000
SPACE 00228000
KEYUNEQ EQU * REFLECT PROTECTION ERROR ( MISMATCHED KEYS) 00229000
LA R0,4 OTHERWISE, REFLECT PROTECTION 00230000
GOTO DMKPRGSM VIOLATION 00231000
LEVEL3 EQU * HERE FOR VIRTUAL TRANSLATE MODE 00232000
LR R3,R7 GET VIRTUAL ADDRESS IN GPR3 00233000
TM VMESTAT,VMINVPAG SHADOW TABLES VALID? @VM01060 00234000
BNZ CALLVAT NOPE, TO CALL VAT FOR THIS @VM01060 00235000
L R10,VMECEXT GET ECBLOK ADDRESS @VM01060 00236000
LCTL C0,C1,EXTSHCR0-ECBLOK(R10) GET CREGS @VM01060 00237000
LRA R2,0(,R3) ATTEMPT QUICK TRANSLATE @VM01060 00238000
LCTL C0,C0,CPCREG0 RETURN TO STANDARD... @VM01060 00239000
LCTL C1,C1,VMSEG CONTROL REGS. @VM01060 00240000
BZ CKSTORE PAGE RESIDENT, WALLA @VM01060 00241000
CALLVAT EQU * @VM01060 00242000
BAL R13,CKDEFER GO CHECK THE SYSTEM LOCK @V407577 00242100
CALL DMKVATRN AND GET VIRTUAL-VIRTUAL 00243000
LTR R0,R0 CHECK RETURN CODE 00244000
BZ CKSTORE TRANSLATE OK - CONTINUE 00245000
CL R1,F5 RELOCATION INTERRUPT ? @VA03696 00246000
BE BADDR NO..DONT BACK OFF PSW.. @VA03696 00247000
L R4,VMPSW+4 SET TO BACK UP PSW ADDRESS 00248000
SH R4,VMPRGIL ILC DATA SAVED IN VMBLOK 00249000
ST R4,VMPSW+4 ... 00250000
GOTO DMKVATEX SIMULATE RELOCATION EXCEPTION 00251000
SPACE 3 00252000
CHKFETCH DS 0H SCK - SCKC - SPT %VA07223 00253000
CALL DMKPSAFP CHECK FOR FETCH PROTECT VIOLATION%VA07223 00254000
BNZ KEYUNEQ OOPS - REFLECT PROTECTION ERROR %VA07223 00255000
* OK - CONTINUE: 00256000
GETCODE EQU * GET OP-CODE 2ND BYTE AND GO SIM. %V3M4038 00257000
SR R7,R7 CLEAR BRANCH INDEX %V3M4038 00258000
IC R7,VMINST+1 GET CODE %V3M4038 00259000
SLL R7,2 TIMES 4 %V3M4038 00260000
L R8,VMECEXT POINT TO VMBLOK EXTENSION %V3M4038 00261000
B TIMETABL(R7) GO TO SIMULATION ROUTINE %V3M4038 00262000
SPACE 00263000
ORG *-16 SKIP CODES 0-3 00264000
TIMETABL EQU * 00265000
ORG 00266000
B SCK CODE 04 - "SET TOD CLOCK" 00267000
DC 2H'0' CODE 05 - "STORE TOD CLOCK" NOT TRAPPED 00268000
B SCKC "SET CLOCK COMPARATOR" %V3M4038 00269000
B STCKC CODE 07 - "STORE TOD CLOCK COMPARATOR" 00270000
B SPT CODE 08 - "SET CPU TIMER" %V3M4038 00271000
B STPT CODE 09 - "STORE CPU TIMER" 00272000
SPACE 00273000
BADDR EQU * HERE ON VIRTUAL ADDRESSING EXCEPTION 00274000
LA R0,5 SET ADDRESSING EXCEPTION 00275000
GOTO DMKPRGSM AND REFLECT INTERRUPT 00276000
SPACE 00277000
TESTALIN TM F7+3,0 EXECUTED TO TEST DBLWD ALIGNMENT %V3M4038 00278000
EJECT 00279000
*. 00280000
* OPERATION - 00281000
* 00282000
* SECTION B. - SCK 00283000
* 00284000
* 1. SET CONDITION CODE 0 IN THE USER'S PSW 00285000
* 2. EXIT VIA DMKDSPCH 00286000
* 00287000
* 00288000
*. 00289000
SPACE 2 00290000
SCK EQU * 00291000
TM VMESTAT,VMEXTCM EXTENDED MACHINE ?? 00292000
BZ *+12 NO -- USE VANILLA PSW 00293000
NI VMPSW+2,X'FF'-X'30' SET CC = 0 00294000
B *+8 AND EXIT 00295000
NI VMPSW+4,X'FF'-X'30' SET CC = 0 00296000
B TMRDSPA FAST RE-DISPATCH PATH @VA04340 00297100
EJECT 00298000
*. 00299000
* OPERATION - 00300000
* 00301000
* SECTION C. - SCKC 00302000
* 00303000
* 1. LOCATE THE TRQBLOK FOR THE VIRTUAL CLOCK COMPARATOR; IF THE 00304000
* BLOCK IS QUEUED FOR AN ACTIVE REQUEST, RESET IT VIA A CALL 00305000
* TO DMKSCHRT; OTHERWISE, CONTINUE 00306000
* 2. SAVE THE CURRENT VALUE OF THE TIME OF DAY CLOCK, AND STORE 00307000
* THE NEW VALUE OF THE CLOCK COMPARATOR IN THE TRQBLOK 00308000
* 3. IF THE NEW COMPARATOR VALUE IS LESS THAN OR EQUAL TO THE 00309000
* TOD CLOCK VALUE, STACK THE BLOCK VIA DMKSTKIO, AND EXIT TO 00310000
* DISPATCH; OTHERWISE, 00311000
* 4. SCHEDULE THE BLOK FOR A CLOCK COMPARATOR INTERRUPT VIA DMK- 00312000
* SCHST, AND 00313000
* 5. RESET ANY PENDING CLOCK COMPARATOR INTERRUPT IN THE VMBLOK 00314000
* 00315000
* 00316000
*. 00317000
SPACE 00317500
DMKTMRCC DS 0H NO FAST REDSP ON MICROCODE PATH %V408246 00318000
SCKC EQU * 00319000
L R1,EXTCCTRQ POINT TO TRQBLOK FOR CLOCK COMPARATOR REQ 00320000
L R3,TRQBFPNT IS THE REQUEST ACTIVE ?? 00321000
LTR R3,R3 ?? 00322000
BZ SETREQ NO -- NO NEED TO RESET - 00323000
CALL DMKSCHRT RESET THE OUTSTANDING REQUEST 00324000
SPACE 00325000
SETREQ EQU * 00326000
STCK TRQBTOD SAVE CURRENT VALUE OF TOD CLOCK 00327000
BC 12,CLOCKOK IS CLOCK FUNCTIONING? @VA04301 00327250
GOTO DMKCVTAB CLOCK DAMAGED...ABEND CVT001 @VA04301 00327500
CLOCKOK EQU * @VA04301 00327750
MVC TRQBVAL,0(R2) SET VALUE OF REQUESTED INTERRUPT 00328000
CLC TRQBVAL,TRQBTOD INTERRUPT ALREADY PENDING ?? 00329000
LR R10,R1 POINT TO BLOCK FOR STACK @V200198 00330000
BH QREQUEST GO QUEUE THE TIMER REQUEST @V200198 00331000
CALL DMKSTKIO ALREADY GIVEN 00332000
NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00332400
B TMREXIT DISPATCH WILL UNSTACK FOR IRA 00333000
SPACE 00334000
QREQUEST EQU * 00335000
L R0,=X'10400000' GET CLOCK COMPARATOR COLLATING @V200198 00336000
* VALUE 00337000
LA R1,VMPXINT @V200198 00338000
CKCLOOP LR R2,R1 @V200198 00339000
L R1,XINTNEXT-XINTBLOK(,R2) @V200198 00340000
LTR R1,R1 @V200198 00341000
BZ CKCLEND @V200198 00342000
C R0,XINTSORT-XINTBLOK(,R1) @V200198 00343000
BH CKCLOOP @V200198 00344000
BL CKCLEND @V200198 00345000
L R0,XINTNEXT-XINTBLOK(,R1) @V200198 00346000
ST R0,XINTNEXT-XINTBLOK(,R2) @V200198 00347000
LA R0,XINTSIZE @V200198 00348000
CALL DMKFRET @V200198 00349000
CKCLEND LR R1,R10 POINT TO TRQBLOK @V200198 00350000
CALL DMKSCHST SET UP INTERRUPT REQUEST @V200198 00351000
B TMREXIT AND GO DISPATCH - PSW UNCHANGED 00352000
EJECT 00353000
*. 00354000
* 00355000
* OPERATION - 00356000
* 00357000
* SECTION D. - STCKC 00358000
* 00359000
* 1. GET TRQBLOK FOR CLOCK COMPARATOR 00360000
* 2. MOVE CLOCK COMPARATOR VALUE TO USER 00361000
* 3. EXIT VIA GOTO TO DMKDSPCH- PSW UNCHANGED 00362000
* 00363000
*. 00364000
SPACE 2 00365000
STCKC EQU * 00366000
L R1,EXTCCTRQ POINT TO TRQBLOK FOR CKC 00367000
MVC 0(8,R2),TRQBVAL MOVE VALUE IN COMPARATOR TO USER 00368000
B TMREXIT AND GO TO DISPATCH 00369000
EJECT 00370000
*. 00371000
* 00372000
* OPERATION - 00373000
* 00374000
* SECTION E. - SPT 00375000
* 00376000
* 1. IF THE VIRTUAL CPU TIMER IS IN THE REAL CPU TIMER; 00377000
* SUBTRACT THE VALUE IN VMTMOUYQ FROM EXTCPTMR. WITH 00378000
* THE DIFFERENCE SUBTRACT FROM TRQBQUE; TRQBQUE WILL NOW 00379000
* CONTAIN THE AMOUNT OF TIME THAT THIS USER IS ALLOWED 00380000
* TO STAY IN THE SCHEDULAR QUEUE. STORE THIS USER'S NEW 00381000
* TIMER VALUE IN EXTCPTMR. IF THE NEW TIMER VALUE IS LESS 00382000
* THAN THE QUEUE DROP INTERVAL (TRQBQUE), STORE USER'S NEW 00383000
* TIMER VALUE IN VMTMOUTQ AND FLAG THE VMBLOK THAT THE SYSTEM 00384000
* IS TRACKING HIS VIRTUAL CPU TIMER. IF THE NEW VIRTUAL CPU 00385000
* TIMER VALUE IS GREATER THAN THE VALUE IN TRQBQUE MOVE 00386000
* TRQBQUE TO VMTMOUTQ. VMTMOUTQ WILL ALWAYS CONTAIN EITHER 00387000
* A VIRTUAL CPU TIMER VALUE OR QUEUE DROP TIME INTERVAL. 00388000
* 00389000
* 2. IF THE VIRTUAL CPU TIMER IS NOT IN THE REAL CPU TIMER; 00390000
* MOVE VMTMOUTQ TO TRQBQUE, THE RESULT IN THE AMOUNT 00391000
* OF TIME STILL ALLOWED TO REMAIN IN A QUEUE. IF THE USER'S 00392000
* NEW VIRTUAL CPU TIMER IF LESS THAN THE VALUE IN TRQBQUE 00393000
* STORE HIS TIMER VALUE IN VMTMOUTQ. OTHERWISE LEAVE VMTMOUTQ 00394000
* EQUAL TO TRQBQUE. IN ANY CASE EXTCPTMR WILL CONTAIN HIS 00395000
* NEW VIRTUAL CPU TIMER VALUE. 00396000
* 00397000
* 3. EXIT TO DISPATCHER 00398000
* 00399000
*. 00400000
SPACE 00400500
DMKTMRSP DS 0H NO FAST REDSP ON MICROCODE PATH %V408246 00401000
SPT EQU * 00402000
DROP R1,R8 00403000
L R10,VMECEXT 00404000
USING ECBLOK,R10 00405000
L R9,EXTCPTRQ 00406000
USING TRQBLOK,R9 00407000
SPACE 00408000
LA R1,1 CONSTANT FOR ARITHMETIC 00409000
LM R3,R4,VMTMOUTQ REMAINING TIME LEFT IN QUEUE 00410000
LTR R3,R3 DID IT GO NEGATIVE DURING SIMULATION 00411000
BNM *+8 NO, ITS OK TO USE IT 00412000
LM R3,R4,ZEROES MUST NOT BE NEGATIVE 00413000
LM R5,R6,TRQBQUE TIME OF LAST VALUE USER WAS RUNNING 00414000
TM VMTLEVEL,VMCPUTMR ARE WE TRACKING VIRTUAL CPU TIMER 00415000
BO TRKTMR YES - SPECIAL HANDLING 00416000
LR R5,R3 REMAINING TIME TO LEAVE IN QUEUE 00417000
LR R6,R4 ..... 00418000
B NOTRKTMR 00419000
SPACE 00420000
TRKTMR EQU * HERE IF TRACKING VIRTUAL CPU TIMER 00421000
LM R7,R8,EXTCPTMR USERS VIRTUAL CPU TIMER VALUE 00422000
SLR R8,R4 CALCULATE HOW LONG USER 00423000
BC 8+2+1,*+6 HAS BEEN RUNNING IN 00424000
SLR R7,R1 PROBLEM STATE SINCE LAST 'STPT' OR 'SPT' 00425000
SLR R7,R3 INSTRUCTION ..... 00426000
SLR R6,R8 USE THIS FACTOR SO THAT WHEN 00427000
BC 8+2+1,*+6 SCHEDULAR DROP'S HIM FROM THE QUEUE 00428000
SLR R5,R1 WE WON'T FOWL UP VIRTUAL CPU TIME... 00429000
SLR R5,R7 ..... 00430000
NOTRKTMR NI VMTLEVEL,X'FF'-VMCPUTMR NOLONGER TRACKING CPU TIMER 00431000
TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00431100
BZ NOPROBT NO, CONTINUE NORMALLY @VA07582 00431200
BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00431300
* VMTMOUTQ IS TO BE CHANGED 00431400
STM R5,R6,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00431500
NOPROBT DS 0H @VA07582 00431600
STM R5,R6,TRQBQUE SAVE RESULT FOR SCHEDULAR.. 00432000
STM R5,R6,VMTMOUTQ SAVE TIME TILL QUEUE DROP.. 00433000
LM R7,R8,0(R2) GET NEW TIMER VALUE FROM USER 00434000
STM R7,R8,EXTCPTMR STORE NEW VALUE IN EXTENSION BLOK 00435000
LTR R7,R7 IS NEW TIMER VALUE POSITIVE 00436000
BNM TMRPLUS YES - RESET PENDING FLAGS 00437000
CPTADD LM R5,R6,=X'1050000010050400' SORT VALUE, CODE @V200198 00438000
* AND MASK 00439000
LA R2,VMPXINT BEGINNING OF CHAIN @V200198 00440000
CPTINT LR R4,R2 SAVE THIS @V200198 00441000
TM VMPSW,EXTMASK ENABLED FOR EXTERNAL INT. @VA04340 00441100
BZ TMR001 NO - @VA04340 00441200
NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00441310
TMR001 EQU * @VA04340 00441400
L R2,XINTNEXT-XINTBLOK(,R4) GET NEXT BLOK @V200198 00442000
LTR R2,R2 ANYTHING THERE? @V200198 00443000
BZ INTADD NO, ADD ONE @V200198 00444000
C R5,XINTSORT-XINTBLOK(,R2) A MATCH? @V200198 00445000
BH CPTINT NO, KEEP LOOKING @V200198 00446000
BE TMREXIT ALREADY ONE PENDING @V200198 00447000
INTADD LA R0,XINTSIZE SIZE OF NEEDED BLOCK @V200198 00448000
CALL DMKFREE @V200198 00449000
ST R1,XINTNEXT-XINTBLOK(,R4) CHAIN IN NEW BLOCK @V200198 00450000
ST R2,XINTNEXT-XINTBLOK(,R1) .. @V200198 00451000
STM R5,R6,XINTSORT-XINTBLOK(R1) FILL IN SORT FIELD, @V200198 00452000
* INTERRUPT CODE AND MASK 00453000
SLR R0,R0 @V200198 00454000
ST R0,XINTPARM-XINTBLOK(,R1) ZERO FIELD @V200198 00455000
B TMREXIT EXIT TO DISPATCHER 00456000
TMRPLUS L R5,=X'10500000' COLLATING VALUE @V200198 00457000
LA R1,VMPXINT CHAIN ANCHOR @V200198 00458000
CPTLOOP LR R2,R1 SAVE HERE @V200198 00459000
L R1,XINTNEXT-XINTBLOK(,R2) GET NEXT BLOCK @V200198 00460000
LTR R1,R1 ANYTHING THERE? @V200198 00461000
BZ CPTLEND NO, ALL DONE @V200198 00462000
C R5,XINTSORT-XINTBLOK(,R1) A MATCH? @V200198 00463000
BH CPTLOOP NO, KEEP LOOKING @V200198 00464000
BL CPTLEND NONE HERE @V200198 00465000
L R0,XINTNEXT-XINTBLOK(,R1) UNCHAIN BLOCK @V200198 00466000
ST R0,XINTNEXT-XINTBLOK(,R2) .. @V200198 00467000
LA R0,XINTSIZE SIZE OF BLOCK @V200198 00468000
CALL DMKFRET @V200198 00469000
CPTLEND EQU * @V200198 00470000
CLC EXTCPTMR,TRQBQUE IS VIRT TIMER < QUEUE DROP TIME 00471000
BH TMREXIT NO - 00472000
STM R7,R8,VMTMOUTQ YES - STORE VIRTUAL CPU TIMER 00473000
OI VMTLEVEL,VMCPUTMR INDICATE TRACKING VIRTUAL CPU TIMER 00474000
TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00474100
BZ TMREXIT NO, CONTINUE NORMALLY @VA07582 00474200
STM R7,R8,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00474300
B TMREXIT AND TO TO DISPATCH, PSW UNCHANGED 00475000
SPACE 00475100
INCPROBT DS 0H INCREMENT PROBLEM STATE TIME @VA07582 00475200
LM R0,R1,VMTMOUTQ GET TIMER AT PROBLEM STATE END @VA07582 00475300
LM R7,R8,PROBSTRT GET TIMER AT PROBLEM STATE START @VA07582 00475400
SLR R8,R1 CALC 2ND HALF OF ELAPSED TIME @VA07582 00475500
BNM *+6 WAS THERE A CARRY? @VA07582 00475600
BCTR R7,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00475700
SLR R7,R0 CALC 1ST HALF OF ELAPSED TIME @VA07582 00475800
LM R0,R1,PROBTIME GET TOTAL PROBLEM TIME @VA07582 00475900
SLR R1,R8 SUBTRCT 2ND HALF OF ELAPSED TIME @VA07582 00476000
BNM *+6 WAS THERE A CARRY? @VA07582 00476100
BCTR R0,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00476200
SLR R0,R7 SUBTRCT 1ST HALF OF ELAPSED TIME @VA07582 00476300
STM R0,R1,PROBTIME STORE NEW TOTAL PROBLEM TIME @VA07582 00476400
BR R14 RETURN TO CALLER @VA07582 00476500
EJECT 00476600
*. 00477000
* 00478000
* OPERATION - 00479000
* 00480000
* SECTION F. - STPT 00481000
* 00482000
* 1. IF THE VIRTUAL CPU TIMER IS IN THE REAL CPU TIMER; 00483000
* SUBTRACT THE VALUE IN VMTMOUTQ FROM EXTCPTMR WHICH RESULTS 00484000
* IN A TIME DIFFERENCE, SINCE TRQBQUE WAS LAST UPDATED. 00485000
* WITH THIS DIFFERENCE SUBTRACT IT FROM TRQBQUE. THE VALUE 00486000
* LEFT IN TRQBQUE IS THE AMOUNT OF TIME REMAINING THAT THIS 00487000
* USER WILL BE ALLOWED TO STAY IN A QUEUE. LASTLY MOVE THE 00488000
* VALUE IN VMTMOUTQ TO EXTCPTMR WHICH IS THIS USER'S VIRTUAL 00489000
* CPU TIMER VALUE. STORE EXTCPTMR IN USER'S VIRTUAL MEMORY. 00490000
* 00491000
* 2. IF THE VIRTUAL CPU TIMER IS NOT IN THE REAL CPU TIMER; 00492000
* SUBTRACT THE VALUE IN VMTMOUTQ FROM TRQBQUE. THE DIFFERENCE 00493000
* IS THE AMOUNT OF TIME THAT WILL BE SUBTRACTED FROM EXTCPTMR 00494000
* TO UPDATE HIS VIRTUAL TIMER. STORE THIS NEW VALUE IN THE 00495000
* USER'S VIRTUAL MEMORY. LASTLY MOVE VMTMOUTQ TO TRQBQUE TO 00496000
* RE-ESTABLISH A TIME INTERVAL DIFFERENCE. 00497000
* 00498000
* 3. EXIT TO DISPATCHER 00499000
* 00500000
*. 00501000
SPACE 2 00502000
STPT EQU * 00503000
L R10,VMECEXT 00504000
USING ECBLOK,R10 00505000
L R9,EXTCPTRQ GET TIMER REQUEST BLOK 00506000
USING TRQBLOK,R9 ... 00507000
SPACE 00508000
LA R1,1 CONSTANT 00509000
LM R3,R4,VMTMOUTQ GET TIME REMAINING IN QUEUE 00510000
LTR R3,R3 DID IT GO NEGATIVE DURING SIMULATION 00511000
BNM *+8 NO, ITS OK TO USE IT 00512000
LM R3,R4,ZEROES MUST NOT BE A NEGATIVE NUMBER 00513000
SPACE 00516000
TM VMTLEVEL,VMCPUTMR IS VIRTUAL CPU TIMER EQUAL REAL ? 00517000
BO TRKSTPT YES - THATS EASY @VA04340 00518100
LM R5,R6,TRQBQUE GET LAST TIME PUT IN QUE @VA04340 00518200
LM R7,R8,EXTCPTMR GET HIS VIRTUAL CPU TIMER @VA04340 00518300
SPACE 00519000
SLR R6,R4 CALCULATE AMOUNT OF TIME ELAPSED 00520000
BC 8+2+1,*+6 SINCE QUEUE WAS UPDATED 00521000
SLR R5,R1 ... 00522000
SLR R5,R3 ... 00523000
SPACE 00524000
SLR R8,R6 WITH RESULT SUBTRACT FROM 00525000
BC 8+2+1,*+6 VIRTUAL CPU TIMER ,, GIVING 00526000
SLR R7,R1 TRUE TIME FOR THIS USER.. 00527000
SLR R7,R5 ... 00528000
SPACE 00529000
STM R7,R8,0(R2) STORE HIS CPU TIMER @VA04340 00530100
B TMREXIT GOTO DISPATCHER 00533000
SPACE 00534000
TRKSTPT EQU * HERE IF TRACKING VIRTUAL CPU TIMER 00535000
STM R3,R4,0(R2) STORE HIS CPU TIMER @VA04340 00536100
B TMREXIT AND EXIT TO DISPATCH 00551000
EJECT 00552000
*. 00553000
* 00554000
* OPERATION - 00555000
* 00556000
* SECTION G. - VIRTUAL CLOCK COMPARATOR INTERRUPT 00557000
* 00558000
* 1. FLAG THE TRQBLOK AS NO LONGER OUTSTANDING 00559000
* 2. FLAG THE USER'S VMBLOK WITH A CLOCK COMPARATOR INTERRUPT 00560000
* PENDING 00561000
* 3. EXIT TO THE DISPATCHER 00562000
* 00563000
*. 00564000
SPACE 2 00565000
USING TRQBLOK,R10 00566000
USING *,R12 00567000
DMKTMRCK EQU * 00568000
L R12,=A(DMKTMRTN) STANDARD 00569000
USING DMKTMRTN,R12 ADDRESSABILITY -- 00570000
NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00570200
SR R0,R0 CLEAR OUT 00571000
ST R0,TRQBFPNT QUEUE POINTER TO INDICATE INACTIVE BLOK 00572000
XINTQUE SLR R5,R5 PARAMETER IS MEANINGLESS HERE @V200198 00573000
LM R3,R4,=X'1040000010040800' SET UP SORT FIELD @V200198 00574000
* AND CODE 00575000
LA R2,VMPXINT START OF EXTERNAL INTERRUPT @V200198 00576000
* BLOCKS 00577000
XINTLOOP LR R6,R2 PRESERVE POINTER TO PREVIOUS @V200198 00578000
L R2,XINTNEXT-XINTBLOK(,R6) NEXT? @V200198 00579000
LTR R2,R2 @V200198 00580000
BZ XINTADD NOPE, ADD TO END OF CHAIN @V200198 00581000
C R3,XINTSORT-XINTBLOK(,R2) @V200198 00582000
BH XINTLOOP KEEP LOOKING... @V200198 00583000
BZ TMRDSPCH TAKE LONG DISPATCHER PATH. @VA05296 00584100
XINTADD LA R0,XINTSIZE NUMBER OF DOUBLEWORDS @V200198 00585000
CALL DMKFREE GET BLOCK FORM FREE STORAGE @V200198 00586000
ST R1,XINTNEXT-XINTBLOK(,R6) @V200198 00587000
STM R2,R5,XINTNEXT-XINTBLOK(R1) BUILD NEW @V200198 00588000
* INTERRUPT BLOCK 00589000
B TMRDSPCH TAKE LONG DISPATCHER PATH. @VA05296 00590100
EJECT 00591000
*. 00592000
* 00593000
* OPERATION - 00594000
* 00595000
* SECTION H. - REAL CPU TIMER INTERRUPTS ARE PROCESSED HERE 00596000
* WHEN THE REAL CPU TIMER CONTAINS THE VIRTUAL 00597000
* CPU TIMER INTERVAL. THIS DECISION IS MADE WHEN 00598000
* THE VIRTUAL MACHINE IS PUT INTO A QUEUE BY 00599000
* THE SCHEDULAR OR 'STPT' INSTRUCTION IS MADE. 00600000
* 00601000
* 1. ON CPU TIMER INTERRUPTS CALCULATE THE PROBLEM STATE TIME 00602000
* USED; SUBTRACT THE VALUE IN EXTCPTMR FROM TRQBQUE. 00603000
* THE RESULT IS THE TIME THIS USER IS ALLOWED TO REMAIN 00604000
* IN A QUEUE. MOVE VMTMOUTQ TO EXTCPTMR AND STORE THE 00605000
* REMAINING QUEUE TIME IN VMTMOUTQ. 00606000
* 00607000
* 2. FLAG VMBLOK THAT AN EXTERNAL INTERRUPT IS PENDING. 00608000
* 00609000
* 3. RESET VMCPUTMR FLAG IN THE VMBLOK TO INDICATE THAT 00610000
* REAL CPU TIMER IS NO-LONGER TRACKING VIRTUAL CPU TIMER. 00611000
* 00612000
* 4. GOTO DISPATCHER TO PROCESS THE INTERRUPT FOR THIS 00613000
* VIRTUAL MACHINE. 00614000
* 00615000
*. 00616000
DMKTMRVT EQU * PROCESS CPU TIMER INTERRUPTS FOR VIRTUAL MACHINES 00617000
USING *,R12 00618000
DROP R10 00619000
L R12,=A(DMKTMRTN) STANDARD ADDRESSABILITY 00620000
USING DMKTMRTN,R12 ... 00621000
L R10,VMECEXT GET EC VMBLOK EXTENSION 00622000
USING ECBLOK,R10 ... 00623000
L R9,EXTCPTRQ GET TIMER REQUEST BLOK 00624000
USING TRQBLOK,R9 ... 00625000
NI VMDSTAT,255-VMDSP NO FAST REDSP @V408246 00625200
LM R4,R5,TRQBQUE GET TIME REMAINING IN QUEUE FOR USER 00626000
LM R6,R7,EXTCPTMR GET CPU TIMER VALUE BEFORE INTERRUPT 00627000
SPACE 00628000
LA R3,1 CONSTANT FOR PRECISION ARITHMETIC 00629000
SLR R5,R7 CALCULATE TIME REMAINING FOR 00630000
BC 8+2+1,*+6 USER TO BE ALLOWED TO STAY 00631000
SLR R4,R3 IN THIS QUEUE. 00632000
SLR R4,R6 ... 00633000
LM R6,R7,VMTMOUTQ MOVE REAL TIMER VALUE TO VIRT. CPU TIMER 00634000
STM R6,R7,EXTCPTMR ... 00635000
STM R4,R5,TRQBQUE SAVE CPU TIMER NOW 00636000
BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00636100
* VMTMOUTQ IS TO BE CHANGED @VA07582 00636200
STM R4,R5,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00636300
STM R4,R5,VMTMOUTQ SAVE REMAINING TIME ALLOWED IN QUEUE 00637000
NI VMTLEVEL,X'FF'-(VMCPUTMR+VMTMRINT) RESET TIMER FLAGS 00638000
B CPTADD GO STACK CPU TIMER INTERRUPT @V200198 00639000
SPACE 2 00640000
EJECT 00641000
TMREXIT EQU * GENERAL EXIT FROM DMKTMR 00642000
SPACE 00643000
LA R13,TMRNIEX EXIT POINT WITH SYSTEM LOCK @V407577 00644100
AIF (NOT &AP).APCHK4 00644110
TM APSTAT1,APUOPER RUNNING IN AP MODE? @VA07493 00644150
BZR R13 NO FORGET ABOUT LOCKS @VA08029 00644210
L R1,=A(DMKLOKSY+2) ADDRESS OF LOCKWORD @VA07493 00644250
CLC LPUADDR,0(R1) LOCK ALREADY HELD? @VA07493 00644300
BER R13 YES..DO NOT FAST REFLECT @V407577 00644500
B GETLOCK TRY TO OBTAIN SYSTEM LOCK @VA08029 00644850
AGO .APCHK5 00645000
.APCHK4 ANOP 00645050
BR R13 NORMAL EXIT FROM DMKTMR @VA07493 00645100
.APCHK5 ANOP 00645150
SPACE 1 00645375
TMRDSPA NI VMRSTAT,X'FF'-VMEXWAIT REMOVE FROM SIMULATION @VA04340 00645400
* WAIT 00645425
GOTO DMKDSPA TRY FAST RE-DISPATCH @VA04340 00645450
SPACE 1 00645475
TMRNIEX NI VMRSTAT,X'FF'-VMEXWAIT REMOVE FROM SIMULATION @V407577 00645520
* WAIT 00645540
TMRDSPCH GOTO DMKDSPCH TAKE LONG DISPATCHER PATH @V407577 00645560
AIF (NOT &AP).APCHK6 00645575
CKDEFER TM CPSTATUS,CPRUN ENTERED FROM FLIH? @V407577 00645580
BNOR R13 NO...SYSTEM LOCK IS HELD @V407577 00645600
TM APSTAT1,APUOPER RUNNING IN AP MODE? @VA07493 00645605
BZR R13 NO, SKIP LOCK LOGIC @VA07493 00645610
L R15,=A(DMKLOKSY+2) ADDRESS OF LOCKWORD @VA07493 00645615
CLC LPUADDR,0(R15) LOCK ALREADY HELD? @VA07493 00645620
BER R13 YES, DON'T TRY TO OBTAIN @VA07493 00645625
GETLOCK LOCK OBTAIN,TYPE=SYS,SPIN=NO,SAVE @VA07480 00645630
BZR R13 GOT IT..RETURN TO CALLER @V407577 00645640
L R1,VMDFTPNT POINTER TO THE DEFER BLOCK @V407577 00645660
USING CPEXBLOK,R1 @V407577 00645680
STM R0,R15,CPEXREGS SAVE THE REGISTERS @V407577 00645700
ST R13,CPEXADD AND THE EXECUTION ADDRESS @V407577 00645720
CALL DMKSTKDE AND STACK FOR DISPATCH @V407577 00645740
GOTO DMKDSPRU EXIT TO RUN USERS @V407577 00645760
AGO .APCHK7 00645800
.APCHK6 ANOP 00645820
CKDEFER BR R13 IS NO SYSTEM LOCK IN UP MODE @V407577 00645840
.APCHK7 ANOP 00645860
EJECT 00646000
LTORG 00647000
*. 00648000
* 00649000
* OPERATION - 00650000
* 00651000
* SECTION I. CALLED BY OTHER SYSTEM ROUTINES TO CALCULATE 00652000
* THE AMOUNT OF VIRTUAL PROBLEM TIME USED. 00653000
* 00654000
* 00655000
* 1. IF USER IS NOT THE DISPATCH RUNUSER LOAD R0-1 WITH VMVTIME 00656000
* AND RETURN TO THE CALLER. 00657000
* 00658000
* 2. IF USER IS NOT RUNNING WITH EC-MODE OPTION, SUBTRACT 00659000
* VMTMOUTQ FROM QUEUE DROP TIME INTERVAL. ADD TO THIS THE 00660000
* VALUE IN VMVTIME AND LOAD R0-1 WITH THE RESULT. 00661000
* 3. IF USER IS RUNNING WITH EC-MODE OPTION AND THE REAL CPU 00662000
* TIMER IS NOT TRACKING THE VIRTUAL CPU TIMER DO SAME 00663000
* AS IDEM 2. 00664000
* 00665000
* 4. FOR EC-MODE MACHINES WHEN THE REAL CPU TIMER IS TRACKING 00666000
* THE VIRTUAL CPU TIMER DO THE FOLLOWING.. 00667000
* A. SUBTRACT VMTMOUTQ FROM EXTCPTMR AND WITH THE RESULT 00668000
* SUBTRACT FROM TRQBQUE. WITH THIS DIFFERENCE SUBTRACT 00669000
* FROM THE SCHEDULAR QUEUE DROP INTERVAL. THE RESULTING 00670000
* VALUE WILL BE THE AMOUNT THAT THE SCHEDULAR WILL ADD 00671000
* TO VMVTIME FIELD. WITHOUT UPDATING VMVTIME ADD VMVTIME 00672000
* TO THE FACTOR THAT WAS JUST CALCULATED. LOAD R0-1 00673000
* WITH THIS VALUE AND RETURN TO THE CALLER. 00674000
* 00675000
* 00676000
*. 00677000
EJECT 00678000
ENTRY DMKTMRPT 00679000
DMKTMRPT DS 0F 00680000
USING *,R15 ADDRESSABILTY 00681000
L R15,=A(DMKTMRTN) ... 00682000
DROP R12 00683000
USING DMKTMRTN,R15 00684000
LM R0,R1,VMVTIME GET PROBLEM TIME ALREADY USED 00685000
TM VMDSTAT,VMINQ IS USER IN A QUEUE? @VA05287 00686100
BNO TIMEXIT NO - VMVTIME FIELD IS CORRECT AS STANDS 00687000
SPACE 00688000
STM R2,R8,BALR2 SAVE USER'S REGISTER'S 00689000
LA R8,1 CONSTANT FOR AIRTHMETIC 00690000
LM R2,R3,VMTMOUTQ GET TIME REMAINING IN THE QUEUE 00691000
LTR R2,R2 WAS ALL THE ALLOCATED TIME USED? @VA04063 00692300
BNM *+8 NO...USE VALUE THAT REMAINS @VA04063 00692600
LM R2,R3,ZEROES CAN'T USE A NEGATIVE NUMBER @VA04063 00692900
TM VMTLEVEL,VMCPUTMR IS VIRTUAL CPU TIMER IN REAL TIMER 00693000
BNO NOTVIRT NO - NO INVOLVED AIRTHMETIC IS NEEDED 00694000
SPACE 00695000
L R7,VMECEXT GET VMBLOK EXTENSION 00696000
LM R4,R5,EXTCPTMR-ECBLOK(R7) LOAD UP VIRTUAL CPU TIMER 00697000
L R7,EXTCPTRQ-ECBLOK(,R7) GET ADDR. OF TIMER BLOK 00698000
LM R6,R7,TRQBQUE-TRQBLOK(R7) GET TIME REMAINING IN QUEUE 00699000
SPACE 00700000
SLR R5,R3 FIND DIFFERENCE IN 'TIME' BETWEEN 00701000
BC 8+2+1,*+6 THE VALUES IN VMTMOUTQ AND 00702000
SLR R4,R8 EXTCPTMR FIELDS.. 00703000
SLR R4,R2 ... 00704000
SPACE 00705000
SLR R7,R5 WITH THIS DIFFERENCE; SUBTRACT 00706000
BC 8+2+1,*+6 THIS VALUE FROM TRQBQUE; THE RESULT 00707000
SLR R6,R8 IS THE AMOUNT OF TIME WHICH IS 00708000
SLR R6,R4 LEFT BEFORE BEING DROPPED FROM QUEUE. 00709000
SPACE 00710000
LR R2,R6 PUT IN R2 00711000
LR R3,R7 PUT IN R3 00712000
SPACE 00713000
NOTVIRT TM VMQLEVEL,VMQ1 IS USER IN Q1? @V408246 00714000
BZ QUEUE2 NO - MUST BE IN QUEUE 2. 00715000
L R7,=V(DMKSCHN1) ADDR. OF QUEUE 1 TIME INTERVAL 00716000
SL R7,F8 .... 00717000
LM R4,R5,0(R7) GET ACTUAL TIME INTERVAL FOR QUEUE 1 00718000
B COMPVTM PROCESS VIRTUAL PROBLEM TIME. 00719000
SPACE 00720000
QUEUE2 L R7,=V(DMKSCHN2) ADDR. OF QUEUE 2 TIME INTERVAL 00721000
SL R7,F8 ... 00722000
LM R4,R5,0(R7) GET ACTUAL TIME INTERVAL FOR QUEUE 2. 00723000
SPACE 00724000
COMPVTM SLR R5,R3 FIND THE TIME INTERVAL THAT 00725000
BC 8+2+1,*+6 USER ACTUALLY RAN; 00726000
SLR R4,R8 IN PROBLEM STATE CONDITION. 00727000
SLR R4,R2 ... 00728000
LTR R4,R4 TRAP NEGATIVE VALUE @V408246 00728100
BNM *+8 OK @V408246 00728200
LM R4,R5,0(R7) RECOVER WITH 'POSSIBLE' VALUE @V408246 00728300
SPACE 00729000
ALR R1,R5 ADD THIS TIME SLICE TO THE TOTAL 00730000
BC 8+4,*+6 VIRTUAL PROBLEM STATE TIME FOR 00731000
ALR R0,R8 THIS USER. 00732000
ALR R0,R4 PASS RESULT BACK IN R0-1. 00733000
SPACE 00734000
LM R2,R8,BALR2 RESTORE CALLER'S REGISTERS 00735000
TIMEXIT ST R14,BALR14 SAVE CALLER'S R14 @V4M0203 00736100
CHARGE SYNC UPDATE VMTTIME @V4M0203 00736200
L R14,BALR14 RESTORE CALLER'S R14 @V4M0203 00736300
BR R14 RETURN TO CALLER @V4M0203 00736400
EJECT 00737010
*. 00737020
* OPERATION - 00737030
* 00737040
* SECTION J. CALLED BY OTHER SYSTEM ROUTINES TO AGGREGATE THE 00737050
* SUPERVISOR STATE CHARGES OF EACH OF THE PROCESSORS 00737060
* AND UPDATE VMTTIME TO REFLECT TOTAL SUPERVISOR 00737070
* STATE. 00737080
* 00737090
* AT ENTRY: 00737100
* GPR 11 = VMBLOK OF THE USER TO BE CHARGED 00737110
* GPR 14 = RETURN REGISTER 00737120
* AT EXIT: 00737130
* THE VMTTIME FIELD OF R11 VMBLOK HAS BEEN UPDATED 00737140
*. 00737150
DMKTMRSN DS 0F @V4M0203 00737160
USING *,R15 ADDRESSABILITY @V4M0203 00737170
TM APSTAT1,APUOPER TEST FOR MULTIPLE PROCS @V4M0203 00737180
BZR R14 ONE PROCESSOR UPDATE UNNECESSARY @V4M0203 00737190
STM R0,R1,CHGREGS PRESERVE REGS DURING UPDATE @V4M0203 00737200
LM R0,R1,VMCPTIME PICK UP MAIN PROCESSOR VALUE @V4M0203 00737210
AL R1,VMAPTIME+4 ADD ATTACHED PROCESSOR VALUE @V4M0203 00737220
BC 12,*+8 .. @V4M0203 00737230
AL R0,F1 .. (CARRY) @V4M0203 00737240
AL R0,VMAPTIME .. @V4M0203 00737250
STM R0,R1,VMTTIME STORE SYNCHRONIZED TOTAL SUPERV. @V4M0203 00737260
LM R0,R1,CHGREGS RESTORE REGS USED @V4M0203 00737270
BR R14 @V4M0203 00737280
SPACE 3 00737290
LTORG 00738000
EJECT 00739000
COPY VMBLOK 00740000
COPY XINTBLOK @V200198 00741000
COPY PERBLOKS PER001 00742000
COPY TIMER 00743000
PSA 00744000
COPY EQU 00745000
COPY SAVE @V407577 00745100
END 00746000