Commit cce1584b authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix OS_Args 1 and OS_GBPB 3/4 for files > 2G.

In OS_Args 1 a compare was followed by a conditional store, but with files > 2G some circumstances end up with VS so the store wasn't taken.
In OS_GBPB 3/4 the assessment of how much could be done was based on adding the current fileptr to the request but not respecting the carry out. Reordered the equation to get this calculation right.
Changed a signed compare of a byte variable to use unsigned so auditing of signed condition codes is clearer.
Corrected spelling of 'openning'.
Fix copy_srchandle and copy_dsthandle to not assume handles fit in 1 byte.
Tested on a variety of contrived file sizes at the boundaries of 2G and 4G.

Version 2.69. Tagged as 'FileSwitch-2_69'
parent 0b0a3063
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.68"
Module_Version SETA 268
Module_MajorVersion SETS "2.69"
Module_Version SETA 269
Module_MinorVersion SETS ""
Module_Date SETS "04 Aug 2011"
Module_ApplicationDate SETS "04-Aug-11"
Module_Date SETS "16 Oct 2011"
Module_ApplicationDate SETS "16-Oct-11"
Module_ComponentName SETS "FileSwitch"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileSwitch"
Module_FullVersion SETS "2.68"
Module_HelpVersion SETS "2.68 (04 Aug 2011)"
Module_FullVersion SETS "2.69"
Module_HelpVersion SETS "2.69 (16 Oct 2011)"
END
/* (2.68)
/* (2.69)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.68
#define Module_MajorVersion_CMHG 2.69
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 04 Aug 2011
#define Module_Date_CMHG 16 Oct 2011
#define Module_MajorVersion "2.68"
#define Module_Version 268
#define Module_MajorVersion "2.69"
#define Module_Version 269
#define Module_MinorVersion ""
#define Module_Date "04 Aug 2011"
#define Module_Date "16 Oct 2011"
#define Module_ApplicationDate "04-Aug-11"
#define Module_ApplicationDate "16-Oct-11"
#define Module_ComponentName "FileSwitch"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileSwitch"
#define Module_FullVersion "2.68"
#define Module_HelpVersion "2.68 (04 Aug 2011)"
#define Module_LibraryVersionInfo "2:68"
#define Module_FullVersion "2.69"
#define Module_HelpVersion "2.69 (16 Oct 2011)"
#define Module_LibraryVersionInfo "2:69"
......@@ -140,11 +140,11 @@ EnsureCanonicalObject EntryS "r7,r8,r9"
EXITS
50
; neither file nor directory, so it must be a MultiFS file - try openning it
; neither file nor directory, so it must be a MultiFS file - try opening it
MOV lr, #0
STRB lr, [r8]
[ debugensure
DSTRING r1, "Openning partition "
DSTRING r1, "Opening partition "
]
BL OpenMultiFSFile
STRVCB r9, [r8]
......
......@@ -309,7 +309,7 @@ CopyEntry NewSwiEntry "r0-r10",copy ; CopyWildObject destroys all regs
15
MOV r0, #0
MOV r1, #-1
MOV r2, #0 ; don't actually allocated any memory just yet
MOV r2, #0 ; don't actually allocate any memory just yet
MOV r3, #-1
MOV r4, #(1<<7) ; green bar in task manager
MOV r6, #0
......@@ -1197,13 +1197,13 @@ CopyFile Entry
LDMIA r7, {r1, r6, fscb} ; copy_name, copy_special, copy_fscb
BL OpenFileForCopy
BVS %BT95 ; Deallocate block
STRB r0, copy_srchandle
STR r0, copy_srchandle
LDR r14, util_bitset ; >>>a186<<< addition
TST r14, #util_peekdest
BNE %FT61 ; Already got dest into suitable state
; If not util_peekdest then EnsureDestFileWriteable after openning source
; If not util_peekdest then EnsureDestFileWriteable after opening source
BL CopyFile_EnsureDestFileWriteable ; Get to dest; maybe unlock
BVS %FT91 ; Close source >>>a186<<< fix vvv
BNE %FT91 ; [don't copy: close source]
......@@ -1233,7 +1233,7 @@ CopyFile Entry
; ***^ BL AssessDestinationForPath
BL OpenFileForCopy
BVS %FT91 ; Close source
STRB r0, copy_dsthandle
STR r0, copy_dsthandle
ADR r9, gbpb_memadr ; Prepare for loop
LDR r5, util_length ; n_left := size(src)
......@@ -1258,7 +1258,7 @@ CopyFile Entry
SUB r5, r5, r3 ; n_left -:= n_to_do (Exactly 0 if end)
MOV r10, r3
LDRB r1, copy_srchandle
LDR r1, copy_srchandle
LDR r2, copy_area
STMIA r9, {r2, r3}
......@@ -1272,7 +1272,7 @@ CopyFile Entry
BVS %FT86 ; [close dest only, src already closed]
MOV r3, r10 ; Restore n_to_do
LDRB r1, copy_dsthandle
LDR r1, copy_dsthandle
LDR r2, copy_area
STMIA r9, {r2, r3}
......@@ -1338,12 +1338,12 @@ DeadMeat
Copy_CloseSrc Entry "r0-r2"
LDRB r1, copy_srchandle ; Already closed ?
LDR r1, copy_srchandle ; Already closed ?
TEQ r1, #0
EXIT EQ ; Accumulates V
MOV r14, #0
STRB r14, copy_srchandle ; Now closed
STR r14, copy_srchandle ; Now closed
BL Copy_PromptSource ; Accumulates V, preserves r1
......@@ -1362,7 +1362,7 @@ Copy_CloseDst ALTENTRY
BL Copy_PromptDest ; Accumulates V
LDRB r1, copy_dsthandle ; Close dest
LDR r1, copy_dsthandle ; Close dest
B %BT10
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......
......@@ -828,9 +828,9 @@ StaticName_length * 1024 ; Limits size of input filename, path etc.
; size of buffer for enumerating dirs has been increased to allow filenames up to 256 characters
[ UseDynamicAreas
copylocalframesize * &1FC ; Change this if changing ANY frame size
copylocalframesize * &204 ; Change this if changing ANY frame size
|
copylocalframesize * &1F4 ; Change this if changing ANY frame size
copylocalframesize * &1FC ; Change this if changing ANY frame size
]
^ -copylocalframesize, fp
......@@ -866,12 +866,11 @@ copy_rmasize # 4
copy_realload # 4 ; Copy of info that we read so we can do
copy_realexec # 4 ; date comparison after possible restamp
copy_srchandle # 4 ; Handle of file if copying by GBPB
copy_dsthandle # 4
; Byte sized variables
copy_srchandle # 1 ; Handle of file if copying by GBPB
copy_dsthandle # 1
copy_src_dst_flag # 1 ; States as below:
copy_at_source * 0
copy_at_dest * 1
......@@ -1256,8 +1255,8 @@ fsw_varcount SETA fsw_varcount + 4
[ Version >= 164
LDRB r4, [r7] ; see if next char = var type
CMP r4, #CR
ADDLT r7, r7, #1 ; r7 -> variable value to set
MOVGE r4, #VarType_String ; default type
ADDLO r7, r7, #1 ; r7 -> variable value to set
MOVHS r4, #VarType_String ; default type
Push "r4" ; <== save for later
]
MOV r5, r7 ; Find start of next variable name
......
......@@ -405,7 +405,7 @@ open_message_file Entry "r0-r2"
DLINE "Open message file...",cc
]
; Check if we're busy openning it at the moment
; Check if we're busy opening it at the moment
TST r1, #message_file_busy
BEQ %FT10
......
......@@ -213,17 +213,16 @@ FileArgs_ImageStampIs
CMP r0, #OSArgs_SetPTR
BNE %FT60
[ debugosargs
DREG r2,"Setting PTR to "
]
EOR r14, r2, extent ; Moving PTR to same buffer as EOF ?
BICS r14, r14, bufmask
BLEQ InvalidateBGetCache ; Ensures we don't read off EOF
CMP r2, extent ; Trying to move off EOF ?
MOVLS fileptr, r2 ; Merely update fileptr, status
BLS %FT50
BHI %FT40
CLRV ; May set V with files > 2G
MOV fileptr, r2 ; Merely update fileptr, status
B %FT50
40
TST status, #scb_write ; Can we write to the file ?
BEQ %FA98 ; 'Outside file' if not
......@@ -231,7 +230,6 @@ FileArgs_ImageStampIs
MOVVC extent, r2
MOVVC fileptr, extent
50 STMVCIA scb, {status, fileptr, extent} ; Update info exit
assert :INDEX: scb_status = 0
......
......@@ -440,33 +440,12 @@ BufferedMultipleRead Entry "r1, bcb"
; Work out what we are doing; ie. real nbytes for xfer
; if fileptr > extent
; then
; $(
; nbytes_doing := 0
; return
; $)
; endptr := fileptr + nbytes
; if endptr > extent
; then
; $(
; nbytes_doing := extent-startptr
; nbytes_notdoing := endptr-extent
; endptr := fileptr + nbytes_doing
; $)
; else
; $(
; nbytes_doing := nbytes
; nbytes_notdoing := 0
; $)
; memadr +:= nbytes_doing
; fileptr +:= nbytes_doing
ADD r0, fileptr, nbytes ; endptr := startptr + nbytes
SUBS r0, r0, extent ; nbytes_notdoing := endptr-extent
SUBGT nbytes, extent, fileptr ; nbytes_doing := extent-startptr
MOVLE r0, #0 ; nbytes_notdoing := 0
; ;;!!! MOVLE nbytes, nbytes ; nbytes_doing := nbytes
SUB r14, extent, fileptr ; nbytes_available := extent-startptr
CMP r14, nbytes ; can I fulfill the request?
MOVCS r0, #0 ; Yes nbytes_notdoing := 0
; nbytes_doing := nbytes
SUBCC r0, nbytes, r14 ; No nbytes_notdoing := nbytes-nbytes_available
MOVCC nbytes, r14 ; nbytes_doing := nbytes_available
; This is done before the 0-bytes transfer check to ensure the returned
; file pointer is correct, for the read at pointer case
......@@ -480,6 +459,9 @@ BufferedMultipleRead Entry "r1, bcb"
STR r0, gbpb_nbytes ; He gets number not done
; memadr +:= nbytes_doing
; fileptr +:= nbytes_doing
ADD r14, memadr, nbytes ; endaddr := startaddr + nbytes_doing
STR r14, gbpb_memadr
......
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