*DECK NS$XPD USETEXT COM$NS USETEXT DEF$NS USETEXT DTSB$NS USETEXT ERR$NS USETEXT NAT$NS USETEXT NDCB$NS USETEXT NPT$NS USETEXT NST$NS USETEXT PFC$NS USETEXT PIC$NS USETEXT SMB$NS USETEXT SMD$NS USETEXT STC$NS PROC NS$XPD(ERRCODE); # PROCESS DUMP/LOAD PROCEDURE DIRECTIVES # # TITLE NS$XPD - PROCESS DUMP/LOAD PROCEDURE DIRECTIVES. # BEGIN # NS$XPD # # ** NS$XPD - PROCESS DUMP/LOAD PROCEDURE DIRECTIVES. * * J.C. LEE 1981 * * THIS ROUTINE PROCESSES DUMP/LOAD PROCEDURE DIRECTIVES. * * PROC NS$XPD(ERRCODE) * * ENTRY: * NONE. * * EXIT: * ERRCODE. * * METHOD: * CLEAR ERRCODE. * LOCATE PICB. * SET DONE TO FALSE. * SET I TO 0. * WHILE NOT DONE * AND ERRCODE EQ 0 * AND LQ NAT$PENDI: * DO * INCREMENT INDEX TO NEXT DIRECTIVE. * UPDATE PICB DIRECTIVE INDEX. * CLEAR SECONDARY STATE. * STORE DIRECTIVE IN NAT. * CASE ON PRIMARY STATE TO DETERMINE IF DIRECTIVE IS * VALID FOR THE PROCEDURE CONTROL BLOCK IN PROCESS: * 1) ILLEGAL STATE: * DAYFILE MESSAGE AND ABORT. * 2) SAM-LOAD: * CASE ON XPCB DIRECTIVE CODE. * (ILLEGAL, LOAD, START, ILLEGAL, ILLEGAL, * ILLEGAL, ILLEGAL) * 3) NPU-DUMP: * CASE ON XPCB DIRECTIVE CODE. * (DUMP, LOAD, START, ILLEGAL, ILLEGAL, * ILLEGAL, SAVE-DUMP, ILLEGAL) * 4) NPU-LOAD: * CASE ON XPCB DIRECTIVE. * (DUMP, LOAD, START, ILLEGAL, START-C, * LOAD-NCB, ILLEGAL, ILLEGAL) * EXECUTE XPCB DIRECTIVE. * ENDWHILE * # ITEM ERRCODE U; # ERROR CODE # $BEGIN XREF BEGIN PROC NS$DBG; # TRACE PROCEDURE CALLS # END $END XREF BEGIN PROC MOVEOK; # ALLOW TSB TO MOVE # PROC NETPUT; # NETPUT # PROC NS$FBH; # FORMAT ABH FOR NETWORK SM # FUNC NS$FEC U; # FORMAT ERROR CODE # PROC NS$FLN; # SEND NPU/DT/R(LOAD NDCB) # PROC NS$FLR; # FIND LOAD MODULE RECORD # PROC NS$GNW; # GET NPU WORD # PROC NS$INL; # INITIATE NPU LOAD # PROC NS$MSG; # DISPATCH MESSAGE # PROC NS$SDB; # SEND DUMP BATCH # PROC NS$SLB; # SEND LOAD BATCH # PROC NS$SLT; # START RESPONSE TIMER # PROC NS$TNA; # TERMINATE NPU ACTIVITY # PROC RECALL; # MACREL RECALL # PROC RETERN; # MACREL RETURN # PROC RETTSB; # RELEASE TSB # PROC TSBINFO; # LOCATE TSB # PROC WRITEF; # MACREL WRITEF # END STATUS XPCBCODE # CASES FOR XPCB DIRECTIVE PROCESSING # DUMP, # DUMP SPECIFIED AREA # LOAD, # LOAD SPECIFIED MODULE # START, # START NPU, WAIT FOR RESPONSE # STARTC, # RESTORE NDCB, START NPU # LOADNCB, # LOAD NDCB # SAVENDF, # SAVE NPU DUMP FILE # ENDSPCB, # END OF SPCB # ENDDPCB, # END OF DPCB # ENDLPCB, # END OF LPCB # ILLEGAL, # ILLEGAL XPCB DIRECTIVE # ; ITEM CODE U; # DIRECTIVE CODE # ITEM DONE B; # CURRENT DIRECTIVE PROCESSED # ITEM K I; # TEMPORARY, PICB INDEX # ITEM I I; # INDUCTION VARIABLE # ITEM LMNAME C(6); # LOAD MODULE NAME # ITEM PICBTSBN U; # TSB NO OF PICB TSB # ITEM RI U; # RANDOM INDEX OF FIRST MODULE RECORD # ITEM SS U; # TEMPORARY VARIABLE # ITEM TSBFWA U; # TSB FWA # ITEM TSBSIZE U; # TSB SIZE # ARRAY VDIRTAB [0:DIRCODE"ENDPCB"] S(1); BEGIN # VALID DIRECTIVE TABLE FOR XPCB # ITEM LSAMCODE S:XPCBCODE(00,06,18) = [ # VALID SPCB DIRECTIVE # S"ILLEGAL", S"LOAD", S"ILLEGAL", S"ILLEGAL", S"STARTC", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ENDSPCB", ]; ITEM DNPUCODE S:XPCBCODE(00,24,18) = [ # VALID DPCB DIRECTIVE # S"DUMP", S"LOAD", S"START", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"SAVENDF", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ENDDPCB", ]; ITEM LNPUCODE S:XPCBCODE(00,42,18) = [ # VALID LPCB DIRECTIVE # S"DUMP", S"LOAD", S"START", S"ILLEGAL", S"STARTC", S"LOADNCB", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ILLEGAL", S"ENDLPCB", ]; END DEF L$EM30 # 3 #; DEF DM$EM30 # DM$LOCAL+DM$EVENT+DM$NAMLOG #; # ROUTING OPT # ARRAY MSG$EM30 [0:0] S(L$EM30); BEGIN ITEM EM27$TEXT C(0,0,27) = # EVENT MESSAGE TEXT # ["NPUNAME, LOADING (XXXXXX). "]; ITEM EM30$NPNAM C(0,00,7); # NPU NAME # ITEM EM30$LMNAM C(01,48,06); # LOAD MODULE NAME # ITEM EM30$END U(02,42,18) = [0]; # END OF TEXT # END $BEGIN DEF L$EM60 # 4 #; DEF DM$EM60 # DM$LOCAL+DM$NAMLOG #; # ROUTING OPT # ARRAY MSG$EM60 [0:0] S(L$EM60); BEGIN ITEM EM60$TEXT C(0,0,32) = # MESSAGE TEXT # ["NPUNAME, ILLEGAL PICB DIRECTIVE."]; ITEM EM60$NPNAM C(0,00,7); # NPU NAME # ITEM EM60$END U(3,12,48) = [0]; # END OF TEXT # END $END DEF L$EM11 # 3 #; DEF DM$EM11 # DM$LOCAL+DM$EVENT+DM$NAMLOG #; # ROUTING OPT # ARRAY MSG$EM11 [0:0] S(L$EM11); BEGIN ITEM EM11$TEXT C(0,0,28) = # EVENT MESSAGE TEXT # ["NPUNAME, SAM LOAD COMPLETED."]; ITEM EM11$NPNAM C(0,00,7); # NPU NAME # ITEM EM11$END U(02,48,12) = [0]; # END OF TEXT # END DEF L$EM22 # 4 #; DEF DM$EM22 # DM$LOCAL+DM$EVENT+DM$NAMLOG #; # ROUTING OPT # ARRAY MSG$EM22 [0:0] S(L$EM22); BEGIN ITEM EM22$TEXT C(0,0,32) = # EVENT MESSAGE TEXT # ["NPUNAME, DUMP XXXXXXX COMPLETED."]; ITEM EM22$NPNAM C(0,00,7); # NPU NAME # ITEM EM22$NDPFN C(1,24,7); # NPU DUMP FILE PFN # ITEM EM22$END U(3,12,48) = [0]; # END OF TEXT # END DEF L$EM31 # 3 #; DEF DM$EM31 # DM$LOCAL+DM$EVENT+DM$NAMLOG #; # ROUTING OPT # ARRAY MSG$EM31 [0:0] S(L$EM31); BEGIN ITEM EM31$TEXT C(0,0,24) = # EVENT MESSAGE TEXT # ["NPUNAME, LOAD COMPLETED."]; ITEM EM31$NPNAM C(0,00,7); # NPU NAME # ITEM EM31$END U(2,24,36) = [0]; # END OF TEXT # END DEF L$XPDABT # 2 #; DEF DM$XPDABT # DM$LOCAL+DM$ABORT #; # ROUTING OPTIONS # ARRAY MSG$XPDABT [0:0] S(L$XPDABT); BEGIN ITEM XPDA$TEXT C(0,0,18) = # MESSAGE TEXT # ["INVALID NPU STATE."]; ITEM XPDA$END U(01,48,12) = [0]; # END OF TEXT # END SWITCH XPCBCASE:XPCBCODE # STATUS SWITCH FOR DIRECTIVE PROCESSING# C$DUMP:DUMP, # DUMP DIRECTIVE # C$LOAD:LOAD, # LOAD DIRECTIVE # C$START:START, # START DIRECTIVE # C$STARTC:STARTC, # STARTC DIRECTIVE # C$LOADNCB:LOADNCB, # LOAD NCB DIRECTIVE # C$SAVENDF:SAVENDF, # SAVE NDF DIRECTIVE # C$ENDSPCB:ENDSPCB, # END DIRECTIVE IN SPCB # C$ENDDPCB:ENDDPCB, # END DIRECTIVE IN DPCB # C$ENDLPCB:ENDLPCB, # END DIRECTIVE IN LPCB # C$ILLEGAL:ILLEGAL; # ILLEGAL DIRECTIVE # SWITCH NPSCASE:PRISTATE # STATUS SWITCH FOR NPU PRIMARY STATE # NPS0:NPS$NONO, # IDLE STATE # NPS1:NPS$LSAM, # LOADING SAM # NPS2:NPS$DNPU, # DUMPING NPU # NPS3:NPS$LNPU, # LOADING NPU # NPS0:NPS$DNDCB; # DUMPING NDCB # CONTROL EJECT; $BEGIN NS$DBG("XPD"); $END ERRCODE = 0; DONE = FALSE; I = 0; PICBTSBN = NAT$PITSBN[0]; # TSB NUMBER OF PICB TSB # TSBINFO(TSBSIZE,TSBFWA,PICBTSBN); # LOCATE PICB # P = TSBFWA; # FWA OF PICB # FOR K = 0 WHILE NOT DONE AND ERRCODE EQ 0 AND I LQ NAT$PENDI[0] DO # PROCESS NEXT XPCB DIRECTIVE # BEGIN I = NAT$PDIRI[0] + 1; # INCREMENT INDEX TO NEXT DIRECTIVE # NAT$PDIRI[0] = I; # UPDATE PICB DIRECTIVE INDEX # NAT$SSTATE[0] = 0; # CLEAR SECONDARY STATE # NAT$PCBDIR[0] = PICB$ENTRY[I]; # STORE DIRECTIVE IN NAT # CODE = NAT$CODE[0]; # DIRECTIVE CODE # # CASE ON PRIMARY STATE TO DETERMINE IF DIRECTIVE IS VALID FOR THE PROCEDURE CONTROL BLOCK CURRENTLY BEING PROCESSED # SS = NAT$PSTATE[0]; # PRIMARY STATE # GOTO NPSCASE[SS]; NPS0: # ILLEGAL STATE, ABORT NS # BEGIN NS$MSG(MSG$XPDABT,L$XPDABT,DM$XPDABT); END NPS1: # LOADING SAM # CODE = LSAMCODE[CODE]; GOTO NPSXPCB; NPS2: # DUMPING NPU # CODE = DNPUCODE[CODE]; GOTO NPSXPCB; NPS3: # LOADING NPU # CODE = LNPUCODE[CODE]; GOTO NPSXPCB; NPSXPCB: # SWITCH ON XPCB DIRECTIVE CODE # GOTO XPCBCASE[CODE]; C$DUMP: # PROCESS DUMP DIRECTIVE # NS$SDB; # SEND DUMP BATCH # NAT$SSTATE[0] = S"NSS$WDUMP"; # WAITING FOR DUMP RESPONSE # NS$SLT; # START RESPONSE TIMER # GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # C$LOAD: # PROCESS LOAD DIRECTIVE # LMNAME = NAT$LMNAME[0]; # NAME OF LOAD MODULE # NS$FLR(LMNAME,RI,SS,ERRCODE); # FIND LOAD MODULE ON NLF # SENDLB: IF ERRCODE EQ 0 THEN # LOAD MODULE FOUND # BEGIN NS$SLB(LMNAME,RI,ERRCODE); # SEND LOAD BATCH # IF ERRCODE EQ 0 THEN # LOAD BATCH SENT # BEGIN NS$SLT; # START RESPONSE TIMER # NAT$SSTATE[0] = S"NSS$WLOAD"; # WAITING FOR LOAD RESPONSE # EM30$NPNAM[0] = NPNAM; # NPU NAME # EM30$LMNAM[0] = LMNAME; # LOAD MODULE NAME # NS$MSG(MSG$EM30,L$EM30,DM$EM30); # DISPATCH EVENT MSG # END END GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # C$START: # PROCESS START DIRECTIVE # NS$FBH(LNPUDTSR,TRUE); # FORMAT ABH FOR NETWORK SM # PFCSFC[0] = NPUDT; # FORMAT NPU/DT/R(START) # NPUPO[0] = NAT$PN[0]; # SET PORT NUMBER # NPUSP[0] = NAT$SPN[0]; # SET SUBPORT NUMBER # NPULS[0] = NAT$LSN[0]; # SET LOAD SEQUENCE NO # NPUCC[0] = CMDCODE"CC$STRTR"; # SET COMMAND CODE # NETPUT(ABH$WORD,SMB$BUFFER); # SEND NPU/DT/R(START) # NAT$SSTATE[0] = S"NSS$WSTART"; # WAITING FOR START RESPONSE # NS$SLT; # START RESPONSE TIMER # GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # C$STARTC: # PROCESS STARTC DIRECTIVE # IF NAT$PSTATE[0] EQ S"NPS$LSAM" THEN # LOADING SAM # BEGIN # SEND NPU/DT/R(STARTC) # NS$FBH(LNPUDTSC,TRUE); # FORMAT ABH FOR NETWORK SM # PFCSFC[0] = NPUDT; NPUPO[0] = NAT$PN[0]; # SET PORT NUMBER # NPUSP[0] = NAT$SPN[0]; # SET SUBPORT NUMBER # NPULS[0] = NAT$LSN[0]; # SET LOAD SEQUENCE NUMBER # NPUCC[0] = CMDCODE"CC$STRTC";# SET COMMAND CODE # NETPUT(ABH$WORD,SMB$BUFFER); # SEND STARTC REQUEST # GOTO NEXTDIR; # PROCESS NEXT SPCB DIRECTIVE # END NS$FLN(FALSE); # SEND NPU/DT/R (LOAD NDCB) # NAT$SSTATE[0] = S"NSS$WNDCB"; # WAITING FOR LOAD NDCB RESPONSE# NS$SLT; # START RESPONSE TIMER # GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # C$LOADNCB: # PROCESS LOAD NCB DIRECTIVE # IF NPT$NCBSZ[NTORD] LQ NAT$NCBSZ[0] THEN # NCB SIZE WITHIN ALLOWED LIMIT # BEGIN # LOAD NCB INTO NPU # LMNAME = "NCB"; # LOAD MODULE IS NCB # RI = NPT$NCBRI[NTORD]; # RANDOM INDEX OF NCB ON NCF # NAT$NCBFWA[0] = NAT$DIRP2[0]; # NCB FWA # NAT$LMNAME[0] = LMNAME; # SAVE LOAD MODULE NAME # END ELSE # NCB SIZE EXCEEDS ALLOWED LIMIT# BEGIN ERRCODE = NS$FEC(EC"ERR$FILE",FEC"ERR$NCBSIZ"); END GOTO SENDLB; # SEND LOAD BATCH # C$SAVENDF: NAT$F$SNDF[0] = TRUE; # SET SAVE NPU DUMP FLAG # GOTO NEXTDIR; # CONTINUE WITH NEXT DIRECTIVE # C$ILLEGAL: # PROCESS ILLEGAL XPCB DIRECTIVE # $BEGIN EM60$NPNAM[0] = NPNAM; # NPU NAME # NS$MSG(MSG$EM60,L$EM60,DM$EM60); # DISPATCH MESSAGE # $END NAT$DEC[0] = NAT$DEC[0] + 1; # INCREMENT DIRECTIVE ERROR CNT # IF NAT$DEC[0] GR MAX$DEC THEN # ILLEGAL DIRECTIVE IN PICB # BEGIN ERRCODE = NS$FEC(EC"ERR$FILE",FEC"ERR$PICBD"); END GOTO NEXTDIR; # CONTINUE WITH NEXT DIRECTIVE # C$ENDSPCB: # PROCESS END OF SAM LOAD PROCEDURE # STC$SAML = STC$SAML + 1; # INCREMENT NO OF SAM LOADS # EM11$NPNAM[0] = NPNAM; # NPU NAME # NS$MSG(MSG$EM11,L$EM11,DM$EM11); # DISPATCH MESSAGE # TSBINFO(TSBSIZE,TSBFWA,NPT$NSTTSB[NTORD]); # LOCATE NST # P = TSBFWA; NST$SAMSPC[0] = 0; # CLEAR CONSECUTIVE SAM PREEMPT COUNT # MOVEOK(NPT$NSTTSB[NTORD]); # ALLOW NST TO MOVE # NS$TNA; # TERMINATE NPU ACTIVITY # GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # C$ENDDPCB: # PROCESS END OF NPU DUMP PROCEDURE # TSBINFO(TSBSIZE,TSBFWA,NAT$NDTSBN[0]); # LOCATE DUMP TSB # P = TSBFWA; P = TSBFWA + L$DTSBHDR; # FWA OF DUMP FET # WRITEF(DTSB$FET); # WRITE END OF FILE TO NPXXXYY # EM22$NPNAM[0] = NPNAM; # SET NPU NAME # EM22$NDPFN[0] = DFET$LFN[0]; # SET PFN OF NPU DUMP FILE # NS$MSG(MSG$EM22,L$EM22,DM$EM22); # DISPATCH MESSAGE # STC$DUMPS = STC$DUMPS + 1; # INCREMENTS DUMPS GENERATED # TSBINFO(TSBSIZE,TSBFWA,NPT$NSTTSB[NTORD]); # LOCATE NST TSB # P = TSBFWA; # FWA OF NST # TSBINFO(TSBSIZE,TSBFWA,NAT$SMTSBN[0]); # LOCATE DUMP NDCB RESP # P = TSBFWA; # FWA OF DUMP NDCB RESPONSE # NST$DPDATE[0] = DTSB$PDATE[0]; # MOST RECENT DUMP DATE/TIME # NST$NDFPFN[0] = DFET$LFN[0]; # MOST RECENT DUMP FILE PFN # NS$GNW(NDCB,LNPUDTDN,NDCBINDEX"NDCB$HALTC",SS); NST$NHC[0] = SS; # SET NPU HALT CODE # NS$GNW(NDCB,LNPUDTDN,NDCBINDEX"NDCB$PREG",SS); NST$NPR[0] = SS; # RESET NPU P-REGISTER CONTENT # MOVEOK(NPT$NSTTSB[NTORD]); # ALLOW NST TO MOVE # MOVEOK(NAT$SMTSBN[0]); # ALLOW NDCB DUMP RESP TO MOVE # RECALL(DTSB$FET); # WAIT UNTIL WRITEF COMPLETES # RETERN(DTSB$FET); # RETURN NPU DUMP FILE # RECALL(DTSB$FET); # WAIT UNTIL RECALL COMPLETES # RETTSB(NAT$NDTSBN[0]); # RELEASE DUMP TSB # NAT$NDTSBN[0] = 0; # CLEAR DUMP TSB NUMBER # NAT$F$SNDF[0] = FALSE; # CLEAR SAVE NDF FLAG # NS$INL(ERRCODE); # INITIATE NPU LOAD # GOTO NEXTDIR; # CONTINUE WITH NEXT DIRECTIVE # C$ENDLPCB: # PROCESS END OF NPU LOAD PROCEDURE # EM31$NPNAM[0] = NPNAM; # SET NPU NAME # NS$MSG(MSG$EM31,L$EM31,DM$EM31); # DISPATCH EVENT MESSAGE # TSBINFO(TSBSIZE,TSBFWA,NPT$NSTTSB[NTORD]); # LOCATE NST # P = TSBFWA; # UPDATE NST # NST$LPDATE[0] = NAT$LPDATE[0]; # SET MOST RECENT LOAD DATE/TIME# NST$LC[0] = NST$LC[0] + 1; # INCREMENT LOAD COUNT # NST$SLFC[0] = 0; # CLEAR SUCCESSIVE LOAD FAILURE COUNT # IF CURTIME LS NST$DTIMER[0] THEN # ANOTHER LOAD BEFORE DTIMER EXPIRES # BEGIN # INCREMENT LOAD COUNT WITHIN DTIMER # NST$LCOUNT[0] = NST$LCOUNT[0] + 1; END ELSE # DTIMER ALREADY TIMES OUT # BEGIN NST$DTIMER[0] = CURTIME + DTIMER; # RESTART DTIMER # NST$LCOUNT[0] = 1; # RESET LOAD COUNT WITHIN DTIMER TO 1 # END MOVEOK(NPT$NSTTSB[NTORD]); # ALLOW NST TO MOVE # IF NAT$F$RMTL[0] THEN # LOADING REMOTE NPU # BEGIN STC$REML = STC$REML + 1; # INCREMENT REMOTE LOAD COUNT # NS$FBH(LNPUIN,TRUE); # FORMAT ABH FOR NPU/IN/N # PFCSFC[0] = NPUINN; NPUPO[0] = NAT$PN[0]; # SET PORT NUMBER # NPUSP[0] = NAT$SPN[0]; # SET SUBPORT NUMBER # NPULT[0] = LOADTYPE"LT$REMOT"; # SET REMOTE LOAD TYPE # NETPUT(ABH$WORD,SMB$BUFFER); # SEND NPU/IN/N # END ELSE # LOADING LOCAL NPU # STC$LOCL = STC$LOCL + 1; # INCREMENT NO OF LOCAL LOADS # NS$TNA; # TERMINATE NPU ACTIVITY # GOTO EXITXPCB; # EXIT DIRECTIVE PROCESSING # EXITXPCB: # DIRECTIVE DONE, EXIT XPCB PROCESSING # DONE = TRUE; NEXTDIR: END MOVEOK(PICBTSBN); # ALLOW PICB TO MOVE # RETURN; END # NS$XPD # TERM