Commit 727584b9 authored by Dan Ellis's avatar Dan Ellis
Browse files

Fixed Sleep No More, and made 32-bit compatible.

Detail:
  PipeFS uses UpCall 6 (Sleep) to signal that the reading process can sleep,
using the size of the file as a pollword.  Thus when any data is written into
the pipe, the sleeping process will be woken up.  If an attempt is made to
close the file handle, UpCall 7 (Sleep No More) is broadcast to allow anyone
to object to the closure occurring.  Pipe_Close wasn't checking the error
return from making this call, which was an error.  It will now propogate this
error up to fileswitch upon an attempt being made to close the file while a
process is sleeping on it.

  32-bitness involved changing a load of TEQPs for RestPSRs, and fixing some
functions which had forgotten to use [sp, #Proc_RegOffset].

  Also added !Mk and added stripdepend to MkClean.

Admin:
  Tested on dev board and RiscPC running a fairly recent Ursula build.
Version 0.21. Tagged as 'PipeFS-0_21'
parent 8523ee58
| Copyright 2001 Pace Micro Technology plc
|
| 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 standalone THROWBACK=-throwback
......@@ -14,3 +14,4 @@
|
Dir <Obey$Dir>
amu_machine clean
stripdepnd
\ No newline at end of file
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.20"
Module_Version SETA 20
Module_MajorVersion SETS "0.21"
Module_Version SETA 21
Module_MinorVersion SETS ""
Module_Date SETS "11 Apr 2001"
Module_ApplicationDate2 SETS "11-Apr-01"
Module_ApplicationDate4 SETS "11-Apr-2001"
Module_Date SETS "14 May 2001"
Module_ApplicationDate2 SETS "14-May-01"
Module_ApplicationDate4 SETS "14-May-2001"
Module_ComponentName SETS "PipeFS"
Module_ComponentPath SETS "RiscOS/Sources/FileSys/PipeFS"
Module_FullVersion SETS "0.20"
Module_HelpVersion SETS "0.20 (11 Apr 2001)"
Module_FullVersion SETS "0.21"
Module_HelpVersion SETS "0.21 (14 May 2001)"
END
/* (0.20)
/* (0.21)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.20
#define Module_MajorVersion_CMHG 0.21
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 11 Apr 2001
#define Module_Date_CMHG 14 May 2001
#define Module_MajorVersion "0.20"
#define Module_Version 20
#define Module_MajorVersion "0.21"
#define Module_Version 21
#define Module_MinorVersion ""
#define Module_Date "11 Apr 2001"
#define Module_Date "14 May 2001"
#define Module_ApplicationDate2 "11-Apr-01"
#define Module_ApplicationDate4 "11-Apr-2001"
#define Module_ApplicationDate2 "14-May-01"
#define Module_ApplicationDate4 "14-May-2001"
#define Module_ComponentName "PipeFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/PipeFS"
#define Module_FullVersion "0.20"
#define Module_HelpVersion "0.20 (11 Apr 2001)"
#define Module_FullVersion "0.21"
#define Module_HelpVersion "0.21 (14 May 2001)"
......@@ -294,28 +294,28 @@ PipeCopy_Code ROUT
BVC %BT20
60 MOV R4, R0
MOV R3, PC
SavePSR R3
SUBS R0, R0, R0 ; clear V also
MOVS R1, R7 ; close output file #2
SWINE XOS_Find
MOVVC R0, R4
TEQVCP R3, #0
RestPSR R3, VC
70 MOV R4, R0
MOV R3, PC
SavePSR R3
SUBS R0, R0, R0 ; clear V also
MOV R1, R6 ; close output file
SWI XOS_Find
MOVVC R0, R4
TEQVCP R3, #0
RestPSR R3, VC
80 MOV R4, R0
MOV R3, PC
SavePSR R3
SUBS R0, R0, R0 ; clear V also
MOV R1, R5 ; close input file
SWI XOS_Find
MOVVC R0, R4
TEQVCP R3, #0
RestPSR R3, VC
90
Pull "R1-R6,PC"
......@@ -663,13 +663,13 @@ PipeFS_OSFile EntryS "R1,R7,R9"
BVC %b11
80
MOV r5, r0
MOV r6, pc
SavePSR r6
ASSERT PipeFile_Load = 0
ASSERT PipeFile_Exec = 4
LDMIA r7, {r2, r3} ; don't affect datestamp
BL PipeFS_Close
MOVVC r0, r5
TEQVCP r6, #0
RestPSR r6, VC
90
Pull "r2-r5"
......@@ -719,11 +719,11 @@ PipeFS_OSFile EntryS "R1,R7,R9"
BVC %b16
85
MOV r5, r0
MOV r6, pc
SavePSR r6
LDMIA sp, {r2, r3} ; new load and exec addresses
BL PipeFS_Close
MOVVC r0, r5
TEQVCP r6, #0
RestPSR r6, VC
95
Pull "r2-r5"
ADDVC r6, r7, #PipeFile_Name ; for *OPT 1,1
......@@ -916,7 +916,7 @@ NotSupportedError
ADRL r1, StringROM
BL CopyError
LDMIA sp!, {lr}
ORRS pc, lr, #V_bit
RETURNVS
MakeInternatErrorBlock PipeFS_NotSupported,,BadFSOp
......@@ -1040,7 +1040,7 @@ PipeFS_fsfunc_readdirentriesinfo ROUT
MOVLT R3, #0
MOVLE R4, #-1 ; no files read => all done
99
STRVS R0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
Pull "R0-R2, R5-R11, PC"
; *****************************************************************************
......@@ -1241,7 +1241,7 @@ createpipe Entry "r2-r5"
EXIT
90 MOV r4, r0
MOV r5, pc
SavePSR r5
MOV R0, #ModHandReason_Free
[ dynamicareas
BL releaseheapchunk
......@@ -1249,7 +1249,7 @@ createpipe Entry "r2-r5"
SWI XOS_Module ; error caused because no room for buffer
]
MOVVC r0, r4
TEQVCP r5, #0
RestPSR r5, VC
EXIT
LTORG
......@@ -1271,6 +1271,7 @@ PipeFS_Close EntryS "R0-R2"
MOVEQ R0, #PipeFile_writeblocked
MOVNE R0, #PipeFile_readblocked
BL sleepnomore ; R1=handle, R0=offset
BVS %f99
TEQ R0, #PipeFile_readblocked
MOVEQ R0, #PipeFile_lenblocked ; reader may be reading length
BLEQ sleepnomore
......@@ -1301,7 +1302,7 @@ PipeFS_Close EntryS "R0-R2"
BLEQ deletepipe ; delete file if not open and it's empty
EXITS VC
99 STR R0, [sp]
99 STR R0, [sp, #Proc_RegOffset]
EXIT
......@@ -1316,7 +1317,7 @@ sleepnomore Entry "R0,R1"
MOV R0, #UpCall_SleepNoMore
SWI XOS_UpCall
STRVS R0,[sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT
; *****************************************************************************
......@@ -1351,7 +1352,7 @@ deletepipe EntryS "R0-R3"
]
Pull "R2"
MOV R1, R0
MOV R3, PC
SavePSR R3
MOV R0, #ModHandReason_Free
[ dynamicareas
BL releaseheapchunk
......@@ -1359,10 +1360,10 @@ deletepipe EntryS "R0-R3"
SWI XOS_Module ; free header block
]
MOVVC R0, R1
TEQVCP R3, #0
RestPSR R3, VC
99
EXITS VC
STRVS R0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT VS
; in: r1 -> file header (I think!)
......@@ -1634,14 +1635,14 @@ put_loop
BEQ tryextend ; if no blocking, try to extend buffer
SWI XOS_ReadEscapeState
LDRCC R0, [sp] ; recover byte to store
LDRCC R0, [sp, #Proc_RegOffset] ; recover byte to store
BCC put_loop
ADRCS r0, ErrorBlock_Escape
MOVCS r1, #0
BLCS CopyError
99
STRVS R0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT VS
tryextend
......@@ -1650,7 +1651,7 @@ tryextend
SUB r2, r2, r14
ADD r2, r2, #&100
BL ensuresize ; try to grab another &100 bytes
LDRVC R0, [sp] ; recover byte to store
LDRVC R0, [sp, #Proc_RegOffset] ; recover byte to store
BVC put_loop
BVS %BT99
......@@ -1676,7 +1677,7 @@ try_ensuresize Entry "r0-r4"
LDMEQIA sp, {r0-r2}
BLEQ ensuresize ; only extend if no blocking possible
99
STRVS r0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT
; Allocate at least the given buffer size to a file
......@@ -1738,7 +1739,7 @@ ensuresize Entry "r0,r2-r6"
MOV r14, #1
STR r14, [r1, #PipeFile_writeblocked] ; must be some space now
99 STRVS r0, [sp]
99 STRVS R0, [sp, #Proc_RegOffset]
EXIT
; *****************************************************************************
......@@ -1754,10 +1755,14 @@ PipeFS_Args ROUT
CMP r0, #fsargs_EOFCheck ; EOF always
BEQ args_eofcheck
Push lr
SavePSR lr
BIC lr, lr, #(V_bit+Z_bit)
CMP r0, #fsargs_Flush ; nop
ORREQS pc, lr, #Z_bit ; EQ
ORREQ lr, lr, #Z_bit ; EQ
BEQ exit_args_quick
Pull lr
CMP r0, #fsargs_ReadLoadExec
BEQ args_readloadexec
......@@ -1780,6 +1785,9 @@ PipeFS_Args ROUT
; CMPNE r0, #fsargs_SetPTR ; nop
MOV pc, lr ; EQ/NE from above
exit_args_quick ROUT
RestPSR lr,,f
Pull pc
args_readloadexec
Push "r1,lr"
......@@ -1851,7 +1859,7 @@ args_setext
SUBS r2, r2, #1 ; no need to recache R2
BGT %BT01 ; (don't care if file is shrinking under our feet!)
02
STRVS r0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
Pull "r0,r2,pc"
args_ensuresize
......@@ -1994,7 +2002,7 @@ FindDirEntry Entry "R0,R1,R2,R4,R9-R11"
ADRNE r0, ErrorBlock_IsAFile
ADDNE r1, r2, #PipeFile_Name
BLNE CopyError
STRVS R0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT VS
; check leafname > lastleafname
......@@ -2269,7 +2277,7 @@ extendheap Entry "R0-R5"
SWI XOS_Heap
BLVS shrinkheap ; If that fails, ensure the heap is shrunk back.
01 STRVS R0, [sp] ; Store the error pointer, if required
01 STRVS R0, [sp, #Proc_RegOffset] ; Store the error pointer, if required
Debug da, "extendheap: Exit"
EXIT
......@@ -2300,7 +2308,7 @@ claimheapchunk Entry "R0,R1,R3-R5"
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] ; If not, bail out
STR R0, [sp, #Proc_RegOffset] ; If not, bail out
EXIT
03 BL extendheap ; Try extending the heap by the amount requested (which is still in R3)
......@@ -2312,7 +2320,7 @@ claimheapchunk Entry "R0,R1,R3-R5"
BL shrinkheap ; This may be able to recover some space if we over-allocated
01 STRVS R0, [sp]
01 STRVS R0, [sp, #Proc_RegOffset]
02
Debug da, "claimheapchunk: Exit with",R2
EXIT
......@@ -2339,7 +2347,7 @@ releaseheapchunk Entry "R0,R1"
BLVC shrinkheap
STRVS R0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
Debug da, "releaseheapchunk: Exit"
EXIT
......@@ -2381,7 +2389,7 @@ extendheapchunk Entry "R0,R1,R3-R5"
TEQNE R4, R5
BEQ %FT03 ; If one or the other matched, proceed.
STR R0, [sp] ; Otherwise, bail out.
STR R0, [sp, #Proc_RegOffset] ; Otherwise, bail out.
EXIT
03 MOV R4, R3 ; Remember the amount we want to change by
......@@ -2399,7 +2407,7 @@ extendheapchunk Entry "R0,R1,R3-R5"
BL shrinkheap
01 STRVS R0, [sp]
01 STRVS R0, [sp, #Proc_RegOffset]
02
Debug da, "extendheapchunk: Exit"
EXIT
......@@ -2432,7 +2440,7 @@ open_messagefile Entry r0-r3
ADR R1, message_filename
MOV r2, #0
SWI XMessageTrans_OpenFile
STRVS r0, [sp]
STRVS R0, [sp, #Proc_RegOffset]
EXIT VS
MOV r0, #1
STR r0, MessageFile_Open
......
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