PSA TITLE 'DMKPSA (CP) VM/370 - RELEASE 6' 00001000
ISEQ 73,80 VALIDATE SEQUENCING OF SYSIN 00002000
*. 00003000
* MODULE NAME - 00004000
* 00005000
* DMKPSA 00006000
* 00007000
* CONTENTS - 00008000
* 00009000
* DMKPSAEX - EXTERNAL INTERRUPT HANDLER 00010000
* DMKPSADU - PSW RESTART ENTRY 00011000
* 00012000
* FUNCTION - 00013000
* 00014000
* TO PERFORM THE APPROPRIATE ACTIONS FOR VARIOUS 00015000
* TYPES OF EXTERNAL INTERRUPT CODES. 00016000
* 00017000
* ATTRIBUTES - 00018000
* 00019000
* SERIALLY REUSABLE, RESIDENT 00020000
* 00021000
* ENTRY POINTS - 00022000
* 00023000
* DMKPSAEX - EXTERNAL INTERRUPT HANDLER 00024000
* DMKPSADU - ENTRY POINT FOR FORCING AN "SVC 0" TYPE DUMP. 00025000
* DMKPSARX - ENTRY TO GET VIRTUAL ADDR FOR AN RX INSTRUCTION 00026000
* DMKPSARS - ENTRY TO GET VIRTUAL ADDR FOR RS,SI,SS INSTRUCTIONS 00027000
* DMKPSARR - ENTRY TO GET VIRTUAL ADDR FOR AN RR INSTRUCTION 00028000
* DMKPSAID - ENTRY TO GET VIRTUAL ADDR FOR ANY INSTRUCTION 00029000
* DMKPSAFP - ENTRY TO CHECK FETCH PROTECT PER PSW KEY 00030000
* DMKPSASP - ENTRY TO CHECK STORAGE PROTECT PER PSW KEY 00031000
* DMKPSAFC - ENTRY TO CHECK FETCH PROTECT PER CAW KEY 00032000
* DMKPSASC - ENTRY TO CHECK STORAGE PROTECT PER CAW KEY 00033000
* DMKPSACC - ENTRY TO CHECK A SHARED PAGE FOR CHANGE 00034000
* 00035000
* ENTRY POINTS - NON-EXECUTABLE 00036000
* 00037000
* DMKFEIBM - FE SERVICE NUMBER CHARACTER STRING 00038000
* DMKPSANX - NUMBER OF EXTERNAL INTERRUPTS (BY PROC.) 00039000
* DMKPSAER - REGISTERS AT TIME OF EXTERNAL INTERRUPT 00040000
* 00041000
* ENTRY CONDITIONS - 00042000
* 00043000
* FOR EXTERNAL INTERRUPT HANDLER: 00044000
* NONE, OTHER THAN THE INFORMATION IN THE 00045000
* OLD PSW AND INTERRUPT CODE. 00046000
* 00047000
* FOR VIRTUAL ADDRESS SUBROUTINES, SEE SUBROUTINE PROLOGS 00048000
* EXIT CONDITIONS - 00049000
* 00050000
* DEPENDS UPON ENTRY USED & FUNCTION REQUIRED 00051000
* (SEE "OPERATION"). 00052000
* 00053000
* SYSTEM ABEND CODES - 00054000
* 00055000
* PSA02 - PSW RESTART KEY ACTIVATED 00056000
EJECT 00057000
* CALLS TO OTHER ROUTINES - 00058000
* 00059000
* DMKDSPCH - TO DISPATCH A VIRTUAL MACHINE 00060000
* DMKDSPE - TO REFLECT VIRTUAL TIMER INTERRUPT 00061000
* DMKDMPDK - TO DUMP THE MACHINE IN CASE OF A FATAL ERROR 00062000
* DMKTMRVT - TO PROCESS VIRTUAL CPU TIMER INTERRUPTS 00063000
* DMKSTKIO - TO STACK EXPIRED TRQ 00064000
* DMKFREE - TO OBTAIN CPEXBLOK FOR OPERATOR DISCONNECT 00065000
* DMKSCNRD - TO OBTAIN OPERATOR'S TERMINAL REAL DEVICE ADDRESS 00066000
* DMKQCNCL - TO CLEAR OUTSTANDING CONSOLE REQUESTS 00067000
* DMKRNHND - TO RELEASE NETWORK BTUS OF DISC. OPERATOR 00068000
* DMKSTKMP - TO STACK A CPEXBLOK FOR THE MAIN PROCESSOR 00069000
* DMKEXTSL - TO HANDLE MP-TYPE INTERRUPTS 00070000
* DMKLOKDF - TO ATTEMPT TO ACQUIRE THE SYSTEM LOCK 00071000
* DMKLOKSP - TO OBTAIN SPIN LOCKS 00072000
* DMKDSPRU - TO RUN USERS WITHOUT THE SYSTEM LOCK 00073000
SPACE 00074000
* EXTERNAL REFERENCES - 00075000
* 00076000
* DMKSCHTQ - TIMER REQUEST QUEUE ANCHOR 00077000
* DMKCNSOF - INTERRUPT RETURN ADDRESS FOR CONSOLE I/O 00078000
* DMKLOKTR - TIMER REQUEST QUEUE LOCK 00079000
* DMKLOKSY - THE GLOBAL SYSTEM LOCK 00080000
* 00081000
* TABLES / WORK AREAS - 00082000
* 00083000
* DMKSYSVM - VMBLOK OF CP370 SYSTEM 00084000
* DMKSYSOP - SYSTEM OPERATOR'S VMBLOK 00085000
* REGISTER USAGE - 00086000
* 00087000
* GPR 12 = BASE REGISTER 00088000
* 00089000
* NOTES - 00090000
* 00091000
* THIS MODULE INCLUDES THE "PSA" MACRO AS LIVE CODE, 00092000
* AND RESIDES IN PAGE 0 FOLLOWING THE INFORMATION 00093000
* IN THE "PSA" MACRO. 00094000
EJECT 00095000
* OPERATION - 00096000
* 00097000
* EXTERNAL INTERRUPTIONS ARE HANDLED AS FOLLOWS: 00098000
* 00099000
* 1. IF THE EXTERNAL INTERRUPT WAS FROM THE RED "INTERRUPT" 00100000
* KEY ON THE 370 SYSTEM CONTROL PANEL, THE NECESSARY STEPS 00101000
* (INCLUDING A CALL TO DMKQCNCL) ARE TAKEN TO CLEAR AND 00102000
* DISCONNECT THE SYSTEM OPERATOR'S TERMINAL (IF HE IS LOGGED 00103000
* ON, AND NOT ALREADY DISCONNECTED). THE SYSTEM OPERATOR IS 00104000
* THEN ABLE TO LOG ON OR BE RECONNECTED AT ANY OTHER TERMINAL, 00105000
* VIA THE 'LOGON' COMMAND. THE BUTTON INTERRUPT IS IGNORED FOR 00106000
* ANY PROCESSOR OTHER THAN THE MAIN PROCESSOR IN AP SYSTEMS. 00107000
* 00108000
* 2. IF THE EXTERNAL INTERRUPT WAS DUE TO A TIMER INTERRUPT, 00109000
* THE MACHINE MODE IS DETERMINED, AND ACTION TAKEN AS FOLLOWS: 00110000
* 00111000
* A. IF THE MACHINE WAS IN PROBLEM MODE, THE ADDRESS OF 00112000
* CURRENT USER'S VMBLOK IS OBTAINED FROM RUNUSER. THE 00113000
* USER'S VIRTUAL PSW (VMPSW) IS UPDATED FROM THE EXTERNAL 00114000
* INTERRUPT OLD PSW AND THE ADDRESS OF THE CURRENT VMBLOK 00115000
* IS LOADED INTO GPR-11. 00116000
* 00117000
* B. IF THE EXTERNAL INTERRUPT IS FROM THE CPU TIMER 00118000
* AND THE VIRTUAL CPU TIMER IS CONTAINED IN THE REAL CPU 00119000
* TIMER, A CALL IS MADE TO DMKTMRVT TO PROCESS THE 00120000
* INTERRUPT. IF THE REAL CPU TIMER DOES NOT CONTAIN THE 00121000
* VIRTUAL CPU TIMER, A FLAG IS SET IN THE VMBLOK INDICATING 00122000
* THAT THIS USER'S TIME SLICE HAS BEEN EXCEEDED. CONTROL IS 00123000
* THEN PASSED TO THE DISPATCHER. 00124000
* 00125000
* 3. IF THE EXTERNAL INTERRUPT WAS DUE TO THE TIME OF DAY 00126000
* CLOCK COMPARATOR, THE ACTIVE TIMER REQUEST QUEUE BLOCK 00127000
* (TRQBLOK) IS STACKED FOR EXECUTION VIA DMKSTKIO. FOR A 00128000
* UNIPROCESSOR SYSTEM THE CLOCK COMPARATOR IS RESET FROM THE 00129000
* FIRST TRQBLOK ON THE QUEUE. FOR AN ATTACHED PROCESSOR SYSTEM 00130000
* THE COMPARATOR IS RESET FROM THE FIRST TRQBLOK NOT ALREADY 00131000
* ACTIVE ON THE OTHER PROCESSOR. CONTROL THEN TRANSFERS TO 00132000
* THE DISPATCHER. 00133000
* 00134000
* 4. FOR EXTERNAL INTERRUPTS DUE TO EXTERNAL CALL, EMERGENCY 00135000
* SIGNAL, TOD SYNC CHECK AND MALFUNCTION ALERT, CONTROL IS 00136000
* TRANSFERRED TO DMKEXTSL. 00137000
* 00138000
* THE DMKPSARX, DMKPSARS, DMKPSARR, AND DMKPSAID 00139000
* ENTRY POINTS ARE DESCRIBED IN A FOLLOWING SECTION. 00140000
*. 00141000
EJECT 00142000
COPY OPTIONS 00143000
COPY LOCAL 00144000
DMKPSA START 0 -LOADER CONTROL- 00145000
SPACE 00146000
ENTRY DMKPSACC @V304735 00147000
ENTRY DMKPSADU FOR PSW RESTART 00148000
ENTRY DMKPSAER @V407577 00149000
ENTRY DMKPSAEX FOR EXTERNAL INTERRUPTS @V200820 00150000
ENTRY DMKPSANX @V2B2638 00151000
SPACE 00152000
EXTRN DMKDMPDK @V407579 00153000
EXTRN DMKSCHTQ @V200820 00154000
EXTRN DMKSTKIO @V200820 00155000
EXTRN DMKRNHND @V200820 00156000
EXTRN DMKTMRVT @V200820 00157000
EXTRN DMKSCNRD 00158000
EXTRN DMKQCNCL 00159000
EXTRN DMKDSPE @V386198 00160000
SPACE 2 00161000
EXTRN DMKSTKMP @V407577 00162000
AIF (NOT &AP).EXTSL4 00162900
EXTRN DMKEXTSL @V407577 00163000
EXTRN DMKDSPRU @V407577 00164000
.EXTSL4 ANOP 00164100
USING DMKPSA,R0 REFERENCE PSA MACRO & LIVE CODE THRUOUT 00165000
EJECT 00166000
PSA 00167000
SPACE 2 00168000
SPACE 00169000
ORG PSAEND RESET ORIGIN FOR LIVE CODE: 00170000
DC (X'800'-(*-DMKPSA))X'0' CLEAR STG TO X'800' @V407579 00171000
SPACE 00172000
* 00173000
*** FE SERVICE NUMBER *********** 00174000
SPACE 00175000
ENTRY DMKFEIBM 00176000
DMKFEIBM DC CL12'FEIBM154042 ' CP NUMBER = 154042 00177000
SPACE 00178000
*** FE SERVICE NUMBER *********** 00179000
* 00180000
EJECT 00181000
*. 00182000
* 00183000
* PSW RESTSRT ENTRY (DMKPSADU) 00184000
* 00185000
* 1. SAVE REGISTERS 00186000
* 2. GO TO DMKDMP VIA R12 (DUMP PROGRAM) 00187000
* 00188000
*. 00189000
* 00190000
DMKPSADU DS 0H 00191000
STM R0,R15,DUMPSAVE SAVE REGS ON PSW-RESTART @V407579 00192000
MVC CPABEND(4),PSA2 MOVE IN THE ABEND CODE 00193000
GOTO DMKDMPDK EXIT TO DUMP ROUTINE @V407579 00194000
PSA2 DC CL3'PSA',AL1(2) PSW RESTART ABEND CODE 00195000
EJECT 00196000
*. 00197000
* SUBROUTINE TO COMPUTE AN EFFECTIVE VIRTUAL ADDRESS FOR AN RX 00198000
* (DOUBLE-INDEXED) INSTRUCTION, OR A SINGLE-INDEXED INSTRUCTION: 00199000
* 00200000
* ENTER AT DMKPSARX TO COMPUTE THE ADDRESS 00201000
* FOR A DOUBLE-INDEXED (RX) INSTRUCTION 00202000
* 00203000
* ENTER AT DMKPSARS TO COMPUTE ADDRESS FOR A 00204000
* SINGLE-INDEXED INSTRUCTION (E.G. BXH, BXLE, LPSW, ETC.) 00205000
* 00206000
* ENTER AT DMKPSAID TO COMPUTE THE ADDRESS FOR ANY INSTRUCTION 00207000
* 00208000
* AT ENTRY: 00209000
* GPR 2 = REAL ADDRESS OF VIRTUAL INSTRUCTION 00210000
* (AVAILABLE IN VMINST OR A SAVE-AREA) 00211000
* GPR 14 = RETURN REGISTER 00212000
* 00213000
* AT EXIT: 00214000
* GPR 1 = EFFECTIVE VIRTUAL ADDRESS 00215000
*. 00216000
ENTRY DMKPSARX ENTRY POINT FOR RX INSTRUCTIONS: 00217000
USING VMBLOK,R11 RESTORE ADDRESSABILITY @V4M0203 00218000
DMKPSARX IC R15,1(,R2) PICK UP SECOND BYTE OF INSTRUCTION 00219000
N R15,F15 ISOLATE THE INDEX REGISTER NUMBER 00220000
BZ TRANDX1 IF = 0 DON'T COMPUTE REAL INDEX REG. 00221000
ALR R15,R15 TIMES 4 00222000
ALR R15,R15 ... 00223000
L R15,VMGPRS(R15) PICK UP USER'S INDEX REG. FROM VMBLOK 00224000
TRANDX1 IC R1,2(,R2) PICK UP LEFT BYTE OF BASE.DISP FIELD 00225000
SRL R1,2 SHIFTED RIGHT 2 GIVES US BASE NO. TIMES 4 00226000
N R1,F60 ISOLATE THE BASE NO. BITS ONLY 00227000
BZ TRANDX2 IF = 0 DON'T COMPUTE REAL BASE REG. 00228000
AL R15,VMGPRS(R1) ADD USER'S BASE REGISTER TO HIS INDEX REG 00229000
TRANDX2 LA R1,4095 SET FOR LOW/ORDER 12 BITS, 00230000
N R1,0(,R2) ISOLATE THE DISPLACEMENT BITS, 00231000
LA R1,0(R1,R15) ADD IN THE BASE/INDEX REGISTERS 00232000
BR R14 AND EXIT TO CALLER (ANSWER IN R1) 00233000
SPACE 00234000
ENTRY DMKPSAID ENTRY POINT FOR "ANY" INSTRUCTION 00235000
DMKPSAID CLI 0(R2),X'40' RR INSTRUCTION ? 00236000
BL DMKPSARR YES. 00237000
CLI 0(R2),X'80' RX INSTRUCTION ? 00238000
BL DMKPSARX YES. 00239000
* RS, SI, OR SS - CONTINUE: 00240000
SPACE 00241000
ENTRY DMKPSARS ENTRY POINT FOR RS, SI, SS INSTRUCTIONS: 00242000
DMKPSARS SLR R15,R15 CLEAR R15 (NO INDEX REGISTER APPLICABLE) 00243000
B TRANDX1 AND JOIN RX LOGIC. 00244000
EJECT 00245000
*. 00246000
* DMKPSARR = SIMILAR SUBROUTINE FOR GETTING VIRTUAL ADDRESS FOR 00247000
* A 2-BYTE ("RR") INSTRUCTION: 00248000
* AT ENTRY: 00249000
* GPR 2 = REAL ADDRESS OF VIRTUAL INSTRUCTION 00250000
* GPR 14 = RETURN REGISTER 00251000
* 00252000
* AT EXIT: 00253000
* CC = 0 IF THE "R2" REGISTER DOES NOT EXIST (=0) 00254000
* AND 00255000
* GPR 1 = 0 00256000
* 00257000
* CC = 2 IF THE "R2" REGISTER DOES EXIST (NOT = 0) 00258000
* AND 00259000
* GPR 1 = VIRTUAL ADDRESS GIVEN BY THE "R2" REGISTER 00260000
*. 00261000
ENTRY DMKPSARR ENTRY POINT FOR RR INSTRUCTIONS: 00262000
DMKPSARR IC R1,1(,R2) PICK UP SECOND BYTE OF INSTRUCTION 00263000
CLI 0(R2),X'0E' IS THIS 'MVCL' WIERDO ? 00264000
BE PSAMVCL YES - SPECIAL HANDLING 00265000
N R1,F15 ISOLATE THE INDEX REGISTER NUMBER 00266000
BCR 8,R14 <BZ> IF = 0 THERE'S NOTHING THERE. 00267000
* NOTE - CC = 0 (FOR 'BZ' USE) 00268000
AR R1,R1 TIMES 4 00269000
AR R1,R1 (NOTE - CC NOW 2 FOR 'BP' USE) 00270000
L R1,VMGPRS(R1) PICK UP USER'S "R2" REGISTER FROM VMBLOK 00271000
LA R1,0(,R1) STRIP OFF POSSIBLE HIGH-ORDER BYTE 00272000
BR R14 EXIT (CC SET FOR 'BP' FROM AR ABOVE) 00273000
SPACE 00274000
PSAMVCL EQU * SPECIAL HANDLING FOR 'MVCL' 00275000
SRL R1,2(0) SHIFT TO USE 'R1' FIELD 00276000
N R1,F60 REDUCE TO *4 INDEX 00277000
L R1,VMGPRS(R1) GET REGISTER VALUE 00278000
LA R1,0(0,R1) ...ADDRESS ONLY, PLEASE 00279000
CLI *,X'00' SET CC = 2 00280000
BR R14 RETURN TO CALLER 00281000
EJECT 00282000
*. 00283000
* SUBROUTINE NAME - 00284000
* 00285000
* DMKPSAFP - 00286000
* 00287000
* FUNCTION - 00288000
* 00289000
* TO EXAMINE REAL AND VIRTUAL STORAGE KEYS AND TO DETERMINE 00290000
* IF A FETCH- OR STORAGE- PROTECTION CHECK SHOULD BE SIMULATED 00291000
* 00292000
* ATTRIBUTES - 00293000
* 00294000
* REENTRANT, RESIDENT, CALLED VIA BALR 00295000
* 00296000
* ENTRY POINTS - 00297000
* 00298000
* DMKPSAFP - CHECK FOR FETCH PROTECT VIOLATION PER PSW KEY 00299000
* DMKPSASP - CHECK FOR STORAGE PROTECT VIOLATION PER PSW KEY 00300000
* DMKPSAFC - CHECK FOR FETCH PROTECT VIOLATION PER CAW KEY 00301000
* DMKPSASC - CHECK FOR STORAGE PROTECT VIOLATION PER CAW KEY 00302000
* DMKPSACC - CHECK IF SHARED PAGE FRAME HAS BEEN CHANGED 00303000
* 00304000
* ENTRY CONDITIONS - 00305000
* 00306000
* FOR ALL ENTRY POINTS: 00307000
* GPR 2 = REAL ADDRESS REFERENCED 00308000
* GPR 11 = VMBLOK ADDRESSABILITY 00309000
* GPR 14 = RETURN ADDRESS 00310000
* GPR 15 = ADDRESS OF ENTRY POINT 00311000
* 00312000
* FOR DMKPSAFC & DMKPSASC (CAW-KEY) ENTRIES ONLY: 00313000
* GPR 0 MUST HOLD USER'S "CAW KEY" (IN RIGHTMOST BYTE) 00314000
* 00315000
* EXIT CONDITIONS - 00316000
* 00317000
* FOR ALL ENTRY POINTS: 00318000
* CONDITION CODE 0: NO PROTECTION VIOLATION 00319000
* COND. CODE NONZERO: PROTECTION VIOLATION SHOULD BE SIMULATED 00320000
* 00321000
* GPR 1-14 ARE PRESERVED 00322000
* GPR 0 IS DESTROYED 00323000
* 00324000
* FOR DMKPSAFP & DMKPSAFC (FETCH-PROTECT) ENTRY POINTS: 00325000
* GPR 15 = 00 IF FETCH-PROTECT BIT IN REAL KEY = 0 00326000
* OR REAL KEY (IN BITS 24-27) IF FETCH-PROTECT BIT WAS ON 00327000
* 00328000
* FOR DMKPSASP & DMKPSASC (STORAGE PROTECT) ENTRY POINTS: 00329000
* GPR 15 = REAL KEY (IN BITS 24-27) 00330000
* 00331000
* TABLES / WORK AREAS - 00332000
* 00333000
* NONE 00334000
EJECT 00335000
* REGISTER USAGE - 00336000
* 00337000
* GPR 0 = SCRATCH (TO OBTAIN PSW KEY FROM VMPSW+1) 00338000
* GPR 2 = REAL ADDRESS REFERENCED 00339000
* GPR 14 = RETURN ADDRESS 00340000
* GPR 15 = SCRATCH (TO OBTAIN FETCH-PROTECT BIT & REAL KEY) 00341000
* 00342000
* NOTES - 00343000
* 00344000
* DMKPSASP REPLACES OLD "DMKPRVKY" ENTRY (IN DMKPRV) 00345000
* 00346000
* OPERATION - 00347000
* 00348000
* 1. FETCH-PROTECT CHECKING: 00349000
* FOR THE FETCH-PROTECT ENTRY POINTS (DMKPSAFP & DMKPSAFC), THE 00350000
* REAL STORAGE KEY IS OBTAINED, AND THE FETCH-PROTECT BIT IS 00351000
* EXAMINED. IF 0, EXITS IMMEDIATELY (WITH CONDITION CODE AND 00352000
* GPR 15 = 0). IF THE FETCH-PROTECT BIT = 1, CONTINUES TO THE 00353000
* STORAGE PROTECT LOGIC, AS FOLLOWS: 00354000
* 00355000
* 2. STORAGE-PROTECT CHECKING: 00356000
* THE STORAGE KEY IN THE VIRTUAL PSW (OR CAW) IS COMPARED TO THE 00357000
* REAL STORAGE KEY OF THE PAGE INVOLVED IN THE STORE OPERATION; 00358000
* IF THE VIRTUAL PSW (OR CAW) KEY = 0, OR MATCHES THE REAL KEY, 00359000
* THE CONDITION CODE IS SET TO ZERO. IF THE PSW (OR CAW) KEY IS 00360000
* NONZERO AND DOES NOT MATCH THE REAL STORAGE KEY, A NONZERO 00361000
* CONDITION CODE IS SET. IN EITHER CASE, R15 (BITS 24-27) 00362000
* HOLDS THE REAL STORAGE KEY). 00363000
* 00364000
* 3. SHARED PAGE PROTECTION CHECKING: 00365000
* IF THE VIRTUAL MACHINE IS NOT RUNNING A SHARED SYSTEM, RETURN 00366000
* IS MADE DIRECTLY BACK TO THE CALLER WITH THE CC = 0. 00367000
* OTHERWISE, THE STORAGE KEY AT THE ADDRESS SUPPLIED IN REG. 2 00368000
* IS CHECKED FOR THE HARDWARE CHANGE BIT ON. THE RESULTING 00369000
* CONDITION CODE IS RETURNED TO THE CALLER. 00370000
*. 00371000
SPACE 00372000
ENTRY DMKPSAFP CHECK FETCH PROTECT PER PSW KEY @V202232 00373000
ENTRY DMKPSASP CHECK STORAGE PROTECT PER PSW KEY@V202232 00374000
ENTRY DMKPSAFC CHECK FETCH PROTECT PER CAW KEY @V202232 00375000
ENTRY DMKPSASC CHECK STORAGE PROTECT PER CAW KEY@V202232 00376000
SPACE 00377000
USING VMBLOK,R11 IN EFFECT FOR ALL ENTRIES @V202232 00378000
SPACE 00379000
* DMKPSAFP & DMKPSASP - CHECK FOR FETCH/STORAGE PROTECTION PER PSW KEY: 00380000
DMKPSAFP DS 0D CHECK FOR FETCH PROTECTION PER PSW KEY: 00381000
ST R14,FETCHR14 ENTERED FOR FETCH PROTECTION @V304735 00382000
L R15,X2048BND GET MASK FOR BITS 8-20 @V202232 00383000
NR R15,R2 R15 = REAL ADDR OF STORAGE KEY @V202232 00384000
* BLOCK 00385000
ISK R15,R15 GET THE REAL STORAGE KEY @V202232 00386000
N R15,F8 ISOLATE AND CHECK THE @V202232 00387000
* FETCH-PROTECT BIT 00388000
BCR 8,R14 <BZ> NOT SET: JUST EXIT (WITH CC=0) @V202232 00389000
* FETCH-PROTECT BIT SET: CONTINUE... 00390000
DMKPSASP EQU * CHECK FOR STORAGE PROTECTION PER PSW KEY: 00391000
IC R0,VMPSW+1 GET USER'S PSW KEY. @V304735 00392000
B DMKPSASC CHECK OUT PSW KEY @V304735 00393000
SPACE 00394000
* DMKPSAFC & DMKPSASC - CHECK FOR FETCH/STORAGE PROTECTION PER CAW KEY: 00395000
DMKPSAFC EQU * CHECK FOR FETCH PROTECTION PER CAW KEY: 00396000
ST R14,FETCHR14 ENTERED FOR FETCH PROTECTION @V304735 00397000
L R15,X2048BND GET MASK FOR BITS 8-20 @V202232 00398000
NR R15,R2 R15 = REAL ADDR OF STORAGE KEY @V202232 00399000
* BLOCK 00400000
ISK R15,R15 GET THE REAL STORAGE KEY @V202232 00401000
N R15,F8 ISOLATE AND CHECK THE @V202232 00402000
* FETCH-PROTECT BIT 00403000
BCR 8,R14 <BZ> NOT SET: JUST EXIT (WITH CC=0) @V202232 00404000
* FETCH-PROTECT BIT SET: CONTINUE... 00405000
DMKPSASC EQU * CHECK FOR STORAGE PROTECTION PER CAW KEY: 00406000
L R15,X2048BND GET MASK FOR BITS 8-20 @V202232 00407000
NR R15,R2 R15 = REAL ADDR OF STORAGE KEY @V202232 00408000
* BLOCK 00409000
ISK R15,R15 GET THE REAL STORAGE KEY <AGAIN> @V202232 00410000
N R15,F240 ONLY KEEP KEY. @V304735 00411000
N R0,F240 CHECK USER'S CAW/PSW KEY (IN R0) @V304735 00412000
BZ CHKCAWKY IF = 00, CHECK FOR SHARED PAGE @V304735 00413000
CLR R0,R15 DOES REAL MATCH VIRTUAL ? @V304735 00414000
BNER R14 MISMATCH KEYS - RETURN TO CALLER @V304735 00415000
CHKCAWKY LR R0,R15 SAVE REAL KEY FROM STORAGE @V304735 00416000
TM VMOSTAT,VMSHR USER RUNNING A SHARED SYSTEM ? @V304735 00417000
BZR R14 NO - THEN FETCH/STORE IS OK. @V304735 00418000
LR R15,R2 LOAD REAL STORAGE ADDRESS @V304735 00419000
N R15,XPAGNUM CLEAR OUT DISPLACEMENT @V304735 00420000
SRL R15,8 INDEX INTO CORE TABLE @V304735 00421000
AL R15,ACORETBL FIND ACTUAL CORE TABLE ENTRY @V304735 00422000
TM CORFLAG-CORTABLE(R15),CORSHARE SET COND. CODE @V304735 00423000
LR R15,R0 SAVE REAL KEY FOR CALLER @V304735 00424000
BZR R14 RETURN IF NOT A SHARED PAGE @V304735 00425000
CL R14,FETCHR14 SET CC BASED ON FETCH/STORE ENTRY@V304735 00426000
BR R14 RETURN TO CALLER WITH CC SET @V304735 00427000
DMKPSACC TM VMOSTAT,VMSHR USER RUNNING A SHARED SYSTEM ? @V304735 00428000
BZR R14 IF NOT - RETURN TO CALLER @V304735 00429000
LR R15,R2 GET THE REAL ADDRESS @V304735 00430000
N R15,XPAGNUM DROP OFF THE DISPLACEMENT @V304735 00431000
SRL R15,8 LEAVE INDEX INTO CORTABLE @V304735 00432000
AL R15,ACORETBL GET THE CORRECT CORTABLE ENTRY @V304735 00433000
TM CORFLAG-CORTABLE(R15),CORSHARE IS PAGE SHARED? @V304735 00434000
BZR R14 IF NOT - RETURN TO CALLER @V304735 00435000
LR R15,R2 REAL ADDRESS FOR 'ISK' @V304735 00436000
N R15,XPAGNUM CLEAN UP THE ADDRESS @V304735 00437000
ISK R15,R15 GET THE REAL STORAGE KEY @V304735 00438000
N R15,F2 WAS IT CHANGED ? @V304735 00439000
BNZR R14 IF YES - CC= NON-ZERO @V304735 00440000
LR R15,R2 GET THE REAL ADDRESS AGAIN @V304735 00441000
N R15,XPAGNUM DROP OFF THE DISPLACEMENT @V304735 00442000
LA R15,2048(,R15) SET ADDRESS FOR LAST HALF PAGE @V304735 00443000
ISK R15,R15 NOW GET THE REAL HARDWARE KEY @V304735 00444000
N R15,F2 SET CC; BASED ON CHANGE BIT @V304735 00445000
BR R14 RETURN TO CALL @V304735 00446000
SPACE 1 00447000
FETCHR14 DC F'0' ENTERED FOR FETCH PROTECTION @V304735 00448000
DROP R11 @V202232 00449000
EJECT 00450000
*********************************************************************** 00451000
* * 00452000
* EXTERNAL INTERRUPT HANDLER * 00453000
* * 00454000
*********************************************************************** 00455000
* 00456000
DMKPSAEX DS 0D 00457000
STM R0,R15,DMKPSAER @V407577 00458000
OI CPSTATUS,CPSUPER INDICATE SUPERVISOR STATE @V407577 00459000
TM CPSTATUS,CPRUN RUNNING USER? @V407577 00460000
BNO EXTRSYS NO, WAIT STATE OR DISPATCH WINDOW@V407577 00461000
L R11,RUNUSER GET VMBLOK FOR INTERRUPTED USER @V407577 00462000
USING VMBLOK,R11 ADDRESSABILITY @V407577 00463000
STPT VMTMOUTQ STOP CHARGING WAIT/PROBLEM TIME @V407577 00464000
CHARGE START START CHARGING SUP OVERHEAD @V407577 00465000
MVC QUANTUMR,TIMER SAVE INTERVAL TIMER @V408246 00466000
LCTL C0,C0,CPCREG0 @V408246 00467000
LCTL C8,C8,CPCREG8 @V408246 00468000
STM R0,R15,VMGPRS SAVE MACHINE STATUS... @V407577 00469000
MVC VMGPRS+R11*4(4),DMKPSAER+R11*4 ...AND FIX R11 @V407577 00470000
MVC VMGPRS+R15*4(4),DMKPSAER+R15*4 ..AND R15 @V4M0203 00471000
AIF (NOT &FLOATPT).NOFP4 00472000
STD Y0,VMFPRS 00473000
STD Y2,VMFPRS+8 00474000
STD Y4,VMFPRS+16 00475000
STD Y6,VMFPRS+24 00476000
.NOFP4 ANOP 00477000
L R14,EXOPSW+4 GET ADDRESS FROM OLD PSW @V407577 00478000
ST R14,VMPSW+4 ...UPDATE PSW IN USER'S VMBLOK @V407577 00479000
IC R14,EXOPSW+2 PICK UP COND. CODE, PGM MASK @V407577 00480000
TM VMESTAT,VMEXTCM EXTENDED CONTROL MODE ? 00481000
BZ PSA02 NOPE - IT'S "PLAIN". 00482000
STC R14,VMPSW+2 IF YES, STORE IN SAME POSITION @V407577 00483000
B EXTNOUSR AND CONTINUE 00484000
PSA02 STC R14,VMPSW+4 SET CC, PGM MASK BC-MODE FORMAT @V407577 00485000
B EXTNOUSR @V408246 00486000
SPACE 3 00487000
EJECT 00488000
EXTRSYS DS 0H @V408246 00489000
TM CPSTATUS,CPWAIT COMING OUT OF WAIT? @V407577 00490000
BNO EXTNOWT NO, ENABLE WINDOW @VM40173 00491000
STPT WAITEND STORE THE PROCESSOR WAIT TIME @V407577 00492000
B CHARGSYS GO START CHARGING THE SYSTEM @VA08853 00492100
EXTNOWT DS 0H @VM40173 00493000
STPT TEMPSAVE STORE THE TIME VALUE @VA08853 00493100
CHARGSYS DS 0H @VA08853 00493200
L R11,ASYSVM GET POINTER TO SYSTEM VMBLOK @VM40173 00494000
CHARGE START AND START CHARGING THE SYSTEM @V407577 00495000
EXTNOUSR EQU * 00496000
AIF (NOT &TRACE(9)).TR2 @V408246 00497000
TM TRACFLG1,TRAC01 TRACING ACTIVE? @V408246 00498000
BZ NOTRAC2 BRANCH IF NOT @V408246 00499000
TRACE CODE=TRCEXT,R15,R2,R3 TRACE EXTERNAL INTERRUPT @V407577 00500000
MVC 1(3,R15),ZEROES CLEAR @V408246 00501000
MVC 4(4,R15),INTEXF SAVE INTERRUPT ILC AND CODE @V408246 00502000
MVC 8(8,R15),EXOPSW SAVE EXTERNAL OLD PSW @V408246 00503000
NOTRAC2 EQU * @V408246 00504000
.TR2 ANOP 00505000
LA R15,1 INCREMENT @V408246 00506000
AL R15,DMKPSANX COUNT OF REAL EXTERNAL INTERRUPTS@V408246 00507000
ST R15,DMKPSANX . . @V408246 00508000
SPACE 00509000
CLI INTEX,X'10' IS THIS A CLASS 1 INTERRUPT ? @V386198 00510000
BE EXTTIMER YES, EITHER CPU TIMER ,CKC, OR @V407577 00511000
* TOD SYNC CHECK 00512000
SPACE 00513000
TM INTEX+1,X'40' WAS IT RED BUTTON ? @V386198 00514000
BZ EXTVTMR NO, CHECK IF VIRT. TIMER @V386198 00515000
TM APSTAT1,PROCIO IS THIS THE MAIN PROCESSOR @V407577 00516000
BNO EXTVTMR NO, THEN IGNORE THE BUTTON @V407577 00517000
LH R7,INTEX SAVE INT CODE THROUGH POSSIBLE @V407577 00518000
* MALFUNCTION ALERT 00519000
SPACE 00520000
LA R0,CPEXSIZE INPUT FOR FREE SPACE REQUEST @V386198 00521000
CALL DMKFREE GET STORAGE FOR A CPEXBLOK @V386198 00522000
USING CPEXBLOK,R1 @V386198 00523000
LA R15,EXTBUTTN RETURN ADDRESS FOR UNSTACK @V386198 00524000
ST R15,CPEXADD INTO BLOK @V386198 00525000
STM R0,R15,CPEXREGS SAVE ALL REGISTERS @V386198 00526000
L R15,ASYSOP OPERATOR SHOULD BE R11 USER @V407577 00527000
ST R15,CPEXR11 SAVE IN CPEXBLOK FOR UNSTACK @V407577 00528000
CALL DMKSTKMP STACK FOR THE MAIN PROCESSOR @V407577 00529000
STH R7,INTEX RESTORE INT CODE IN CASE OF MFA @V407577 00530000
SPACE 00531000
EXTVTMR TM INTEX,X'01' VIRT. TIMER INTERRUPT PRESENT ? @V386198 00532000
BZ EXTMP GO CHECK FOR MP-TYPE INTERRUPTS @V407577 00533000
GOTO DMKDSPE GO REFLECT VIRT. TIMER INT. @V386198 00534000
EXTMP DS 0H @V407577 00534800
AIF (NOT &AP).EXTMP4 00534900
LH R0,INTEX PICK UP THE INTERRUPT CODE @V407577 00535000
CH R0,=AL2(X'1200') IS THIS AN MP-TYPE INTERRUPT @V407577 00536000
BNL EXITSL YES, EXIT TO THE EXTERNAL SLIH @V407577 00537000
.EXTMP4 ANOP 00537100
LOCKSYS LOCK OBTAIN,TYPE=SYS,SPIN=NO TRY FOR THE SYS LOCK @V407577 00538000
AIF (NOT &AP).SYLOK4 00538900
BZ EXTEXIT GOT IT...GO TO MAIN DISPATCH @V407577 00539000
LH R0,INTEX PICK UP INTERRRUPT CODE @V407577 00540000
CH R0,=AL2(X'1005') IS THIS A CPU TIMER INTERRUPT @V407577 00541000
BNE EXITRU NO, EXIT TO RUN USERS @V407577 00542000
NI VMDSTAT,X'FF'-VMDSP MARK THIS USER FOR DEFER @V407577 00543000
.SYLOK4 ANOP 00543100
EXITRU EQU * @V407577 00544000
AIF (NOT &AP).DSPRU4 00544900
GOTO DMKDSPRU GO RUN USERS @V407577 00545000
.DSPRU4 ANOP 00545100
EXITSL EQU * @V407577 00546000
AIF (NOT &AP).EXTSL5 00546900
GOTO DMKEXTSL GO HANDLE MP-TYPE INTERRUPTS @V407577 00547000
.EXTSL5 ANOP 00547100
SPACE 00548000
EXTEXIT EQU * @V200820 00549000
GOTO DMKDSPCH @V200820 00550000
SPACE 3 00551000
EXTTIMER LH R0,INTEX PICK UP INTERRUPT CODE 00552000
CH R0,=AL2(X'1004') IS INTERRUPT FROM CPU COMPARATOR 00553000
BE EXTCKC YES - 00554000
CH R0,=AL2(X'1003') TOD SYNC CHECK? @V407577 00555000
BE EXITSL YES, EXIT TO DMKEXTSL @V407577 00556000
TM CPSTATUS,CPRUN WAS SYSTEM RUNNING A USER? THIS @VA07611 00556100
* IS THE ONLY TIME SYSTEM SHOULD GET 00556200
* A CPU TIMER INTERRUPT. 00556300
BO INTOK YES, INTERRUPT IS GOOD @VA07611 00556400
ABEND 4 TERMINATE VM/370 @VA07611 00556700
INTOK DS 0H @VA07611 00556800
OI VMTLEVEL,VMTMRINT FLAG CPU TIMER INT. FOR DISPATCH 00557000
OI VMDSTAT,VMQSEND FLAG PROBABLE TIME SLICE END ... 00558000
TM VMTLEVEL,VMCPUTMR IS VIRTUAL CPU TIMER IN REAL TIMER 00559000
BZ LOCKSYS TRY FOR THE SYSTEM LOCK @V407577 00560000
NI VMDSTAT,X'FF'-VMQSEND OOPS ... 00561000
GOTO DMKTMRVT GIVE THE INTERRUPT TO DMKTMR @V200820 00562000
SPACE 1 00563000
EXTCKC EQU * HERE TO HANDLE TOD CLOCK COMPARATOR INT. 00564000
AIF (NOT &AP).APCHK5 00564900
TM APSTAT1,APUOPER ARE WE RUNNING AP @V407577 00565000
BO MPCKC YES, USE MP LOGIC FOR TRQBLOKS @V407577 00566000
.APCHK5 ANOP 00566100
L R15,=A(DMKSCHTQ) POINT TO QUEUE OF TIMER REQUESTS 00567000
L R10,TRQBFPNT-TRQBLOK(,R15) GET ACTIVE BLOK 00568000
USING TRQBLOK,R10 ADDRESSABILITY 00569000
LM R1,R2,TRQBFPNT UNCHAIN 1ST (ACTIVE) BLOK 00570000
CLR R15,R1 IS THIS THE DUMMY ELEMENT? @VA05893 00571000
BE EXTSCKC IF SO THIS INTERUPT IS @VA05893 00572000
* UNSOLLICIATED, 00573000
* RESET CLOCK COMPARATOR TO HIGH VALUE. 00574000
ST R1,TRQBFPNT-TRQBLOK(,R2) ... 00575000
ST R2,TRQBBPNT-TRQBLOK(,R1) ... 00576000
CALL DMKSTKIO STACK THE BLOK FOR DISPATCH 00577000
EXTSCKC EQU * @VA05893 00578000
SCKC TRQBVAL-TRQBLOK(R1) 00579000
ST R1,ACTIVTRQ INDICATE THE ACTIVE REQUEST @V407577 00580000
B EXTEXIT AND LEAVE 00581000
AIF (NOT &AP).APCHK6 00581900
MPCKC LOCK OBTAIN,TYPE=TR,SPIN=YES @V407577 00582000
L R10,ACTIVTRQ POINTER TO ACTIVE TRQ @V407577 00583000
L R5,PREFIXB POINT TO OTHER PSA @V407577 00584000
L R4,ACTIVTRQ-PSA(,R5) AND OTHER ACTIVE TRQ @V407577 00585000
LTR R10,R10 IS IT ZERO @V407577 00586000
BZ SCANTRQ YES, INTERRRUPT ON OTHER PROC. @V407577 00587000
CR R10,R4 IS IT THE SAME AS THIS PROC'S @V407577 00588000
BNE UNCHAIN NO, SKIP CLEARING @V407577 00589000
SLR R4,R4 CLEAR FOR THE STORE @V407577 00590000
ST R4,ACTIVTRQ-PSA(,R5) @V407577 00591000
UNCHAIN LM R1,R2,TRQBFPNT UNCHAIN 1ST (ACTIVE) BLOK @V407577 00592000
ST R1,TRQBFPNT-TRQBLOK(,R2) ... @V407577 00593000
ST R2,TRQBBPNT-TRQBLOK(,R1) ... @V407577 00594000
CALL DMKSTKIO STACK THE BLOK FOR DISPATCH @V407577 00595000
SCANTRQ L R15,=A(DMKSCHTQ) POINT TO QUEUE OF TIMER REQ'S @V407577 00596000
LR R10,R15 @V407577 00597000
NEXTTRQ L R10,TRQBFPNT-TRQBLOK(,R10) @V407577 00598000
CR R10,R15 HAVE WE LOOPED @V407577 00599000
BE SETCKC YES, SET THE DISTANT FUTURE @V407577 00600000
CR R10,R4 IS THIS TRQ ALREADY ACTIVE @V407577 00601000
BE NEXTTRQ YES, TRY THE NEXT ONE @V407577 00602000
SETCKC ST R10,ACTIVTRQ NO, INDICATE ACTIVE THIS PROC. @V407577 00603000
SCKC TRQBVAL AND SET THE CLOCK COMPARATOR @V407577 00604000
LOCK RELEASE,TYPE=TR @V407577 00605000
B LOCKSYS TRY FOR THE MAIN ENTRY TO DSP @V407577 00606000
.APCHK6 ANOP 00606100
EJECT 00607000
EXTBUTTN EQU * HERE TO HANDLE THE BUTTON 00608000
TM VMOSTAT,VMSYSOP IS OPERATOR LOGGED @V407577 00609000
BZ EXTEXIT NO...DO NOTHING @V407577 00610000
TM VMOSTAT,VMDISC ALREADY DISCONNECTED @V407577 00611000
BO EXTEXIT YES...DO NOTHING @V407577 00612000
L R8,VMTERM POINTER TO TERMINAL RDEVBLOK @V407577 00613000
LTR R8,R8 IS THERE AN ACTIVE TERMINAL @V407577 00614000
BNP EXTEXIT NO...MUST NOT BE LOGGED ON @V407577 00615000
SPACE 00616000
OI VMOSTAT,VMDISC DISCONNECT SYSTEM OPERATOR @V200820 00617000
SLR R1,R1 @V200820 00618000
ST R1,VMTERM ... @V200820 00619000
USING RDEVBLOK,R8 @V200820 00620000
CALL DMKQCNCL CLEAR ANY OUTSTANDING CONTASK REQ@V200820 00621000
MVC RDEVUSER(4),ASYSVM SET RDEVUSER = A(DMKSYSVM) @V200820 00622000
CLI RDEVTYPC,CLASTERM IS THIS A TERM-CLASS DEVICE @V200820 00623000
BE HALTERM YES - HALT ANY ACTIVE I/O @V200820 00624000
CLI RDEVTYPC,CLASGRAF IS THIS A GRAPHICS-CLASS DEV@V200820 00625000
BE HALTGRF YES - DO WHATEVER IS BEST @V200820 00626000
* MUST BE SPECIAL-CLASS = 3704/5 00627000
LH R1,VMTRMID RESOURCE IDENTIFIER FOR NCP TERM @V200820 00628000
N R1,F4095 STRIP OFF THE DEVICE CODE @V200820 00629000
MH R1,=AL2(NICSIZE*8) CONVERT TO NICLIST INDEX @V200820 00630000
AL R1,RDEVNICL GR1 = NICBLOK ADDRESS @V200820 00631000
USING NICBLOK,R1 @V200820 00632000
L R2,ASYSVM PICK UP POINTER TO SYSTEM VMBLOK @VA09721 00633010
ST R2,NICUSER RESET NICUSER A(DMKSYSVM) @VA09721 00633020
LA R0,CRESIMD RESET IMMEDIATE BTU COMMAND @V200820 00635000
LH R1,NICNAME RESOURCE I.D. FOR THIS DEVICE @V200820 00636000
CALL DMKRNHND,PARM=NORET RESET ANY ACTIVE BTU'S @V200820 00637000
B EXTEXIT GOTO DMKDSPCH @V200820 00638000
SPACE 00639000
HALTGRF EQU * FORCE A DISCONNECT FROM GRAPHIC TERM @V200820 00640000
SPACE 00641000
HALTERM EQU * FIND REAL DEVICE ADDRESS, ETC @V200820 00642000
OI RDEVFLAG,RDEVHIO NEXT INTERRUPT FROM HALT I/O@V200820 00643000
CALL DMKSCNRD GET 'CCU' ADDRESS IN GR1 @V200820 00644000
LA R15,256 SET RETRY COUNTER @VA09912 00644010
HALTCON EQU * FORCE DISCONNECT FROM START-STOP TERM @V200820 00645000
HIO 0(R1) HALT ACTIVE I/O @V200820 00646000
BC 2,*-4 CC = 2 => BURST OPERATION HALTE@V200820 00647000
BC 8+1,EXTEXIT CC = 0, OR CC = 3 => ALL DONE @V200820 00648000
CLI CSW+4,SM+BUSY SHORT CONTROL UNIT BUSY ? @V200820 00649000
BNE HALTCON2 NO @VA04028 00650000
TIO 0(R1) CLEAR CONTROL UNIT BUSY @VA04028 00651000
BCT R15,HALTCON RETRY 256 TIMES @VA09912 00652050
B EXTEXIT THEN GO TO DMKDSPCH @VA09912 00652100
HALTCON2 EQU * @VA04028 00653000
CLI CSW+4,CUE+SM+BUSY 370X-STYLE SHORT BUSY ? @V200820 00654000
BNE EXTEXIT NO -- ASSUME IT WAS HALTED @V200820 00655000
LH R2,RDEVBASE CHECK FOR 370X FAILURE @V200820 00656000
LTR R2,R2 EMULATOR LINE BASED ON 370X ? @V200820 00657000
BNZ EXTEXIT NO, GO TO DMKDSPCH @VA09912 00658100
BCT R15,HALTCON RETRY 256 TIMES @VA09912 00658200
B EXTEXIT THEN GO TO DMKDSPCH @VA09912 00658300
DROP R8 @V200820 00660000
EJECT 00661000
DMKPSAER DS 8D REGS SAVED HERE FOR EXT INTS @V407577 00662000
PSA EQU DMKPSA @V407577 00663000
SPACE 00664000
DMKPSANX DC F'0' NUMBER OF EXTERNAL INTERRUPTS @V2B2638 00665000
SPACE 3 00666000
LTORG 00667000
EJECT 00668000
COPY EQU 00669000
COPY SAVE 00670000
COPY CORE @V304735 00671000
COPY RBLOKS 00672000
COPY DEVTYPES 00673000
COPY VMBLOK 00674000
COPY TIMER 00675000
COPY NETWORK @V200820 00676000
COPY BTUCMD @V200820 00677000
END DMKPSA @V200820 00678000