Commits (4)
  • John Ballance's avatar
    Adjust RAMFS to permit larger RAM disc formatting · f7287ab5
    John Ballance authored
    Detail:
    Increased the number of sectors per track in the disc record in s.RamFS50
    This prevents the track count getting too large and causing an abort in
    RAMFSFiler.
    Admin:
    tested in iyo
    JB
    
    
    Version 2.30. Tagged as 'RAMFS-2_30'
    f7287ab5
  • Jeffrey Lee's avatar
    Add support for the RAMFS dynamic area potentially being a PMP · bfddc33b
    Jeffrey Lee authored
    Detail:
      s/Defns - Add PMP switch to switch between PMP-compatible code and old code. Add BigDisc2 switch to enable my (non-functional) support for RAM discs > 512MB. Fix broken debug switches (Hdr:Proc already gets included somewhere), and add PMP debug switch.
      s/RamFS05 - Replace generic BlockMove function with BlockRead/BlockWrite functions which map in pages on demand, using a basic LRU cache to reduce page table thrashing.
      s/RamFS15 - Updated to use BlockRead/BlockWrite functions, and BigDisc2 support
      s/RamFS50 - BigDisc2 code. PMP-related initialisation.
    Admin:
      Tested on Pandaboard, with and without PMP dynamic area
      Note that due to nonfunctional support for RAM discs >512MB, the resize handler in the kernel currently places a 512MB limit on the DA.
    
    
    Version 2.31. Tagged as 'RAMFS-2_31'
    bfddc33b
  • Robert Sprowson's avatar
    Use FileCore terminology for clarity · 375a634f
    Robert Sprowson authored
    375a634f
  • Jeffrey Lee's avatar
    Avoid unnecessary remainder calculations · a08c3cc7
    Jeffrey Lee authored
    Detail:
      s/RamFS50 - Avoid unnecessary remainder calculation in DivRem macro
    Admin:
      Tested on Cortex-A15
    
    
    Version 2.32. Tagged as 'RAMFS-2_32'
    a08c3cc7
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.29"
Module_Version SETA 229
Module_MajorVersion SETS "2.32"
Module_Version SETA 232
Module_MinorVersion SETS ""
Module_Date SETS "13 Jul 2013"
Module_ApplicationDate SETS "13-Jul-13"
Module_Date SETS "08 May 2016"
Module_ApplicationDate SETS "08-May-16"
Module_ComponentName SETS "RAMFS"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/RAMFS/RAMFS"
Module_FullVersion SETS "2.29"
Module_HelpVersion SETS "2.29 (13 Jul 2013)"
Module_FullVersion SETS "2.32"
Module_HelpVersion SETS "2.32 (08 May 2016)"
END
/* (2.29)
/* (2.32)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.29
#define Module_MajorVersion_CMHG 2.32
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 13 Jul 2013
#define Module_Date_CMHG 08 May 2016
#define Module_MajorVersion "2.29"
#define Module_Version 229
#define Module_MajorVersion "2.32"
#define Module_Version 232
#define Module_MinorVersion ""
#define Module_Date "13 Jul 2013"
#define Module_Date "08 May 2016"
#define Module_ApplicationDate "13-Jul-13"
#define Module_ApplicationDate "08-May-16"
#define Module_ComponentName "RAMFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/RAMFS/RAMFS"
#define Module_FullVersion "2.29"
#define Module_HelpVersion "2.29 (13 Jul 2013)"
#define Module_LibraryVersionInfo "2:29"
#define Module_FullVersion "2.32"
#define Module_HelpVersion "2.32 (08 May 2016)"
#define Module_LibraryVersionInfo "2:32"
......@@ -26,9 +26,15 @@ BigDir SETL {TRUE}
GBLL BigDisc ; if this is true then we use new filecore
BigDisc SETL {TRUE}
GBLL BigDisc2 ; WIP support for ram disc size > 512MB
BigDisc2 SETL {FALSE}
GBLL BigMaps ; support longer idlen
BigMaps SETL {TRUE}
GBLL PMP ; Support use of physical memory pool DA. Code remains compatible with non-PMP DA.
PMP SETL {TRUE}
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Data areas & register allocation
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -45,6 +51,11 @@ MyPrivate # 4
AlignSpace 64
message_file_block # 16 ; File handle for MessageTrans
message_file_open # 4 ; Opened message file flag
[ PMP
PageFlags # 4 ; Flags to use when mapping pages
PMPSize # 4 ; Logical size of PMP (page count)
LRUCache # 4 ; Array of (log page, phys page) pairs
]
WorkSize # 0
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -66,19 +77,18 @@ $a SETL $b :LAND: Debug
GBLL Debug3
GBLL Debug4
GBLL Debug9
GBLL DebugPMP
Debug3 switch {TRUE} ; low level op
Debug4 switch {TRUE} ; misc op
Debug9 switch {TRUE} ; useful routines
DebugPMP switch {TRUE}
GBLS NeedHdrDebug
GBLS NeedHdrProc
GBLS NeedHdrHostFS
[ Debug
NeedHdrProc SETS "GET Hdr:Proc"
NeedHdrDebug SETS "GET Hdr:Debug"
|
NeedHdrDebug SETS "; No"
NeedHdrProc SETS "; No"
]
[ :DEF: Host_Debug
Host_Debug SETL {FALSE}
......@@ -87,7 +97,6 @@ NeedHdrHostFS SETS "GET Hdr:HostFS"
|
NeedHdrHostFS SETS "; No"
]
$NeedHdrProc
$NeedHdrDebug
$NeedHdrHostFS
......@@ -106,5 +115,9 @@ Zone0Bits * Zone0DiscRecSz * 8
MyMaxSupportedDiscOp * DiscOp_ReadTrk
MyMaxSupportedDrive * 0
MyMinSupportedDriveSize * 8 * 1024
MyLog2SectorSize * 10 ; 9 = 512, 10 = 1024
; n.b. 512 byte sector has max disc size approx 256MB. 1024 max is 512MB
ChangeDyn_RamFS * 5 ; Our DA number
END
......@@ -120,4 +120,151 @@ BlockMove ROUT
BPL %BT40
Pull "R0-R12, PC"
[ PMP
; Entry: R0 = Source start (byte disc address)
; R1 = Dest start (RAM address)
; R2 = Byte length
BlockRead ROUT
TEQ r2, #0
MOVEQ pc, lr
Entry "r0-r5"
MOV r3, r0
MOV r4, r2
10
BL GetPageChunk
BVS %FT90
MOV r0, r5
BL BlockMove
ADD r1, r1, r2
CMP r4, #0
BNE %BT10
EXIT
90
FRAMSTR r0
EXIT
; Entry: R0 = Source start (RAM address)
; R1 = Dest start (byte disc address)
; R2 = Byte length
BlockWrite ROUT
TEQ r2, #0
MOVEQ pc, lr
Entry "r0-r5"
MOV r3, r1
MOV r4, r2
10
BL GetPageChunk
BVS %FT90
MOV r1, r5
BL BlockMove
ADD r0, r0, r2
CMP r4, #0
BNE %BT10
EXIT
90
FRAMSTR r0
EXIT
GetPageChunk ROUT
Entry "r0-r1,r6-r9"
; In:
; r3 = byte disc address
; r4 = byte length
; Out:
; r2 = chunk length
; r3 advanced
; r4 reduced
; r5 -> chunk
[ DebugPMP
DREG r3,,cc
DREG r4,", ",cc
DLINE "*>GetPageChunk"
]
LDR r0, LRUCache
LDR r1, PMPSize
CMP r0, #0
ADD r1, r0, r1, LSL #3
BEQ %FT90
; First, find/create logical mapping of page
10
LDMIA r0, {r6, r7} ; Get log page index, phys page index
STMIA r0!, {r8, r9} ; Write previous entry over this one
TEQ r7, r3, LSR #12 ; Found the page?
BEQ %FT30
MOV r8, r6 ; Shuffle things down
TEQ r0, r1
MOV r9, r7
BNE %BT10
; Didn't find it in the cache
; r8,r9 / r6,r7 = page to replace (last page in cache)
[ DebugPMP
DLINE "Mapping in"
]
MOV r7, r3, LSR #12
; Remap the page
LDR lr, PageFlags
Push "r3,r6,r7,lr" ; Page block
MOV r0, #22 ; PMP_LogOp
MOV r1, #ChangeDyn_RamFS
ADD r2, sp, #4
MOV r3, #1
SWI XOS_DynamicArea
LDR r3, [sp], #16 ; Restore r3, junk page block
BVS %FT80
30
[ DebugPMP
DREG r6,,cc
DREG r7,", ",cc
DLINE " Using this page"
]
; Found it in the cache
; r6,r7 = details
LDR r0, LRUCache
STMIA r0, {r6, r7} ; Move entry to front of cache
; Now work out how much of a chunk we can return
MOV r0, r3, LSL #32-12
MOV r0, r0, LSR #32-12 ; Offset into page
ADD r1, r0, r4 ; End address
CMP r1, #4096
MOVHI r1, #4096
SUB r2, r1, r0 ; Length available
ADD r3, r3, r2
SUB r4, r4, r2
LDR r1, BufferStart
ADD r1, r1, r6, LSL #12 ; Base of page
ADD r5, r1, r0 ; Data pointer
[ DebugPMP
DREG r2,,cc
DREG r3,", ",cc
DREG r4,", ",cc
DREG r5,", ",cc
DLINE "<*GetPageChunk"
]
CLRV
EXIT
80
FRAMSTR r0
EXIT
90
; PMP not in use.
; Just offset by DA base address and return the full block.
LDR r5, BufferStart
MOV r2, r4
ADD r5, r5, r3
ADD r3, r3, r4
MOV r4, #0
[ DebugPMP
DREG r2,,cc
DREG r3,", ",cc
DREG r4,", ",cc
DREG r5,", ",cc
DLINE "<*GetPageChunk"
]
EXIT
|
BlockRead * BlockMove
BlockWrite * BlockMove
]
END
......@@ -40,11 +40,19 @@ LowLevelEntry ROUT
DLINE "*>LowLevel"
]
[ PMP
MOV R5, #0
LDR LR, BufferSize
|
ASSERT :INDEX: BufferStart = 0
ASSERT :INDEX: BufferSize = 4
LDMIA SB, {R5, LR}
]
ASSERT MyMaxSupportedDrive = 0 ; No need to BIC out the drive bits in R2
[ BigDisc2
MOV R2, R2, LSL #MyLog2SectorSize
]
ADDS R6, R2, R4 ; end disc add
SUBNE R6, R6, #1
CMPCCS R6, LR
......@@ -75,7 +83,8 @@ Write
CMPS R6, R4
MOVLS R2, R6
MOVHI R2, R4
BL BlockMove ; (R0-R2)
BL BlockWrite ; (R0-R2)
BVS %FT95
ADD R0, R0, R2
ADD R1, R1, R2
SUBS R6, R6, R2
......@@ -109,7 +118,8 @@ Read
CMPS R6, R4
MOVLS R2, R6
MOVHI R2, R4
BL BlockMove ; (R0-R2)
BL BlockRead ; (R0-R2)
BVS %FT95
ADD R0, R0, R2
ADD R1, R1, R2
SUBS R6, R6, R2
......@@ -126,6 +136,9 @@ Read
90
CLRV
95
[ BigDisc2
MOV R2, R2, LSR #MyLog2SectorSize
]
STRVS R0, [SP]
[ Debug3
BVC %FT01
......@@ -213,11 +226,20 @@ DoMount ROUT
STR R0, BufferStart
STR R1, BufferSize
[ BigDisc2
MOV R2, R2, LSL #MyLog2SectorSize
]
MOV R1, R3
ASSERT MyMaxSupportedDrive = 0 ; No need to BIC out the drive bits in R2
[ PMP
MOV R0, R2
|
ADD R0, R0, R2
]
MOV R2, R4
BL BlockMove ; (R0,R1,R2)
BL BlockRead ; (R0,R1,R2)
BVS %FT90
[ BigDisc
; when we have big discs, we have a problem - the disc size
......@@ -226,21 +248,37 @@ DoMount ROUT
MOV R1, R5
MOV R2, #SzDiscRecSig2
BL BlockMove ; (R0,R1,R2)
BVS %FT90
LDR r0, BufferSize
STR r0, [r5, #DiscRecord_DiscSize]
[ BigDisc2
; Ensure the big disc flag is set correctly
CMP r0, #512<<20
LDRB r0, [r5, #DiscRecord_BigMap_Flags]
BICLS r0, r0, #DiscRecord_BigMap_BigFlag
ORRHI r0, r0, #DiscRecord_BigMap_BigFlag
STRB r0, [r5, #DiscRecord_BigMap_Flags]
]
|
; copy from the record in the map
[ PMP
MOV R0, #ZoneHead
|
LDR R0, BufferStart
ADD R0, R0, #ZoneHead
]
MOV R1, R5
MOV R2, #DiscRecSig
BL BlockMove
BL BlockRead
BVS %FT90
]
CLRV
90
STRVS R0, [SP]
Pull "R0-R2, PC"
; DoMount
; DoPollChanged
; -------
; Misc op 1
; Entry: R1 = drive
......
......@@ -15,10 +15,12 @@
; >RamFS50
TTL "Initialisation and FS star commands"
; SecPerTrack needs to be larger than 1 to prevent track count
; exceeding its max and 'blowing' part of RAMFSFiler
SkeletonDiscRec ; fields marked * need filling in
DCB 10 ; Log2SectorSize
DCB 1 ; SecPerTrk (this is a RAM disc, after all)
DCB MyLog2SectorSize ; Log2SectorSize
DCB 128 ; SecPerTrk (this is a RAM disc)
DCB 1 ; Heads
DCB DensitySingle ; Density
DCB 0 ; * IdLen
......@@ -59,7 +61,11 @@ RamFSString = "RAM",0
ALIGN
FSCreateBlock
[ BigDisc2
DCB CreateFlag_NoBigBuf, (CreateFlag_NewErrorSupport + CreateFlag_BigDiscSupport):SHR:8, 0
|
DCB CreateFlag_NoBigBuf, CreateFlag_NewErrorSupport:SHR:8, 0
]
DCB fsnumber_ramfs
DCD RamFSString - Module_BaseAddr
DCD RamFSBootText - Module_BaseAddr
......@@ -68,6 +74,9 @@ FSCreateBlock
EmptyDefectList
DCD DefectList_End
[ BigDisc2
DCD DefectList_BigMap_End
]
InitRAMDisc ROUT
Push "R0-R11, LR"
......@@ -114,7 +123,7 @@ InitRAMDisc ROUT
MOV r4, #0
STMIA r2, {r0,r3,r4} ; byte address 0 on drive 0
MOV r3, #0
MOV r4, #1024
MOV r4, #1:SHL:MyLog2SectorSize
LDR r8, FileCorePrivate
SWI XFileCore_DiscOp64
ADD sp, sp, #SzExtendedDiscAddress
......@@ -191,7 +200,7 @@ InitDiscRec ROUT
; r6 = number of bits in a zone
; r7 = number of allocation bits in the map
; r8 = ids per zone
Min_IdLen * 10+3 ; min allowed idlen (with 1024 byte zones)
Min_IdLen * MyLog2SectorSize + 3 ; min allowed idlen = log2(bits in a sector)
[ BigMaps
Max_IdLen * 19 ; max allowed idlen
|
......@@ -250,7 +259,7 @@ Max_Zones * 16 ; max allowed zones
Push "R0, R1, R2"
MOV r0, r6 ; allocation bits in a zone
ADD r1, r3, #1 ; idlen+1
DivRem r8, r0, r1, r2
DivRem r8, r0, r1, r2, norem
Pull "R0, R1, R2"
; check that IdLen is enough for total possible ids
......@@ -365,6 +374,15 @@ Max_Zones * 16 ; max allowed zones
BLS %BT10 ; back around
90
[ BigDisc2
; Ensure the big disc flag is set correctly
LDR r4, [r5, #DiscRecord_DiscSize]
CMP r4, #512<<20
LDRB r4, [r5, #DiscRecord_BigMap_Flags]
BICLS r4, r4, #DiscRecord_BigMap_BigFlag
ORRHI r4, r4, #DiscRecord_BigMap_BigFlag
STRB r4, [r5, #DiscRecord_BigMap_Flags]
]
Pull "R0-R11, PC"
; InitEntry
......@@ -396,6 +414,9 @@ InitEntry ROUT
; OSS Flag that the message file is closed.
MOV r0, #0
STR r0, message_file_open
[ PMP
STR r0, LRUCache
]
CMPS R6, #MyMinSupportedDriveSize ; Only initialise if at least this must RAM
BCC %FT60
......@@ -408,6 +429,50 @@ InitEntry ROUT
STR SB, [R11]
[ PMP
; Check if PMP is in use
MOV r0, #24
MOV r1, #ChangeDyn_RamFS
SWI XOS_DynamicArea
BVS %FT17
TST r4, #1:SHL:20
BEQ %FT17
; PMP enabled - store details and init the LRU cache
MOV r5, r5, LSR #12
STR r4, PageFlags ; These are the full DA flags rather than just the page flags, but the kernel will mask them down as necessary
STR r5, PMPSize
MOV r0, #ModHandReason_Claim
MOV r3, r5, LSL #3
SWI XOS_Module
BVS %FT85
STR r2, LRUCache
; Init LRU cache
SUB r0, r5, #1 ; DA logical page index
MOV r1, #-1 ; No physical page mapped there
10
STMIA r2!, {r0, r1}
SUBS r0, r0, #1
BGE %BT10
; Unmap anything which is already there, to ensure state matches cache
MOV r0, #0
MOV r2, #-1
MOV r4, #0
Push "r0,r2,r3"
MOV r0, #22
15
MOV r2, sp
MOV r3, #1
SWI XOS_DynamicArea
BVS %FT16
ADD r4, r4, #1
CMP r4, r5
STRLT r4, [sp]
BLT %BT15
16
ADD sp, sp, #12
17
]
ADR R0, FSCreateBlock
ADRL R1, Module_BaseAddr
LDR r2, MyPrivate
......@@ -467,7 +532,7 @@ DieEntry
]
MOV R0, #ModHandReason_Delete
ADR R1, FullTitle
ADRL R1, FullTitle
SWI XOS_Module
[ Debug3
DLINE "Killed parent"
......@@ -485,6 +550,13 @@ DieEntry
MOV r0, #0
STR r0, message_file_open
[ PMP
MOV R0, #ModHandReason_Free
LDR R2, LRUCache
TEQ R2, #0
SWINE XOS_Module
]
MOV R0, #ModHandReason_Free
MOV R2, SB
SWI XOS_Module ; Free workspace
......