DSP TITLE 'DMTDSP (RSCS) VM/370 - RELEASE 6' 00001000 *. 00002000 * MODULE NAME - 00003000 * 00004000 * DMTDSP 00005000 * 00006000 * FUNCTION - 00007000 * 00008000 * THE DMTDSP MODULE IS THE MSUP DISPATCHER. IT IS 00009000 * INTENDED TO BE ENTERED AS AN EXIT FROM SUPERVISOR 00010000 * FUNCTIONS WHICH WERE ENTERED FOLLOWING AN 00011000 * INTERRUPT, OR WHICH "UNDISPATCHED" A TASK BY MEANS 00012000 * OF THE FREEZE SVC FUNCTION. DMTDSP MUST BE ENTERED 00013000 * WITH ALL PSW MASKS OFF (EXCEPT MACHINE CHECK). 00014000 * 00015000 * ATTRIBUTES - 00016000 * 00017000 * REUSABLE, NON-INTERRUPTABLE 00018000 * 00019000 * ENTRY POINTS - 00020000 * 00021000 * DMTDSP - RESUME DISPATCHED EXECUTION, OR WAIT 00022000 * 00023000 * ENTRY CONDITIONS - 00024000 * 00025000 * GPR15 = ENTRY ADDRESS 00026000 * 00027000 * OTHER REGISTER CONTENTS ARE NOT USED, ALTHOUGH BY 00028000 * CONVENTION GPR14 POINTS TO THE LOCATION FROM WHICH 00029000 * DMTDSP WAS CALLED (HANDY FOR MALFUNCTION ANALYSIS) 00030000 * 00031000 * EXIT CONDITIONS - 00032000 * 00033000 * NORMAL - 00034000 * 00035000 * A TASK WHICH HAS BEEN SELECTED FOR EXECUTION 00036000 * IS RESTARTED BY RESTORING ITS SAVED STATUS. 00037000 * IF NO TASK IS READY FOR EXECUTION, A MASKED ON 00038000 * WAIT STATE PSW IS LOADED. 00039000 * 00040000 * ERROR - 00041000 * 00042000 * NONE 00043000 * 00044000 EJECT 00045000 * 00046000 * CALLS TO OTHER ROUTINES - 00047000 * 00048000 * NONE 00049000 * 00050000 * EXTERNAL REFERENCES - 00051000 * 00052000 * NONE 00053000 * 00054000 * 00055000 * TABLES / WORKAREAS - 00056000 * 00057000 * DMTVEC - SUPERVISOR COMMON AREA 00058000 * 00059000 * REGISTER USAGE - 00060000 * 00061000 * GPR0 = UNUSED 00062000 * GPR1 = TASK ELEMENT POINTER 00063000 * GPR2 = TASK SAVE AREA POINTER 00064000 * GPR3 = SCRATCH 00065000 * GPR4 = SCRATCH 00066000 * GPR5 = UNUSED 00067000 * GPR6 = UNUSED 00068000 * GPR7 = UNUSED 00069000 * GPR8 = UNUSED 00070000 * GPR9 = UNUSED 00071000 * GPR10 = UNUSED 00072000 * GPR11 = UNUSED 00073000 * GPR12 = UNUSED 00074000 * GPR13 = UNUSED 00075000 * GPR14 = UNUSED 00076000 * GPR15 = ENTRY ADDRESS, BASE REGISTER 00077000 * 00078000 * NOTES - 00079000 * 00080000 * THE CONDITIONS UNDER WHICH THIS DISPATCHER OPERATES 00081000 * ARE SUFFICIENTLY SIMPLE THAT A WIDE VARIETY OF DISPATCHING 00082000 * ALGORITHMS MAY BE EASILY EMPLOYED BY MODIFICATION TO 00083000 * THE PROGRAMMING. 00084000 * 00085000 * OPERATION - 00086000 * 00087000 * DMTDSP SCANS THE TASK ELEMENT QUEUE FOR A TASK 00088000 * WHICH IS READY FOR EXECUTION. THE FIRST SUCH TASK 00089000 * FOUND IS DISPATCHED. IF NO READY TASK IS FOUND, 00090000 * DMTDSP LOADS A MASKED ON WAIT STATE PSW. WHEN A 00091000 * TASK IS DISPATCHED, ITS TASK ELEMENT IS ENQUEUED 00092000 * AT THE END OF THE TASK QUEUE, REDUCING THE TASK TO 00093000 * LOWEST PRIORITY FOR THE NEXT DISPATCH. THE EFFECT 00094000 * OF THIS IS A 'ROUND ROBIN' DISPATCHING ALGORITHM. 00095000 * 00096000 * THE TASK TO BE DISPATCHED IS INSPECTED TO SEE IF 00097000 * IT HAD BEEN WAITING ON A LIST OF SYNCH LOCKS. IF 00098000 * SO, EACH SYNCH LOCK IN THE LIST WHICH HAD BEEN 00099000 * WAITED ON AND HAD NOT BEEN POSTED IS CLEARED TO 00100000 * ZERO. THE TASK ID AND TASK ELEMENT FOR THE TASK TO 00101000 * BE DISPATCHED ARE STORED IN LOW STORAGE. THE 00102000 * TASK'S GENERAL REGISTERS ARE RELOADED FROM THE 00103000 * TASK SAVE AREA, AND THE TASK'S RESUME PSW FROM THE 00104000 * TASK SAVE AREA IS LOADED. 00105000 * 00106000 *. 00107000 EJECT 00108000 DMTDSP CSECT 00109000 SPACE 00110000 * ENTRY POINT FOR SUPERVISOR DISPATCH 00111000 SPACE 00112000 USING DMTDSP,R15 ADDRESS WITH ENTRY REGISTER 00113000 USING SVECTORS,0 GET SVECTORS ADDRESSABILTIY 00114000 USING TASKE,R1 GET TASK ELEMENT ADDRESSABILTIY 00115000 SPACE 00116000 LA R2,TASKQ GET START OF TASKQ 00117000 GONEXTQ EQU * 00118000 ICM R1,B'1111',TASKNEXT-TASKE(R2) GET NEXT IN QUEUE 00119000 BZ GONOGO ALL DONE 00120000 TM TASKSTAT,WAITING+LIMBO WANTS TO RUN? 00121000 BZ GOTOIT YES 00122000 LR R2,R1 GET THE NEXT IN CHAIN 00123000 B GONEXTQ AND CONTINUE 00124000 SPACE 1 00125000 GOTOIT EQU * 00126000 MVC TASKNEXT-TASKE(4,R2),TASKNEXT DEQUEUE 00127000 LR R3,R2 SET UP FOR SCAN TO END 00128000 GOLURCH EQU * 00129000 LR R2,R3 MAKE LAST CURRENT 00130000 ICM R3,B'1111',TASKNEXT-TASKE(R2) GET NEXT 00131000 BNZ GOLURCH NOT LAST ONE 00132000 ST R1,TASKNEXT-TASKE(R2) CHAIN TO END 00133000 ST R3,TASKNEXT AND TERMINATE THE CHAIN 00134000 L R2,TASKSAVE REG.2 = SAVE AREA OF TASK TO BE DISPATCH 00135000 USING TAREA,R2 DEFINE TASK SAVE AREA DSECT ADDRESSA 00136000 SPACE 00137000 ST R1,ACTIVE SET ADDRESS OF ELEMENT TO BE DISPATCHED 00138000 MVC ACTIVE(1),TASKID SET TASK ID TO BE DISPATCHED 00139000 TM TASKSTAT,LOCKLIST DID TASK WAIT ON A SYNCH LOCK LIST 00140000 BNO GOGOGO NOPE - NO NEED TO CLEAN UP 00141000 NI TASKSTAT,X'FF'-LOCKLIST OTHERWISE RESET CLEANUP FLAG 00142000 L R3,TGREG1 SET REG.3 TO ADDRESS OF START OF LOCK LIST 00143000 GOUNLOCK EQU * 00144000 L R4,0(R3) REG.4 = CONTENTS OF THIS LOCK LIST ENTRY 00145000 TM 0(R3),X'40' IS THE SKIP FLAG SET FOR THIS ENTRY? 00146000 BO GOSKIPIT YEP - CHECK FOR END OF LIST FLAG 00147000 XC 1(3,R4),1(R4) CLEAR SYNCH LOCK TASK ELEMENT ADDR FIELD 00148000 GOSKIPIT EQU * 00149000 LTR R4,R4 IS THE END OF LIST FLAG SET HERE? 00150000 BM GOGOGO YEP - ALL DONE - GO DISPATCH THE TASK 00151000 LA R3,4(R3) OTHERWISE REG.3 = ADDR OF NEXT LIST ENTRY 00152000 B GOUNLOCK PROCESS TO THE END OF THE LIST 00153000 SPACE 00154000 GOGOGO EQU * 00155000 MVC NEWPSW(8),TPSW GET IT'S PSW IN LOW CORE 00156000 LM R0,R15,TGREG0 LOAD TASK'S SAVED REGISTERS 00157000 LPSW NEWPSW AND DISPATCH THE SELECTED TASK 00158000 SPACE 00159000 GONOGO EQU * 00160000 XC ACTIVE(4),ACTIVE CLEAR ACTIVE FIELD 00161000 LPSW GOWAIT LOAD A MASKED ON WAIT STATE PSW 00162000 SPACE 00163000 DS 0D 00164000 GOWAIT DC X'FF060000',A(0) STANDARD WAIT STATE PSW @VM01136 00165010 EJECT 00166000 COPY RSSEQU 00167000 EJECT 00168000 COPY SVECTORS 00169000 EJECT 00170000 COPY TAREA 00171000 EJECT 00172000 COPY TASKE 00173000 END 00174000