Commits (2)
  • Robert Sprowson's avatar
    Clean up pass · d3452baf
    Robert Sprowson authored
    Use objasm {TRUE} and {FALSE}.
    Get error numbers from Hdr:NewErrors and file types from Hdr:FileTypes.
    Parameterise PipeFS_BufferSize and PipeFS_AllocSize.
    Deduce international_help switch locally since International_Help is a bitfield in Hdr:ModHand.
    Use Push/Pop macros.
    d3452baf
  • Robert Sprowson's avatar
    Fix for NULL pointer access reporting monitor name · dea9b663
    Robert Sprowson authored
    PipeFS was carefully preserving R6 (the special field pointer, which is 0 for PipeFS) in the places where FileSwitch expects to get the leafname back when *OPT1,2 is enabled, resulting in a NULL pointer dereference in FileSwitch. Update R6 per the spec.
    Delete old switch justreturnextent from version 0.06.
    Delete unused Help & Syntax, these are now in Resources/UK.
    
    Version 0.23. Tagged as 'PipeFS-0_23'
    dea9b663
00:*PipeCopy copies file one byte at a time Syntax: *PipeCopy <inputfile> <outputfile> [<outputfile>]
00:Syntax: *PipeCopy <inputfile> <outputfile> [<outputfile>]
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
GBLS Module_ApplicationDate2
GBLS Module_ApplicationDate4
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.22"
Module_Version SETA 22
Module_MajorVersion SETS "0.23"
Module_Version SETA 23
Module_MinorVersion SETS ""
Module_Date SETS "14 May 2001"
Module_ApplicationDate2 SETS "14-May-01"
Module_ApplicationDate4 SETS "14-May-2001"
Module_Date SETS "18 Aug 2016"
Module_ApplicationDate SETS "18-Aug-16"
Module_ComponentName SETS "PipeFS"
Module_ComponentPath SETS "RiscOS/Sources/FileSys/PipeFS"
Module_FullVersion SETS "0.22"
Module_HelpVersion SETS "0.22 (14 May 2001)"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/PipeFS"
Module_FullVersion SETS "0.23"
Module_HelpVersion SETS "0.23 (18 Aug 2016)"
END
/* (0.22)
/* (0.23)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.22
#define Module_MajorVersion_CMHG 0.23
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 May 2001
#define Module_Date_CMHG 18 Aug 2016
#define Module_MajorVersion "0.22"
#define Module_Version 22
#define Module_MajorVersion "0.23"
#define Module_Version 23
#define Module_MinorVersion ""
#define Module_Date "14 May 2001"
#define Module_Date "18 Aug 2016"
#define Module_ApplicationDate2 "14-May-01"
#define Module_ApplicationDate4 "14-May-2001"
#define Module_ApplicationDate "18-Aug-16"
#define Module_ComponentName "PipeFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/PipeFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/PipeFS"
#define Module_FullVersion "0.22"
#define Module_HelpVersion "0.22 (14 May 2001)"
#define Module_FullVersion "0.23"
#define Module_HelpVersion "0.23 (18 Aug 2016)"
#define Module_LibraryVersionInfo "0:23"
......@@ -52,6 +52,7 @@ Module_BaseAddr
GET Hdr:HighFSI
GET Hdr:LowFSI
GET Hdr:NewErrors
GET Hdr:FileTypes
GET Hdr:Variables
GET Hdr:Wimp
GET Hdr:UpCall
......@@ -70,16 +71,13 @@ Module_BaseAddr
GBLL debugxx
GBLL hostvdu
debug SETL false ; set to true, then turn on individual areas
debugup SETL debug :LAND: false
debugrg SETL debug :LAND: false
debugfs SETL debug :LAND: false
debugda SETL debug :LAND: false
debugxx SETL debug :LAND: false
hostvdu SETL false ; set to true to use TML (HostFS) output
GBLL justreturnextent
justreturnextent SETL Module_Version = 6 ; removed in version 0.07
debug SETL {FALSE} ; set to true, then turn on individual areas
debugup SETL debug :LAND: {FALSE}
debugrg SETL debug :LAND: {FALSE}
debugfs SETL debug :LAND: {FALSE}
debugda SETL debug :LAND: {FALSE}
debugxx SETL debug :LAND: {FALSE}
hostvdu SETL {FALSE} ; set to true to use TML (HostFS) output
; 22-Jan-2001 (ADH)
;
......@@ -87,7 +85,7 @@ justreturnextent SETL Module_Version = 6 ; removed in version 0.07
; or set to false to use RMA. There's no run-time detection.
GBLL dynamicareas
dynamicareas SETL true
dynamicareas SETL {TRUE}
; 22-Jan-2001 (ADH)
;
......@@ -109,15 +107,13 @@ dynamicareas SETL true
GBLL upcalloncallback
GBLL delayedupcall
upcalloncallback SETL false ; otherwise, use "dynamicareas", *not* "true"
upcalloncallback SETL {FALSE} ; otherwise, use "dynamicareas", *not* "true"
delayedupcall SETL :LNOT: upcalloncallback
TAB * 9
LF * 10
FF * 12
CR * 13
[ :LNOT: :DEF: international_help
GBLL international_help
international_help SETL {TRUE} ; Default to RISC OS 3.60+ internationalisation
]
; File header format
......@@ -137,7 +133,8 @@ PipeFile_writeblocked # 4 ; block if attempting to write
PipeFile_lenblocked # 4 ; block if attempting to read length
PipeFile_Name # 0 ; null terminated file name
PipeFS_BufferSize * &100 ; fixed size allocated for data
PipeFS_BufferSize * &100 ; fixed size minimum allocated for data
PipeFS_AllocSize * &10 ; fixed size incremental allocation
; extra bits involved in a file handle
......@@ -203,7 +200,7 @@ DAReason_Renumber # 1
DCD 0 ; PipeFS_SWIdecode- Module_BaseAddr
DCD 0 ; PipeFS_SWInames - Module_BaseAddr
DCD 0
[ International_Help <> 0
[ international_help
DCD message_filename - Module_BaseAddr
|
DCD 0
......@@ -216,39 +213,43 @@ PipeFS_Title
= "PipeFS", 0
PipeFS_HelpStr
= "PipeFS", TAB, TAB, "$Module_MajorVersion ($Module_Date)"
= "PipeFS", 9, 9, "$Module_MajorVersion ($Module_Date)"
[ Module_MinorVersion <> ""
= " $Module_MinorVersion"
]
DCB 0
ALIGN
[ :LNOT:No32bitCode
module_flags
DCD ModuleFlag_32bit
]
[ dynamicareas
PipeFS_DAName
DCB "PipeFS", 0
]
[ international_help
PipeFS_HC_Table
Command PipeCopy, 3, 2, International_Help
DCD 0
DCB 0
PipeCopy_Help DCB "HPFSCPY", 0
PipeCopy_Syntax DCB "SPFSCPY", 0
|
PipeFS_HC_Table
Command PipeCopy, 3, 2, 0
DCB 0
[ International_Help=0
PipeCopy_Help
DCB "*PipeCopy copies files one byte at a time", 13, 10
PipeCopy_Syntax
DCB "Syntax: *PipeCopy <inputfile> <outputfile> [<outputfile>]", 0
|
PipeCopy_Help DCB "HPFSCPY", 0
PipeCopy_Syntax DCB "SPFSCPY", 0
]
[ dynamicareas
PipeFS_DAName
DCB "PipeFS", 0
]
ALIGN
[ :LNOT:No32bitCode
module_flags
DCD ModuleFlag_32bit
]
; *****************************************************************************
;
; This command allows byte copying of one file to another
......@@ -683,7 +684,8 @@ PipeFS_OSFile EntryS "R1,R7,R9"
ASSERT PipeFile_Load = 0
LDMVCIA r7, {r2-r5} ; get file info
ADDVC r6, r7, #PipeFile_Name
BLVC getleafname ; for *OPT 1,1
EXIT
......@@ -732,9 +734,10 @@ PipeFS_OSFile EntryS "R1,R7,R9"
BL PipeFS_Close
MOVVC r0, r5
RestPSR r6, VC
BLVC getleafname ; for *OPT 1,1
95
Pull "r2-r5"
ADDVC r6, r7, #PipeFile_Name ; for *OPT 1,1
EXIT
......@@ -754,9 +757,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
Push "r6"
BL FindFileOrDirectory
Pull "r6"
[ justreturnextent
EXIT
|
EXIT VS
CMP r0, #object_file ; if file found, wait for it to close for writing
......@@ -766,7 +766,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
EXIT VS ; since it will never be unblocked
EXIT EQ
B %b20 ; file still open
]
; read file info without length
; in: R1 -> wildcarded filename
......@@ -811,7 +810,7 @@ PipeFS_OSFile EntryS "R1,R7,R9"
; out: R6 -> filename
40
Push "R1-R6"
Push "R1-R5"
BL getpipe ; R1 -> file header
BVS %FT41
......@@ -844,8 +843,11 @@ PipeFS_OSFile EntryS "R1,R7,R9"
STMVCIA r1, {r2,r3}
SUBVC r2, r5, r4 ; r2 = new size to ensure
BLVC try_ensuresize
MOVVC r7, r1
BLVC getleafname ; for *OPT 1,1
41
Pull "R1-R6"
Pull "R1-R5"
EXIT
......@@ -856,8 +858,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
; NE => file was open for writing, and we blocked
; VS => blocking not possible - r0 -> error
[ :LNOT: justreturnextent ; don't bother with this stuff if doing it the simple way!
blockifwriting Entry "r1"
LDR r14, [r1, #PipeFile_lenblocked]!
......@@ -874,7 +874,6 @@ blockifwriting Entry "r1"
MOVEQ r1, #0
BLEQ CopyError
EXIT
]
; *****************************************************************************
;
......@@ -919,11 +918,11 @@ PipeFS_FSFunc Entry
; Out: r0 -> error block, V set
NotSupportedError
STMDB sp!, {lr}
Push "lr"
ADR r0, ErrorBlock_PipeFS_NotSupported
ADRL r1, StringROM
BL CopyError
LDMIA sp!, {lr}
Pull "lr"
RETURNVS
MakeInternatErrorBlock PipeFS_NotSupported,,BadFSOp
......@@ -1158,7 +1157,7 @@ getpipe ROUT
; *****************************************************************************
;
; in: R1 -> filename
; out: R1 -> file header (with a 256 byte data buffer)
; out: R1 -> file header (with a 'PipeFS_BufferSize' sized data buffer)
;
notread * 1 :SHL: 5 ; file has not been closed for reading
......@@ -1623,11 +1622,9 @@ put_loop
BLNE modifyingpipe
EXITS NE
[ :LNOT: justreturnextent
LDR r14, [r1, #PipeFile_usage] ; don't block if the other end
TST r14, #nowriteblock ; is trying to determine file size
BNE tryextend
]
MOV r14, #0
STR r14, [r1, #PipeFile_writeblocked]! ; 0 => blocked on write
......@@ -1657,7 +1654,7 @@ tryextend
LDR r2, [r1, #PipeFile_wrapend]
LDR r14, [r1, #PipeFile_wrapstart]
SUB r2, r2, r14
ADD r2, r2, #&100
ADD r2, r2, #PipeFS_BufferSize
BL ensuresize ; try to grab another &100 bytes
LDRVC R0, [sp, #Proc_RegOffset] ; recover byte to store
BVC put_loop
......@@ -1698,10 +1695,10 @@ try_ensuresize Entry "r0-r4"
ensuresize Entry "r0,r2-r6"
CMP r2, #&100 ; min buffer size = &100 bytes
MOVLT r2, #&100
ADD r2, r2, #15 ; round up to a multiple of 16 bytes
BIC r6, r2, #15 ; r6 = new block size
CMP r2, #PipeFS_BufferSize ; min buffer size
MOVLT r2, #PipeFS_BufferSize
ADD r2, r2, #PipeFS_AllocSize - 1 ; round up to a multiple of alloc size
BIC r6, r2, #PipeFS_AllocSize - 1 ; r6 = new block size
LDR r4, [r1, #PipeFile_wrapstart]
LDR r5, [r1, #PipeFile_wrapend]
......@@ -1818,11 +1815,6 @@ args_readsize ; actually reads space allocated to file
args_readext ; read size of file
Push "r1,lr"
[ justreturnextent
BIC r1, r1, #pipehandle_bits
LDR r2, [r1, #PipeFile_Ext] ; number of bytes written to file
Pull "r1,pc"
|
TST r1, #pipehandle_write
BIC r1, r1, #pipehandle_bits
LDRNE r2, [r1, #PipeFile_Ext] ; number of bytes written to file
......@@ -1843,7 +1835,6 @@ args_readext ; read size of file
ORREQ r14, r14, #nowriteblock ; we want to know how big the file is
STREQ r14, [r1, #PipeFile_usage] ; - so we must let it all be read in
B %b11
]
args_readptr ; read size of file
Push "r1,lr"
......@@ -1951,10 +1942,10 @@ FindFileOrDirectory Entry
EXIT EQ
MOV R0, #object_directory ; this must be a directory
LDR R14, =&FFFFFF00
BIC R2, R2, R14
LDR R14, =&FFFFFD00 ; all directories are of type 'data'
ORR R2, R2, R14
AND R2, R2, #&FF
LDR R14, =FileType_Data :SHL: 20 ; set type to 'data' keeping high byte of timestamp
ASSERT (FileType_Data :AND: &800) <> 0 ; so the sign bit is copied down by ASR
ORR R2, R2, R14, ASR #12
MOV R4, #0 ; length = 0
MOV R5, #0 ; attributes = 0
......@@ -2105,6 +2096,26 @@ skipdollar Entry
EXIT
; *****************************************************************************
;
; in: R7 -> file header
; out: R6 -> leafname for monitor
; V preserved
;
getleafname Entry "r7"
ADD R7, R7, #PipeFile_Name
MOV R6, R7 ; In case there are no dots
10
LDRB R14, [R7], #1
TEQ R14, #'.'
MOVEQ R6, R7 ; Leaf starting after most recent dot
TEQ R14, #0
BNE %BT10
EXIT
; *****************************************************************************
;
; In : R0 is wildcard spec ptr, R4 is name ptr.
......@@ -2314,12 +2325,11 @@ claimheapchunk Entry "R0,R1,R3-R5"
BVC %FT02 ; If there's no error, there's no problem
LDR R1, [R0] ; Else load the error number into R1
TEQ R1, #&184 ; Error &184 = "Not enough memory (in heap)" (TEQ doesn't clear V)
BEQ %FT03
STR R0, [sp, #Proc_RegOffset] ; If not, bail out
EXIT
TEQ R1, #ErrorNumber_HeapFail_Alloc ; Error "Not enough memory (in heap)" (TEQ doesn't clear V)
STRNE R0, [sp, #Proc_RegOffset] ; If not, bail out
EXIT NE
03 BL extendheap ; Try extending the heap by the amount requested (which is still in R3)
BL extendheap ; Try extending the heap by the amount requested (which is still in R3)
BVS %FT01 ; Can't do it? Bail out. Otherwise try an OS_Heap claim call again.
MOV R0, #HeapReason_Get
......@@ -2391,9 +2401,10 @@ extendheapchunk Entry "R0,R1,R3-R5"
BVC %FT02 ; ...then exit
LDR R4, [R0] ; Else load the error number into R4
TEQ R4, #&184 ; Error &184 = "Not enough memory (in heap)" (TEQ doesn't clear V)
MOV R5, #&1C0
ADD R5, R5, #1 ; Error &1C1 = "Unable to move memory"
LDR R5, =ErrorNumber_HeapFail_Alloc ; Error "Not enough memory (in heap)" (TEQ doesn't clear V)
TEQ R4, R5
LDRNE R5, =ErrorNumber_ChDynamNotAllMoved ; Error "Unable to move memory"
TEQNE R4, R5
BEQ %FT03 ; If one or the other matched, proceed.
......