Commit 7a9d7b7d authored by Robert Sprowson's avatar Robert Sprowson

Reenable background transfer support when BigFiles is {TRUE}

BigDirCode.s: Retire BigDirFix switch, it wasn't actually a fix, it was more that the directory format was changed early in development, but there's no point keeping support for the prototype any more
FileCore45.s/FileCore25.s/FileCore31.s/FileCore35.s/DebugOpts.s: Retire BigDirFix
Defns.s: Shock addition of some comments
FileCore.s: Manual inclusion of CPU/Arch no longer needed
FileCore70.s: Crucially apply the same 1k dead band to the FileSwitch "write zeros" entry point, since it (along with Get/PutBytes) are the only places file offsets get passed
FileCore80.s: Lots of tedious and subtle boundary cases fixed
InitDieSvc.s: Removed the disabling switch
doc/BigDisc/ADFSBuffer: Detail what the BufFlags mean

Tested on ADFS (the only background-transferring filing system about) with LFAUs of 2k, 4k, 8k, 16k and bashing 65536 iterations.

Version 3.57. Tagged as 'FileCore-3_57'
parent 47fd7e2c
......@@ -15,6 +15,19 @@ Each buffer is a 1K buffer. It can however be considered
as two sub-buffers of 512 bytes or four sub-buffers of
256 bytes.
The buffers are controlled by 'BufFlags' which is a 32 bit word arranged as 4 bytes,
one for each sub-buffer. The value of 'BufSz' describes how the buffer is to be
divided, for example a drive with 512 byte sectors would divide it in two.
But BufSz is only an 8 bit variable, so the actual number of bytes in a buffer
is expressed by first shifting down by 'BufScale', which is 5. In other words
1024 -> 32; 512 -> 16; 256 -> 8.
We can see these cunningly allow the BufFlags to be manipulated using shifts
which exactly correspond to the number of bytes of flags which would be needed to
describe the corresponding number of sub-buffers. The downside to this scheme
is the buffers are stuck at 1K without some serious rewriting of the code.
Processes
---------
......
| Copyright 2012 Castle Technology Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine gpa_debug THROWBACK=-throwback
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.56"
Module_Version SETA 356
Module_MajorVersion SETS "3.57"
Module_Version SETA 357
Module_MinorVersion SETS ""
Module_Date SETS "24 Feb 2013"
Module_ApplicationDate SETS "24-Feb-13"
Module_Date SETS "25 Mar 2013"
Module_ApplicationDate SETS "25-Mar-13"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.56"
Module_HelpVersion SETS "3.56 (24 Feb 2013)"
Module_FullVersion SETS "3.57"
Module_HelpVersion SETS "3.57 (25 Mar 2013)"
END
/* (3.56)
/* (3.57)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.56
#define Module_MajorVersion_CMHG 3.57
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Feb 2013
#define Module_Date_CMHG 25 Mar 2013
#define Module_MajorVersion "3.56"
#define Module_Version 356
#define Module_MajorVersion "3.57"
#define Module_Version 357
#define Module_MinorVersion ""
#define Module_Date "24 Feb 2013"
#define Module_Date "25 Mar 2013"
#define Module_ApplicationDate "24-Feb-13"
#define Module_ApplicationDate "25-Mar-13"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.56"
#define Module_HelpVersion "3.56 (24 Feb 2013)"
#define Module_LibraryVersionInfo "3:56"
#define Module_FullVersion "3.57"
#define Module_HelpVersion "3.57 (25 Mar 2013)"
#define Module_LibraryVersionInfo "3:57"
......@@ -245,16 +245,9 @@ TestBigDirCheckByte ROUT
LDR R1, [R5, #BigDirEntries] ; number of entries
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R1, R1, R1, LSL #3 ; *7
ADD R0, R0, R1, LSL #2 ; 7*4=28
|
ASSERT BigDirEntrySize=32
ADD R0, R0, R1, LSL #5 ; 32 bytes per entry
]
LDR R1, [R5,#BigDirNamesSize] ; size of the heap of names
......@@ -352,14 +345,9 @@ ReadBigDirEntries ROUT
BL GetDirFirstEntry ; (R3,R5->R4)
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB LR, R9, R9, LSL #3 ; *7
ADD R4, R4, LR, LSL #2 ; 7*4=28
|
ASSERT BigDirEntrySize=32
ADD R4, R4, R9, LSL #5 ; pointer to current entry
]
TEQS R11, #fsfunc_ReadDirEntriesInfo
BEQ %FT20
......@@ -608,14 +596,9 @@ BigDirFinished ROUT
LDR LR, [R5, #BigDirEntries]
[ BigDirFix
ASSERT BigDirEntrySize=28
ADD R6, R6, LR, LSL #5 ; *32
SUB R6, R6, LR, LSL #2 ; *(32-4)=*28
|
ASSERT BigDirEntrySize=32
ADD R6, R6, LR, LSL #5
]
ADD R6, R6, R5
ADD R6, R6, #BigDirHeaderSize ; now points to header
......@@ -656,15 +639,9 @@ GetBigDirName ROUT
; R5 now points at entries
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB LR, R6, R6, LSL #3
ADD R6, R5, LR, LSL #2
|
ASSERT BigDirEntrySize=32
ADD R6, R5, R6, LSL #5 ; name heap
]
LDRNE R5, [R4, #BigDirObNamePtr] ; offset into name heap
ADDNE LR, R5, R6
......@@ -689,7 +666,6 @@ GetBigDirName ROUT
ReadBigDirIntAtts ROUT
Push "LR"
ADD LR, LR, R4, LSL #5 ; entry
LDRB LR, [R4, #BigDirAtts] ; read the bottom 8 bits of atts
......@@ -1091,23 +1067,13 @@ BigDirFreeSpace ROUT
SUB R0, R0, #BigDirHeaderSize + BigDirTailSize
LDR LR, [R5, #BigDirEntries]
[ BigDirFix
ASSERT BigDirEntrySize=28
[ BigDirFullBackup
RSB LR, LR, LR, LSL #3 ; *7
SUB R0, R0, LR, LSL #3 ; *7*8=56
|
SUB R0, R0, LR, LSL #5 ; *32
]
|
ASSERT BigDirEntrySize=32
[ BigDirFullBackup
SUB R0, R0, LR, LSL #6 ; TWO copies of entries
|
SUB R0, R0, LR, LSL #5
SUB R0, R0, LR, LSL #2 ; *36
SUB R0, R0, LR, LSL #5 ; *(28+4)
]
]
LDR LR, [R5, #BigDirNameLen] ; length of dir name
ADD LR, LR, #4
......@@ -1218,14 +1184,10 @@ MakeBigDirSpace ROUT
BIC R2, R2, #3
LDR LR, [R5, #BigDirEntries]
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB LR, LR, LR, LSL #3 ; *7
ADD R2, R2, LR, LSL #2 ; *7*4=28
|
ASSERT BigDirEntrySize=32
ADD R2, R2, LR, LSL #5
]
LDR LR, [R5, #BigDirNamesSize] ; size of the heap of names
ADD R2, R2, LR ; word after name heap
......@@ -1272,11 +1234,6 @@ MakeBigDirSpace ROUT
ADD LR, LR, R6
STR LR, [R5, #BigDirNamesSize] ; new number of entries
[ :LNOT: BigDirFix
LDR LR, DirE
STR LR, [R4, #BigDirEntryName] ; give the entry a DirE
]
; finally, generate new offsets into the name heap
ADD R4, R4, #BigDirEntrySize
......@@ -1553,14 +1510,10 @@ GrowBigDir ROUT
MOV R7, LR, LSL R7 ; dummy dir size for ClaimFreeSpace
; find the offending dir entry
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R4, R4, R4, LSL #3 ; *7
MOV R4, R4, LSL #2 ; *4*7=28
|
ASSERT BigDirEntrySize=32
MOV R4, R4, LSL #5 ; will never be dir itself
]
LDR LR, DirBufferPtr
LDR LR, [LR, #BigDirNameLen]
ADD LR, LR, #4
......@@ -1977,12 +1930,6 @@ GrowBigDir ROUT
]
Pull "R0-R11,PC"
; =====================================================================
[ :LNOT: BigDirFix
DirE
= "DirE"
]
; ===============
; CanBigDirShrink
......@@ -2484,14 +2431,10 @@ DoOsFunRenameBigDir ROUT
LDR R2, [R5, #BigDirEntries]
LDR LR, [R5, #BigDirNamesSize]
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R2, R2, R2, LSL #3 ; *7
ADD R2, LR, R2, LSL #2 ; *7*4=*28
|
ASSERT BigDirEntrySize=32
ADD R2, LR, R2, LSL #5
]
ADD R0, R5, #BigDirHeaderSize
ADD R0, R0, R7
ADD R1, R5, #BigDirHeaderSize
......@@ -2903,7 +2846,6 @@ ReturnWholeSpaceNotFudged
ReturnSpaceNotFudged ROUT
Push "R0-R4,R6-R11,LR"
[ Debug5 :LOR: DebugX
DLINE "new len :old len :ind disc:dir :DirEntry:DirStart enter ReturnSpaceNotFudged"
DREG R0," ",cc
......@@ -2914,6 +2856,7 @@ ReturnSpaceNotFudged ROUT
DREG R5," ",cc
DREG R6," "
]
Push "R0-R4,R6-R11,LR"
BL RoundUpAlloc ;(R0,R3->R0)
MOV R6, R0
MOV R0, R1
......
......@@ -46,9 +46,6 @@ BinaryChop SETL {TRUE}
GBLL WriteCacheDir ; Cached directories
WriteCacheDir SETL {FALSE}
GBLL BigDirFix ; Get the size of big directories right
BigDirFix SETL {TRUE}
GBLL BigDirFullBackup
BigDirFullBackup SETL {FALSE}
......
......@@ -407,9 +407,6 @@ BigDirHeaderSize # 0 ; size of the header
^ 0
[ :LNOT: BigDirFix
BigDirEntryName # 4 ; 'DirE'
]
BigDirLoad # 4 ; load address of object
BigDirExec # 4 ; exec address of object
BigDirLen # 4 ; length of object
......@@ -457,10 +454,10 @@ BufPtr RN 11
;FILE CACHE BUFFER
^ 0
BufFlags # 4 ;these 4 are in common with extended FCB
NextInFile # 4
PrevInFile # 4
BufFileOff # 4
BufFlags # 4 ; { these 4 are
NextInFile # 4 ; { in common with
PrevInFile # 4 ; { with the
BufFileOff # 4 ; { extended file control block
BufFcb # 4
OlderBuf # 4
......@@ -487,8 +484,8 @@ AwaitsSeqRead bit AwaitsSeqChain+2
ReadAhead bit ReadAheadChain+2
WriteBehind bit WriteBehindChain+2
AllocFlags * EmptyBuf :OR: UsedMonotonic :OR: NormalBuf :OR:AwaitsSeqRead :OR: ReadAhead :OR: WriteBehind
ASSERT AllocFlags=2_11111100
AllBufFlags * EmptyBuf :OR: UsedMonotonic :OR: NormalBuf :OR:AwaitsSeqRead :OR: ReadAhead :OR: WriteBehind
ASSERT AllBufFlags=2_11111100
; File Control Block
......@@ -506,7 +503,7 @@ AllocFlags * EmptyBuf :OR: UsedMonotonic :OR: NormalBuf :OR:AwaitsSeqRead :
FcbNext # 4 ;link to next FCB
FcbFlags # 1
FcbBufSz # 1
FcbBufSz # 1 ;file cache buffer size in bytes >> BufScale, so 32=1024, 16=512, 8=256
[ BigDir
ASSERT BigDirMaxNameLen<=255
FcbName # 258 ; keep overall alignment the same
......
......@@ -44,7 +44,6 @@ GetHAL SETS ""
GET Hdr:MultiFS
GET Hdr:NewErrors
GET Hdr:Territory
GET Hdr:CPU.Arch
GET Hdr:OSRSI6
GET VersionASM
......
......@@ -579,14 +579,10 @@ TryCacheDirBuf ROUT
BIC R8, R8, #3
LDR LR, [R5, #BigDirEntries]
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB LR, LR, LR, LSL #3 ; *7
ADD R8, R8, LR, LSL #2 ; *7*4=28
|
ASSERT BigDirEntrySize=32
ADD R8, R8, LR, LSL #5
]
LDR LR, [R5, #BigDirNamesSize]
ADD R8, R8, LR ; size for dir body
ADD R8, R8, #3
......
......@@ -161,14 +161,10 @@ NewClaimFree ROUT
BL TestBigDir
BNE NewClaimFree_IsNotBigDir
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R4, R4, R4, LSL #3
MOVS R4, R4, LSL #2
|
ASSERT BigDirEntrySize=32
MOVS R4, R4, LSL #5 ; if R4=0 then dir itself
]
BNE NewClaimFree_IsNotDir
LDR LR, DirBufferPtr
LDR LR, [LR, #BigDirSize] ; size of dir itself
......
......@@ -911,14 +911,11 @@ RemoveDirEntry
LDR LR, [R5, #BigDirEntries]
LDR R2, [R5, #BigDirNamesSize]
ADD R2, R2, #BigDirHeaderSize
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB LR, LR, LR, LSL #3
ADD R2, R2, LR, LSL #2
|
ASSERT BigDirEntrySize=32 ;
ADD R2, R2, LR, LSL #5 ; entries
]
LDR LR, [R5, #BigDirNameLen]
ADD R2, R2, LR
ADD R2, R2, #4
......
......@@ -1198,14 +1198,10 @@ CriticalWriteDir ROUT
LDR R2, [R5, #BigDirEntries]
[ BigDirFullBackup
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R2, R2, R2, LSL #3
MOVS R2, R2, LSL #2
|
ASSERT BigDirEntrySize=32
MOVS R2, R2, LSL #5 ;length for move
]
SUB R1, R6, R2
SUB R1, R1, #BigDirTailSize ; dest for move
BLNE BlockMove ;
......@@ -1226,14 +1222,10 @@ CriticalWriteDir ROUT
DSTRING LR, "crit dir name: "
]
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R2, R2, R2, LSL #3 ;
ADD R0, R0, R2, LSL #2 ; word after entries
|
ASSERT BigDirEntrySize=32
ADD R0, R0, R2, LSL #5 ; word after entries
]
LDR R2, [R5, #BigDirNamesSize] ; size of name space
ADD R0, R0, R2
SUB R1, R1, R0 ; length to zero
......
......@@ -466,7 +466,7 @@ MyOpenFile ROUT
BLEQ ReadAllocSize ;(R3->LR)
CMPS LR, #1*K
MOVHI LR, #1*K
MOV LR, LR, LSR #5
MOV LR, LR, LSR #BufScale
STRB LR, [R9, #FcbBufSz]
STR R9, [R8, #FcbNext]
......@@ -529,7 +529,7 @@ MyOpenFile ROUT
ORREQ R1, R1, #HandleBlkBit
MOVNE R1, R9
LDRB R2, [R9, #FcbBufSz]
MOV R2, R2, LSL #5
MOV R2, R2, LSL #BufScale
LDR R3, [R9, #FcbExtent]
LDR R4, [R9, #FcbAllocLen]
[ BigFiles
......@@ -952,7 +952,7 @@ MyCloseFile ROUT
LDRB LR, [lr, #DiscRecord_Log2SectorSize]
MOV r0, #1
MOV r0, r0, ASL lr
MOV r0, r0, LSR #5
MOV r0, r0, LSR #BufScale
STRB r0, [r1, #FcbBufSz]
; Change FcbAllocLen to match change to shared object
......@@ -1210,17 +1210,17 @@ ReleaseFcbBuffersInRange ROUT
CMP lr, r3 ; If buffer start < transfer end
[ BigFiles
BHS %FT20
ADD lr, lr, #1024
ADD lr, lr, #1*K
SUB lr, lr, #1 ; (generate inclusive buffer end)
CMP r4, lr ; and transfer start <= buffer end Then
BLLS UpdateBufState ;(R2,BufPtr) junk the buffer
BLLS UpdateBufState ;(R2,BufSz,BufPtr) junk the buffer
; And back to the list's start
MOVLS BufPtr, R1
|
ADD lr, lr, #1024 ; (generate exclusive buffer end)
ADD lr, lr, #1*K ; (generate exclusive buffer end)
CMPLO r4, lr ; and transfer start < buffer end Then
BLLO UpdateBufState ;(R2,BufPtr) junk the buffer
BLLO UpdateBufState ;(R2,BufSz,BufPtr) junk the buffer
; And back to the list's start
MOVLO BufPtr, R1
......@@ -1646,10 +1646,19 @@ DoOsArgsWriteZeroes ROUT
BL WaitForControllerFree ;(R0)
LDRB BufSz, [Fcb, #FcbBufSz]
MOV FileOff, R2
[ BigFiles
CMP FileOff, #-1*K ; Start point is in the write behind dead-band
BCS %FT10
ADDS TransferEnd, FileOff, R3
CMPCC TransferEnd, #-1*K
LDRCS TransferEnd, =-1*K ; End point clamped to dead-band
|
ADD TransferEnd, FileOff, R3
]
BL ClaimFileCache
BL EmptyBuffers ;R0,BufSz,FileOff,TransferEnd,Fcb->BufOff,BufPtr
BL ReleaseFileCache
10
MOV R4, R0
MOV R7, R2 ;start offset
......
This diff is collapsed.
......@@ -65,11 +65,6 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
DREG R5," ",cc
DREG R6," "
]
[ BigFiles
! 0, "BigFiles disabled background transfers"
MOV R5, #0
]
; Split out Floppies and Winnies
ASSERT DriveConfig_FloppyCount_Shift = 0
AND R7, R3, #DriveConfig_FloppyCount_Mask ;floppies
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment