*DECK SSOCOL
USETEXT TEXTSS
PROC SSOCOL (SWTESS);
# TITLE SSOCOL - CONTROL OVERLAY LOADING. #
BEGIN # SSOCOL #
#
** SSOCOL - CONTROL OVERLAY LOADING.
*
* S. H. FISCHER. 82/05/20.
*
* THIS ROUTINE CONTROLS THE LOADING AND EXECUTION OF OVERLAYS.
*
* PROC SSOCOL (SWTESS)
*
* ENTRY:
* SWTESS = STATUS WORKLIST MONITOR ARRAY.
*
* EXIT:
* RETURN PARAMETERS SET DEPENDING ON WHAT EVENT IS TO
* RESTART THIS ROUTINE.
*
* METHOD:
* WHEN AN OVERLAY IS NEEDED TO BE EXECUTED, THE REQUIRED MEMORY
* IS REQUESTED FROM THE TABLE MANAGER, THE OVERLAY LOADED VIA CIO
* FROM THE OVERLAY FILE AND A WORKLIST REQUEST MADE TO EXECUTE
* THE OVERLAY. WHEN THE OVERLAY HAS COMPLETED EXECUTION, ANOTHER
* OVERLAY IS LOADED IF A REQUEST WAS QUEUED OR THE OVERLAY AREA
* RETURNED TO THE TABLE MANAGER.
*
#
#
**** PROC SSOCOL - XREF LIST.
#
XREF
BEGIN
PROC ABORT; # ABORT JOB (MACREL) #
PROC MESSAGE; # ISSUE DAYFILE MESSAGE (MACREL) #
PROC READ; # RANDOM READ TO CIO BUFFER #
PROC RECALL; # RETURNS CONTROL WHEN COMPLETE BIT IS SET#
PROC SSSAWR; # ACCEPT WORKLIST REQUESTS #
PROC SSTSDA; # SET DYNAMIC BASE ADDRESS #
END
#
****
#
*CALL SWTESS
$BEGIN
ARRAY LOADERR [00:00] S(2);
BEGIN
ITEM LE$TEXT C(00,00,18) = ["OVERLAY LOAD ERROR"];
ITEM LE$ZERO U(01,48,12) = [0];
END
$END
ARRAY MREQ[00:00] S(1);
BEGIN
ITEM MREQ$WD U(00,00,59);
ITEM MREQ$C B(00,59,01); # COMPLETION BIT #
END
ITEM ODTEC I; # OVERLAY DEFINITION TABLE ENTRY COUNT #
ITEM NB I; # END OF OVERLAY #
ITEM DONE B; # FLAG FOR SATISFIED MEMORY REQUEST #
ITEM ODTINDX I; # LOOP INDUCTION VARIABLE #
#
** OVLST - STATES ALLOWED FOR THE OVERLAY LOADER.
*
* THIS STATUS LIST DEFINES THE ALLOWED STATES FOR THE OVERLAY
* PROCESSING.
*
#
STATUS OVLST
IDLE, # IDLE, NO OVERLAY REQUESTS AVAILABLE #
WMEM, # WAIT MEMORY, NO SPACE AVAILABLE #
WLOAD, # WAIT LOAD CONPLETION, CIO BUSY #
WCOMP; # WAIT COMPLETION, STILL EXECUTING #
ITEM OVLSTATE S:OVLST = S"IDLE";
SWITCH OVLJMP:OVLST
LIDLE:IDLE,
LWMEM:WMEM,
LWLOAD:WLOAD,
LCOMP:WCOMP;
CONTROL EJECT;
GOTO OVLJMP[OVLSTATE];
LIDLE:
LCOMP:
# SCAN OVERLAY REQUEST TABLE FOR LOWEST NUMBERED OVERLAY TO LOAD. #
FOR ODTINDX = 1 STEP 1 WHILE (ODTINDX LQ NODT$)
AND (ORT$MAP[ODTINDX] EQ 0 )
DO
BEGIN
END
IF ODTINDX GR NODT$
THEN
BEGIN
# AT THIS POINT RELEASE THE OVERLAY AREA IF WE HAVE RESERVED CM. #
SSTSDA(LOADBASE,MREQ,DONE);
FOR ODTINDX=ODTINDX WHILE NOT DONE
DO
BEGIN
RECALL(MREQ);
SSTSDA(LOADBASE,MREQ,DONE);
END
ORC = 0; # WAIT FOR NEXT OVERLAY REQUEST #
OVLSTATE = OVLST"IDLE";
STE$RTN = LOC(SSOCOL);
STE$ADDR1 = LOC(ORC);
STE$INIT1 = 0;
STE$ADDR2 = 0;
STE$INIT2 = 0;
RETURN;
END
OVNUM = ODTINDX;
MREQ$C = TRUE;
#
* SEARCH EACPM (5400) TABLE FOR REQUIRED OVERLAY (MATCH ON PRIMARY
* LEVEL NUMBER. GET RELATIVE PRU ADDRESS OF DESIRED OVERLAY.
#
ODTEC = EAC$DL[0] / 2; # NUM OF PRIMARY OVERLAY ENTRYS #
FOR ODTINDX=0 STEP 1
WHILE ODT$PLVL[ODTINDX] NQ OVNUM
AND ODTINDX LS ODTEC
DO # FIND REQUIRED OVERLAY DEF #
BEGIN END
$BEGIN
IF ODTINDX GQ ODTEC
THEN
BEGIN
MESSAGE (LOADERR, 0);
ABORT;
END
$END
LWMEM:
# KEEP MAKING MEMORY REQUESTS UNTIL MEMORY IS AVAILABLE #
OVLSTATE = OVLST"WMEM";
NB = ODT$LWA[ODTINDX];
SSTSDA( NB, MREQ, DONE );
IF NOT DONE
THEN
BEGIN
STE$RTN = LOC(SSOCOL);
STE$ADDR1 = LOC(MREQ);
STE$INIT1 = MREQ$WD[0];
STE$CBIT1 = FALSE;
STE$ADDR1 = 0;
STE$INIT2 = 0;
RETURN;
END
# START OVERLAY LOAD. #
OF$LFN[0] = "OVLFILE";
OF$CBIT[0] = TRUE;
OF$R[0] = TRUE;
OF$L[0] = OFSIZ$-5;
OF$FIRST[0] = LOADBASE;
OF$IN[0] = LOADBASE;
OF$OUT[0] = LOADBASE;
OF$LIMIT[0] = NB + O"101"; # INSURE ALL OF OVL IS READ #
OF$RR[0] = ODT$PRU[ODTINDX];
READ (OVLFET);
OVLSTATE = OVLST"WLOAD";
LWLOAD:
# WHEN LOAD IS COMPLETE, START EXECUTATION. #
IF NOT OF$CBIT[0]
THEN
BEGIN
STE$RTN = LOC(SSOCOL);
STE$ADDR1 = LOC(OVLFET);
STE$INIT1 = OF$WORD[0];
STE$CBIT1 = FALSE;
STE$ADDR2 = 0;
STE$INIT2 = 0;
RETURN;
END
$BEGIN
IF OF$LNAT[0] NQ 0
THEN
BEGIN
MESSAGE (LOADERR, 0);
ABORT;
END
$END
SSSAWR(SSOEOPW); # EXECUTE OVERLAY #
SSOVLD = FALSE;
OVLSTATE = OVLST"WCOMP";
STE$RTN = LOC(SSOCOL);
STE$ADDR1 = LOC(SSOVLD);
STE$INIT1 = 0; # FALSE #
STE$ADDR2 = 0;
STE$INIT2 = 0;
RETURN;
END # SSOCOL #
TERM