From 782926b5380aed41276bbcccdb72f6e3ad151c4b Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Fri, 11 Jan 2019 14:14:30 -0800 Subject: [PATCH] Integrated arcdev.68 changes and fixed issues with those changes. Resolves #1478. --- src/syseng/{arcdev.70 => arcdev.71} | 82 ++++++++++++++++++----------- 1 file changed, 52 insertions(+), 30 deletions(-) rename src/syseng/{arcdev.70 => arcdev.71} (97%) diff --git a/src/syseng/arcdev.70 b/src/syseng/arcdev.71 similarity index 97% rename from src/syseng/arcdev.70 rename to src/syseng/arcdev.71 index 8a8db89b..de9f897a 100644 --- a/src/syseng/arcdev.70 +++ b/src/syseng/arcdev.71 @@ -49,9 +49,7 @@ SWTLST: 0 ;This is the locked switch list, used to undo AOS's if we are killed. LOC 77 SIXBIT /ARCDEV/ -RDEVN: 0 ;Real filenames of file open in creator's channel on the -RFN1: 0 ;archive device. However, RDEVN is set up so that if the -RFN2: 0 ;archive is referred through a link, this still works. +RDEVN: BLOCK 3 ;Real filenames of file open in creator's channel on the archive device. RDIRN: 0 ACCP: 0 ;Access pointer in open file, as byte # of next byte to transfer. DIRECTN:0 ;-1 if direction is Output. @@ -66,10 +64,7 @@ FILBSZ: 0 ;Byte size file was written in. ;;; From 77 to here is looked at by PEEK. AFDEV: 0 ;Real Device (the machine name) and FN2 of the archive file. -AFFN1: 0 ;The real FN1 is here, so RFNAME on ARC will give original - ;name instead of this one, for the device name -AFFN2: 0 ; -AFDIR: 0 ;(just a copy of RDIRN) +AFFN2: 0 ;(the real FN1 and SNAME are in RDEVN and RDIRN). FILADR: 0 ;Address in core of start of file's data area (actually, start of header). ;Zero only if no file is open. DIRFLG: 0 ;-1 => reading the directory rather than a file. @@ -118,8 +113,6 @@ GO: MOVE P,[-LPDLL-1,,PDL-1] ANDI A,-1 ;NOW .VALUE IF OPCODE IS .IOT - SHOULDN'T HAPPEN, CAIN A,1 ;BUT DID DUE TO A BUG. .VALUE - MOVE A,JBCDEV ;USE ORIGINAL FN1 AS DEVICE NAME FOR RFNAME, ETC. - MOVEM A,RDEVN SYSCAL OPEN,[ ;OPEN THE ARCHIVE DEVICE FILE WE ARE SUPPOSED TO USE. [.BII,,CHDSK] ['DSK,,] @@ -133,10 +126,8 @@ GO: MOVE P,[-LPDLL-1,,PDL-1] CAME B,[SIXBIT/ARC1!!/] ;If the file isn't recognizable as a current-format archive, JRST OLDARC ;maybe it's an old-format one. Load the old handler. SYSCAL RFNAME,[%CLIMM,,CHDSK - %CLOUT,,AFDEV ? %CLOUT,,AFFN1 ? %CLOUT,,AFFN2 ? %CLOUT,,AFDIR] + %CLOUT,,AFDEV ? %CLOUT,,RDEVN ? %CLOUT,,AFFN2 ? %CLOUT,,RDIRN] .LOSE %LSFIL - MOVE A,AFDIR ;CAN USE REAL SNAME SAFELY - MOVEM A,RDIRN SYSCAL RFDATE,[%CLIMM,,CHDSK ? %CLOUT,,ARCCDT] .LOSE %LSFIL ;Read the arc dev's creation date before we lock it. SKIPGE ARCCDT ;If file has none, use current date. @@ -166,6 +157,9 @@ WRGDIR: SKIPA A,[%ENSIO] NSDEV: MOVSI A,%ENSDV JRST NOGO2 +PKNMTD: MOVSI A,%ENAPK ;If Pack Not Mounted, say so, and die. + JRST NOGO2 + FILXST: MOVSI A,%EEXFL ;File already exists error. JRST NOGO2 @@ -222,6 +216,8 @@ OFFSET 0 ARCINI: CAIN B,%ENAFL ;If we couldn't open the file because it was locked, JRST [ PAUSE ;wait and try again. JRST ARCIN1] + CAIN B,%ENAPK ;if pack not mounted, + JRST PKNMTD ;say so and die. HRRZ A,JBCOP CAIE A,%JOOPN ;Create only if opening a file JRST NSDEV @@ -296,13 +292,13 @@ ARCSAL: PUSHJ P,DIRWST JUMPN C,CPOPJ ;Do nothing if files are open, CAIGE B,2000 ;of if there isn't much garbage to clean up. POPJ P, - SYSCAL OPEN,[[.BIO,,CHSALV] ? ['DSK,,] ? ['_ARCSA] ? ['OUTPUT] ? AFDIR] + SYSCAL OPEN,[[.BIO,,CHSALV] ? ['DSK,,] ? ['_ARCSA] ? ['OUTPUT] ? RDIRN] POPJ P, MOVE A,[-2000,,ARCADR] .IOT CHSALV,A ;Write out the old directory, SYSCAL CORBLK,[%CLIMM,,%CBNDW ? %CLIMM,,%JSELF ? %CLIMM,,DIRCPY/2000 %CLIMM,,CHSALV ? %CLIMM,,0] ;then map that page in so we can update it. - .LOSE %LSSYS + JSR CBKLOS ;Now write out the data areas of all files, one by one, ;and make the copy's directory point at them. MOVE Q,UDNAMP+ARCADR @@ -475,9 +471,24 @@ PCLSRD: 0 ;-1 => OUR LAST JOBRET FAILED, SO EXPECT A RESTARTED SYSTEM CALL. ;Get a page of core at address DIRCPY GETPAG: SYSCAL CORBLK,[%CLIMM,,%CBNDW ? %CLIMM,,%JSELF ? %CLIMM,,DIRCPY/2000 ? %CLIMM,,%JSNEW] - .LOSE %LSSYS + JSR CBKLOS POPJ P, +;JSR CBKLOS after a CORBLK which can possibly get NO CORE AVAILABLE. +;If that happens, we sleep and retry. Otherwise, we LOSE. +CBKLOS: 0 + SOS CBKLOS + SOS CBKLOS ;Get address of the CORBLK which failed. + PUSH P,A + .STATUS 0,A + LDB A,[220600,,A] + CAIE A,%ENACR ;If not NO CORE AVAILABLE, pretend we did a .LOSE. + JRST [ POP P,A + SYSCAL LOSE,[ %CLIMM,,%LSSYS ? CBKLOS]] + MOVEI A,300. ;If NO CORE AVAILABLE, wait 10 seconds and return + .SLEEP A, ;to the failing CORBLK to retry it. + JRST @CBKLOS + ;Release the page. RELPAG: SYSCAL CORBLK,[%CLIMM,,0 ? %CLIMM,,%JSELF ? %CLIMM,,DIRCPY/2000] .LOSE %LSSYS @@ -491,7 +502,7 @@ RELPAG: SYSCAL CORBLK,[%CLIMM,,0 ? %CLIMM,,%JSELF ? %CLIMM,,DIRCPY/2000] ;that you won't reference anything outside the directory. ;Anything which might look at the header for a file other than the one which is open ;might look at a file which was created since your last MAPARC. -LOCK: SYSCAL OPEN,[[100000+.BIO,,CHDSK] ? AFDEV ? AFFN1 ? AFFN2 ? AFDIR +LOCK: SYSCAL OPEN,[[100000+.BIO,,CHDSK] ? AFDEV ? RDEVN ? AFFN2 ? RDIRN %CLERR,,TT] JRST LOCKWT SKIPGE Q,ARCCDT @@ -540,7 +551,7 @@ MAPARC: PUSH P,A HRRI A,ARCADR/2000 SETZ B, SYSCAL CORBLK,[%CLIMM,,%CBNDW ? %CLIMM,,%JSELF ? A ? %CLIMM,,CHDSK ? B ? %CLERR,,ERCD] - .LOSE %LSSYS + JSR CBKLOS POP P,C JRST POPBAJ @@ -601,8 +612,8 @@ JOPEN: LDB W,[410100,,JBCOP] ;0 => INPUT 1 => OUTPUT MOVE C,OPMODE ; GET OPEN MODE TRNE C,777771 ; OPEN FOR WRITING? JRST WRGDIR ; WRONG DIRECTION - LOSE - MOVEM A,RFN1 - MOVEM B,RFN2 + MOVEM A,RDEVN+1 + MOVEM B,RDEVN+2 .CALL JBST ;Report file being operated on as .FILE. (DIR) JFCL PUSHJ P,DIRGE1 ;Get a copy of the directory. @@ -701,9 +712,9 @@ CRITTB: CRIT1A,,CRIT1B CRITLN==.-CRITTB FILOP3: MOVE A,UNFN1(Q) ; STORE REAL INFO ABOUT THE FILE - MOVEM A,RFN1 + MOVEM A,RDEVN+1 MOVE A,UNFN2(Q) - MOVEM A,RFN2 + MOVEM A,RDEVN+2 .CALL JBST ; GIVE REAL NAMES TO SYS JFCL MOVE A,BYTSIZ ; Create B.P. to ILDB the first byte of the file. @@ -867,6 +878,7 @@ OPNOUT: PUSHJ P,QFNG ; FIXUP ">" AND "<" IF ANY SETZB J+1,J+2 MOVE C,[-3,,J] PUSHJ P,JFRCIOT ;And output it, using BLT if page already exists. + .value JUMPG TT,OPNOU1 SYSCAL FINISH,[%CLIMM,,CHDSK] .LOSE %LSFIL @@ -1198,11 +1210,11 @@ DIRASC: MOVE D,[440700,,NEWDAT] SETZM FILBLN ;initialize vars used for creating the directory string. MOVE B,AFDEV PUSHJ P,DIRSI4 ;Output machine name and disk dir which archive resides on. - MOVE B,AFDIR + MOVE B,RDIRN PUSHJ P,DIRSIX MOVEI A,40 PUSHJ P,DIRCHR - MOVE B,AFFN1 + MOVE B,RDEVN PUSHJ P,DIRSIX ;Output archive device name, and archive file's FN2. MOVEI A,40 PUSHJ P,DIRCHR @@ -1523,6 +1535,7 @@ JFORCE: SKIPN DIRECTN ;If we are writing a file, stick it into the directory. MOVE D,UDDATP+ARCADR ;Start writing where allocation is being done. MOVE A,D PUSHJ P,JFRCIOT ;Simulate .IOT, using BLT on existing pages. + JRST UNLOCK ;A has new value for file's UNRNDM rh. JFRCX: MOVE J,NEWLEN ;D has updated access pointer. ADD J,BYTSWD @@ -1531,12 +1544,13 @@ JFRCX: MOVE J,NEWLEN ;D has updated access pointer. MOVE C,J ADD C,D CAIL C,ARCMAX ;Return non-skip if we will exceed maximum archive device size. - POPJ P, + JRST UNLOCK PUSH P,J MOVN C,J HRLZS C ;Write out the data we are extending the file with. HRRI C,NEWDAT PUSHJ P,JFRCIOT + .VALUE MOVEM D,UDDATP+ARCADR ;Advance the data area free pointer over what we just gobbled. JUMPG TT,JFOR2 ;If we .IOT'ed to make new pages, SYSCAL FINISH,[%CLIMM,,CHDSK] @@ -1588,9 +1602,16 @@ JFOR3: MOVE A,CRDATE ;Update the file's dates stored in the directory, ;must also be BLT'ed into that page. ;When we return, TT is negative if any new pages were created. ;Clobbers E. Updates D by the number of words transferred. +;Skips unless the archive became full. JFRCIOT: PUSH P,B PUSH P,C + HLRZS C + SUBM D,C + CAIL C,ARCMAX ; see if archive will become full + JRST POPDBJ ; yes, do a skip return + pop p,c ; restore i/o ABJON pointer trashed by above check + push p,c .ACCESS CHDSK,D .IOT CHDSK,C ;First, IOT the whole thing so file length is set right. POP P,C @@ -1613,7 +1634,8 @@ JFRCI2: HRLZ B,C ADDI B,ARCADR ;Transfer them with BLT. ADD D,E BLT B,ARCADR-1(D) -JFRCI1: POP P,D +JFRCI1: AOS -2(P) +POPDBJ: POP P,D POPBJ: POP P,B POPJ P, @@ -1772,8 +1794,8 @@ JRNM1: PUSHJ P,ARCWRT MOVE B,JBCWD6 PUSHJ P,QFNG ;process a > or < appearing in the new filenames. JFCL - MOVEM A,RFN1 - MOVEM B,RFN2 ;Report changed names to RFNAME system call. + MOVEM A,RDEVN+1 + MOVEM B,RDEVN+2 ;Report changed names to RFNAME system call. .CALL JBST .LOSE %LSFIL PUSHJ P,DINSR2 ;Make a new one at the appropriate place, with the new names. @@ -1863,7 +1885,7 @@ TSMPV: PUSH P,A TSMPV1: .SUSET [.RMPVA,,A] LSH A,-10. SYSCAL CORBLK,[%CLIMM,,%CBNDW ? %CLIMM,,%JSELF ? A ? %CLIMM,,%JSNEW] - .LOSE %LSSYS + JSR CBKLOS POP P,A POPJ P, @@ -1889,8 +1911,8 @@ JBST: SETZ MOVEI CHBOJ MOVEI 43 ;SNDSK RDEVN - RFN1 - RFN2 + RDEVN+1 + RDEVN+2 SETZ RDIRN JBRT1: SETZ ;JOBRET call block to report success.