Commit 5a07a9e0 authored by Robert Sprowson's avatar Robert Sprowson

Fixes in BigSectors option

Previous testing with RAMFS was limited by the size of RAM disc, and hence complexity of layout, meaning some cases with BigSectors were missed.
FileCore20.s: During mount, when loading the defect list from the boot block at &C00, take care to round down the source sector address to account for it only being aligned up to 1k sectors (but not for 2k and 4k).
FileCore25.s: When loading the head of a BigDir (to find out its actual size) and finding it to be > 2k, skip loading the bit from 2k-4k, since that was already loaded when the head was read in, and reading it a second time offset by 2k fails the head/tail check.
FileCore31.s: When building a table to decide which zones to compact, use FindBuffer() to get some temporary store if too large to fit into ScratchSpace.
Identify.s: Comment updated.
BigDirCode.s: (Unrelated) Fix for bad error pointer being passed back, due to R0 being restored on encountering an error during directory rename.

FSBashed for 300k cycles on Titanium with an assortment of manufacturer drives, capacities, and sector sizes.

Version 3.74. Tagged as 'FileCore-3_74'
parent 549666f4
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.73"
Module_Version SETA 373
Module_MajorVersion SETS "3.74"
Module_Version SETA 374
Module_MinorVersion SETS ""
Module_Date SETS "29 Apr 2017"
Module_ApplicationDate SETS "29-Apr-17"
Module_Date SETS "16 Jun 2017"
Module_ApplicationDate SETS "16-Jun-17"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.73"
Module_HelpVersion SETS "3.73 (29 Apr 2017)"
Module_FullVersion SETS "3.74"
Module_HelpVersion SETS "3.74 (16 Jun 2017)"
END
/* (3.73)
/* (3.74)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.73
#define Module_MajorVersion_CMHG 3.74
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Apr 2017
#define Module_Date_CMHG 16 Jun 2017
#define Module_MajorVersion "3.73"
#define Module_Version 373
#define Module_MajorVersion "3.74"
#define Module_Version 374
#define Module_MinorVersion ""
#define Module_Date "29 Apr 2017"
#define Module_Date "16 Jun 2017"
#define Module_ApplicationDate "29-Apr-17"
#define Module_ApplicationDate "16-Jun-17"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.73"
#define Module_HelpVersion "3.73 (29 Apr 2017)"
#define Module_LibraryVersionInfo "3:73"
#define Module_FullVersion "3.74"
#define Module_HelpVersion "3.74 (16 Jun 2017)"
#define Module_LibraryVersionInfo "3:74"
......@@ -2466,6 +2466,7 @@ DoOsFunRenameBigDir ROUT
BL CanBigDirShrink
BLEQ ShrinkBigDir
14
STRVS R0, [SP]
Pull "R0,R1,R2,R3,R4,R6,R7,PC"
......
......@@ -776,8 +776,10 @@ MountDiscOnDrive ROUT
ASSERT DiscRecord_DiscName = DiscRecord_DiscId + 2
STR lr, [r5, #DiscRecord_DiscId]
[ BigDisc
; DiscSize2
STR lr, [r5,#DiscRecord_BigMap_DiscSize2]
[ BigShare
; ShareSize
STR lr, [r5,#DiscRecord_BigMap_ShareSize]
]
]
......@@ -1798,11 +1800,16 @@ Mount
BNE %FT10
]
MOV r2, #DefectListDiscAdd
[ BigSectors
DefectListDiscAligned * (DefectListDiscAdd:SHR:12):SHL:12 ; Round DLDA down to nearest whole sector
|
DefectListDiscAligned * (DefectListDiscAdd:SHR:10):SHL:10 ; Round DLDA down to nearest whole sector
]
MOV r2, #DefectListDiscAligned
ORR r2, r2, r1, ASL #(32-3)
EOR r2, r2, #bit31
MOV r3, #ScratchSpace
MOV r4, #SzDefectList
LDR r4, =DefectListDiscAdd - DefectListDiscAligned + SzDefectList
10
[ DebugL
......@@ -1838,12 +1845,14 @@ Mount
Push "r0,r1"
MOV r0, #ScratchSpace
ADD r0, r0, #DefectListDiscAdd - DefectListDiscAligned
MOV r1, #SzDefectList
BL CheckSum
BVS %FT15
; Pick up heads/sectorsize/secspertrk/density/lowsector/DiscSize from read block
MOV r4, #ScratchSpace
ADD r4, r4, #DefectListDiscAdd - DefectListDiscAligned
ADD r4, r4, #DefectStruc
; Density <= DensityOctal
......@@ -1864,11 +1873,15 @@ Mount
BEQ %FT15
STRB lr, [r5, #DiscRecord_SecsPerTrk]
; 256 <= SectorSize <= 1024
; 256 <= SectorSize <= upper limit
LDRB lr, [r4, #DiscRecord_Log2SectorSize]
CMP lr, #8
BLO %FT15
CMP lr, #10
[ BigSectors
CMP lr, #12 ; upper limit 4k
|
CMP lr, #10 ; upper limit 1k
]
BHI %FT15
STRB lr, [r5, #DiscRecord_Log2SectorSize]
......
......@@ -217,25 +217,13 @@ FindDirCommon
MOV R7, R3 ;save dir disc address
MOV R8, R5 ;save dir buffer ptr
[ Debug6
[ BigDir
CMP R4, #0
BEQ %FT01
]
DREG R5, "Going to read dir to start, end:",cc
DREG R6, ","
[ BigDir
01
]
]
[ BigDir
; if it's big dir, then things get a lil' harder
CMP R4, #0
BNE %FT70
MOV R4, #NewDirSize ; get the first 2048 bytes
MOV R4, #BigDirMinSize ; get the first 2048 bytes
ADD r6,r4,r5 ; end
......@@ -278,7 +266,16 @@ FindDirCommon
66
MOV r5, #NewDirSize ; start offset
MOV r5, #BigDirMinSize ; start offset
[ BigSectors
MOV lr, r7, LSR #(32-3)
DiscRecPtr lr, lr
LDRB lr, [lr, #DiscRecord_Log2SectorSize]
MOV r5, r5, LSR lr
MOV r5, r5, LSL lr ; round down to nearest sector for DiscOp
MOV r3, r3, LSR lr
MOV r3, r3, LSL lr ; round dir buf offset similarly
]
SUBS r4, r4, r5 ; amount of data to read
......@@ -301,6 +298,11 @@ FindDirCommon
70
]
[ Debug6
DREG R5, "Going to read dir to start, end:",cc
DREG R6, ","
]
MOV R1, #DiscOp_ReadSecs ;ALLOW ESCAPE AND TIMEOUT
MOV R2, R3
MOV R3, R5
......
......@@ -404,12 +404,30 @@ MultiBit bit 30
BL Log2AllocBits ;(->LR)
MOV R2, LR
ASSERT ?ScratchSpace>=16*K
MOV R0, #ScratchSpace
LDRB R1, [R10,#ZoneHead+DiscRecord_Log2SectorSize]
MOV R5, #8*2
MOV R1, R5,LSL R1
MOV R1, R1,LSR R2
[ BigSectors
CMP R1, #?ScratchSpace
MOVLS R0, #ScratchSpace
BLS %FT28 ;table can fit in scratch space
Push "R2-R3"
MOV R3, R1 ;search for a buffer (not ScratchSpace, of course)
MOV R2, R1
MOV R0, #(1:SHL:UseSpareScreen) :OR: (1:SHL:UseWimpFree) :OR: \
(1:SHL:UseRmaHeap) :OR: (1:SHL:UseSysHeap)
BL FindBuffer ;(R0-R3->R0-R3,V)
MOVVC R0, R1
MOVVC R1, R2
Pull "R2-R3"
BVS %FT95
28
|
ASSERT ?ScratchSpace>=16*K
MOV R0, #ScratchSpace
]
BL ZeroRam ;init tables of gap frequencies
ADD R1, R0, R1,LSR #1
MOV R5, #0 ;init total gaps between ptrs
......@@ -432,9 +450,11 @@ PreFirstGap # 4
FirstGap # 4
LastGap # 4
LastSize # 4
FoundBuffer # 4
AllocWork2 # 0
Push "R3, R6-R12" ;save dir & reserve 28 bytes stack space
Push "R0" ;save buffer (for ReturnBuffer)
Push "R3,R6-R12" ;save dir & reserve stack space
BL NextFree ;(R10,R11->R9, R11,Z,C)
[ BigMaps
BLNE FreeRdLenBits ;(R10,R11->R7)
......@@ -528,7 +548,8 @@ AllocWork2 # 0
42 ;IF R9 short of total
MOV R7, R9, LSR R2
SUB LR, R1, R7
CMPS LR, #ScratchSpace
LDR R0, FoundBuffer
CMPS LR, R0
LDRGTB R0, [R1, R7]
LDRGTB LR, [R1,-R7]
TEQGTS R0, LR ;AND unused gap of size R9 exists (GT preserves N=V=0)
......@@ -723,6 +744,11 @@ AllocWork2 # 0
87
MOV R0, #0
88
[ BigSectors
LDR LR, FoundBuffer ;if FindBuffer used, free it
TEQ LR, #ScratchSpace
BLNE ReturnBuffer
]
ADD SP, SP, #:INDEX:AllocWork2
B %FT93
......@@ -730,6 +756,11 @@ AllocWork2 # 0
BIC R6, R6, #WasteBit
ADD R1, R4, R6 ;gap length in map bits
LDR R6, PreBestPtr
[ BigSectors
LDR LR, FoundBuffer ;if FindBuffer used, free it
TEQ LR, #ScratchSpace
BLNE ReturnBuffer
]
ADD SP, SP, #:INDEX:AllocWork2
90
BL DefFindIdThenClaim ;(R3,R4,R6,R10->R2,R5,R11)
......
......@@ -801,8 +801,8 @@ SanityCheckEDiscRecord ROUT
[ BigMaps
; if BigMaps then idlen can be more than MaxFreeLink, so test against
; MaxFreeLink (we're being paranoid here, since maximum sector is 1024
; bytes, needing 13 link bits)
; MaxFreeLink (we're being paranoid here, since maximum sector is 4096
; bytes, needing 15 link bits)
CMP r2, #MaxFreeLinkBits
MOVHI r2, #MaxFreeLinkBits
......
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