Commit 0c40540e authored by Dan Ellis's avatar Dan Ellis
Browse files

Fixed bug in memory allocation check code.

  Code has been added to fileswitch to detect whether there is sufficient
memory for a program to execute, and report a sensible error rather than
aborting in it's initialistion code.  This implicitly relied on R12 in
the error routines, which was being corrupted.  R12 register usage has now
replaced by other safe registers.

  This was exacerbated by incorrectly formed AIF headers, such as those
generated by at least some versions of the Easy C Linker, which don't have
correct entries for the size of the data areas of the file.

  Tested on a RPC.  The system appears to work correctly, and malformed AIF
headers cause the error to be raised without other harm.

Version 2.64. Tagged as 'FileSwitch-2_64'
parent 58496303
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.63"
Module_Version SETA 263
Module_MajorVersion SETS "2.64"
Module_Version SETA 264
Module_MinorVersion SETS ""
Module_Date SETS "04 Jun 2001"
Module_ApplicationDate2 SETS "04-Jun-01"
Module_ApplicationDate4 SETS "04-Jun-2001"
Module_Date SETS "20 Aug 2001"
Module_ApplicationDate2 SETS "20-Aug-01"
Module_ApplicationDate4 SETS "20-Aug-2001"
Module_ComponentName SETS "FileSwitch"
Module_ComponentPath SETS "RiscOS/Sources/FileSys/FileSwitch"
Module_FullVersion SETS "2.63"
Module_HelpVersion SETS "2.63 (04 Jun 2001)"
Module_FullVersion SETS "2.64"
Module_HelpVersion SETS "2.64 (20 Aug 2001)"
/* (2.63)
/* (2.64)
* This file is automatically maintained by srccommit, do not edit manually.
#define Module_MajorVersion_CMHG 2.63
#define Module_MajorVersion_CMHG 2.64
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 04 Jun 2001
#define Module_Date_CMHG 20 Aug 2001
#define Module_MajorVersion "2.63"
#define Module_Version 263
#define Module_MajorVersion "2.64"
#define Module_Version 264
#define Module_MinorVersion ""
#define Module_Date "04 Jun 2001"
#define Module_Date "20 Aug 2001"
#define Module_ApplicationDate2 "04-Jun-01"
#define Module_ApplicationDate4 "04-Jun-2001"
#define Module_ApplicationDate2 "20-Aug-01"
#define Module_ApplicationDate4 "20-Aug-2001"
#define Module_ComponentName "FileSwitch"
#define Module_ComponentPath "RiscOS/Sources/FileSys/FileSwitch"
#define Module_FullVersion "2.63"
#define Module_HelpVersion "2.63 (04 Jun 2001)"
#define Module_FullVersion "2.64"
#define Module_HelpVersion "2.64 (20 Aug 2001)"
......@@ -352,10 +352,10 @@ Run_UndatedFile
LDR lr, [r2]
;To save unnecessary hassle, weed out the uncompressed cases...
MOV r12, #&E1000000
ORR r12, r12, #&00A00000 ; Gives us 'MOV R0,R0' in R12
MOV r3, #&E1000000
ORR r3, r3, #&00A00000 ; Gives us 'MOV R0,R0' in R5
TEQ lr, #&FB000000 ; BLNV 0 at &8000? If so, it's C rel 5 vintage.
TEQNE lr, R12 ; MOV R0,R0?
TEQNE lr, R3 ; MOV R0,R0?
MOVEQ r3, r7 ; Bung the code size in R3.
BEQ %FT76 ; Not compressed, so skip the pre-decompression call
......@@ -414,11 +414,11 @@ Run_UndatedFile
LDR lr, [r2, #&10]! ; should be SWI OS_Exit (&EF000011 for AIF), R2 := R2 + 16
SUB lr, lr, #&EF000000
TEQ lr, #&00000011 ; OS_Exit check worked?
LDMEQIB r2, {r0,r1,r12,lr} ; load RO size, RW size, Debug size, ZI size
LDMEQIB r2, {r0,r1,r5,lr} ; load RO size, RW size, Debug size, ZI size
MOV r2, #&8000 ; R2 := &8000 like it was before
BNE %FT71 ; not AIF then
ADD lr, lr, r12 ; lr := debug + zero init
ADD lr, lr, r5 ; lr := debug + zero init
ADD r0, r0, r1 ; R0 := read only + read write
ADD r0, r0, lr ; R0 := read only + read write + debug + zero init
ADD r5, r2, r0 ; R5 := base address + size required
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