diff --git a/VersionASM b/VersionASM index d96bff5704afc3da5d2601ab461923656fe3815e..ac9e40f5f3a443db5926c8c28043e9aab6ffbd59 100644 --- a/VersionASM +++ b/VersionASM @@ -11,13 +11,13 @@ GBLS Module_HelpVersion GBLS Module_ComponentName GBLS Module_ComponentPath -Module_MajorVersion SETS "5.92" -Module_Version SETA 592 +Module_MajorVersion SETS "5.93" +Module_Version SETA 593 Module_MinorVersion SETS "" -Module_Date SETS "28 May 2016" -Module_ApplicationDate SETS "28-May-16" +Module_Date SETS "03 Sep 2017" +Module_ApplicationDate SETS "03-Sep-17" Module_ComponentName SETS "RISC_OSLib" Module_ComponentPath SETS "castle/RiscOS/Sources/Lib/RISC_OSLib" -Module_FullVersion SETS "5.92" -Module_HelpVersion SETS "5.92 (28 May 2016)" +Module_FullVersion SETS "5.93" +Module_HelpVersion SETS "5.93 (03 Sep 2017)" END diff --git a/VersionNum b/VersionNum index 131c06920cdec22dde08676011ced1af86ef4421..d1a0a42f95547c2e1c820bebc6af40f2af0e0420 100644 --- a/VersionNum +++ b/VersionNum @@ -1,23 +1,23 @@ -/* (5.92) +/* (5.93) * * This file is automatically maintained by srccommit, do not edit manually. * Last processed by srccommit version: 1.1. * */ -#define Module_MajorVersion_CMHG 5.92 +#define Module_MajorVersion_CMHG 5.93 #define Module_MinorVersion_CMHG -#define Module_Date_CMHG 28 May 2016 +#define Module_Date_CMHG 03 Sep 2017 -#define Module_MajorVersion "5.92" -#define Module_Version 592 +#define Module_MajorVersion "5.93" +#define Module_Version 593 #define Module_MinorVersion "" -#define Module_Date "28 May 2016" +#define Module_Date "03 Sep 2017" -#define Module_ApplicationDate "28-May-16" +#define Module_ApplicationDate "03-Sep-17" #define Module_ComponentName "RISC_OSLib" #define Module_ComponentPath "castle/RiscOS/Sources/Lib/RISC_OSLib" -#define Module_FullVersion "5.92" -#define Module_HelpVersion "5.92 (28 May 2016)" -#define Module_LibraryVersionInfo "5:92" +#define Module_FullVersion "5.93" +#define Module_HelpVersion "5.93 (03 Sep 2017)" +#define Module_LibraryVersionInfo "5:93" diff --git a/kernel/s/k_body b/kernel/s/k_body index 7ddc7fc24ac88a33f3696f671b713cfd82cfc982..87303491a1f13f096a441b7da850b995277a6a2a 100644 --- a/kernel/s/k_body +++ b/kernel/s/k_body @@ -502,9 +502,13 @@ uwb_size # 0 BL CopyHandler [ StrongARM ;CopyHandler does some dynamic code - ;r0,lr are free to use here - MOV r0, #0 - SWI XOS_SynchroniseCodeAreas + MOV r0, #1 + ASSERT O_IIHandlerInData < O_PAHandlerInData + ASSERT O_PAHandlerInData < O_DAHandlerInData + ASSERT O_DAHandlerInData < O_AEHandlerInData + ADD r1, v6, #O_IIHandlerInData + ADD r2, v6, #O_AEHandlerInData + 16 + SWI XOS_SynchroniseCodeAreas ] MOV r0, #0 @@ -2325,6 +2329,9 @@ ErrorExitV6Stacked ADD r5, v6, #O_languageEnvSave STMIA r5, {sl, fp, ip} ; save ptr to moved stack ADD v6, v6, r14 ; now points to the to be copied data + ; Be careful with stack usage from here on out - anything we push now + ; might get lost or overwritten. Once s_Exit restores sp everything + ; will be OK again. ; The following loop copies the image up memory. It avoids overwriting ; itself by jumping to its copied copy as soon as it has copied itself, @@ -2347,7 +2354,7 @@ CopyUp CMP r14, #0 [ StrongARM ;in case we are jumping to code we have just copied here (ie not shared Clib)... CMP v2, #0 - MOVNE r0, #0 + MOVNE r0, #0 ; Inefficient, but this is only for static lib version (also danger here with the call to SetWimpSlot_Save_r4r5?) SWINE XOS_SynchroniseCodeAreas ] ADD r0, pc, v2 ; ... go to moved image @@ -2423,7 +2430,11 @@ s_Exit2 BL SetWimpSlot_Save_r4r5 ; set slot size back to value before CLI LDMFD sp!, {r4, r5} -01 SUB sp, sp, v5 ; and relocate sp... +01 + [ StrongARM + STR v2, [sp, #-4]! ; remember base for later + ] + SUB sp, sp, v5 ; and relocate sp... SUB v6, v6, v5 ; ...and the static data ptr ; The following loop copies the image down memory. It avoids overwriting @@ -2448,7 +2459,7 @@ CopyDn ;in case we are jumping to code we have just copied here (ie not shared Clib)... MOV r1, r0 CMP v1, #0 - MOVNE r0, #0 + MOVNE r0, #0 ; Inefficient, but this is only for static lib version SWINE XOS_SynchroniseCodeAreas MOV r0, r1 ] @@ -2462,8 +2473,11 @@ CopyDn CopyDnDone [ StrongARM ;you've guessed it - MOV r0, #0 - SWI XOS_SynchroniseCodeAreas + MOV r0, #1 + LDR r1, [sp], #4 + MOV r2, v2 + CMP r1, r2 + SWINE XOS_SynchroniseCodeAreas ] LDR r0, [sp], #4 ; old memoryLimit BL InstallHandlers diff --git a/s/initmodule b/s/initmodule index 4edaeb8d2ec6be0fbbb1cd0c4c98c3d2fccc7b13..01640d4ce3ef828bcff6df3136068730cd459a41 100644 --- a/s/initmodule +++ b/s/initmodule @@ -271,11 +271,24 @@ CheckEnoughStore MOVMI r4, r1 SUBPLS r6, r3, r4 BLE ZeroInitClientStatics + [ StrongARM + STR r1, [sp, #-4]! + ] CopyClientStatics LDR lr, [r4], #+4 STR lr, [r1], #+4 SUBS r6, r6, #4 BNE CopyClientStatics + [ StrongARM + ; Statics may contain code, synchronise it + STMFD sp!, {r0-r2} + MOV r0, #1 + MOV r2, r1 + LDR r1, [sp, #12] + SWI XOS_SynchroniseCodeAreas + LDMFD sp!, {r0-r2} + ADD sp, sp, #4 + ] ; Zero the client statics which need zeroing ZeroInitClientStatics @@ -408,6 +421,15 @@ FixEntries ] ChunkEntriesDone + [ StrongARM + ; patched branch code requires SynchroniseCodeAreas + STMFD sp!, {r0,r14} + LDMDB r0, {r1, r2} + MOV r0, #1 + SWI XOS_SynchroniseCodeAreas + LDMFD sp!, {r0,r14} + ] + ; Having patched up the branch table, lets copy the library's static data ; The space reserved in the image for static data for this chunk @@ -495,6 +517,10 @@ staticsizeok BNE Failed MOV r5, r1 + [ StrongARM + STMFD sp!, {r2,r14} + ] + ; Copy the data from our fixed static data area to the clients dynamic ; static data area. No zero initialised data at all. CopyLibStatics @@ -503,6 +529,15 @@ CopyLibStatics SUBS r3, r3, #4 BNE CopyLibStatics + [ StrongARM + ; There may have been code in the data area, synchronise it + LDR r1, [sp] + STR r0, [sp] + MOV r0, #1 + SWI XOS_SynchroniseCodeAreas + LDMFD sp!, {r0,r14} + ] + LDR r1, [r14, #LI_Id-LI_ItemSize] CMP r1, #1 ; was this the library kernel? BNE NextLibraryChunk @@ -516,12 +551,6 @@ EndStubInit LDR r12, [r13, #Proc_RegOffset + 4] ; r1 out STR r5, [r12, #SC_SLOffset+SL_Lib_Offset] - [ StrongARM - ; patched branch code requires SynchroniseCodeAreas - MOV r0,#0 ;fully synchronise (too lazy to narrow down address range) - SWI XOS_SynchroniseCodeAreas - ] - MOV r6, #LibraryVersionNumber Proc_RegList SETS "r0-r5, r12" ; don't restore r6 (hacky :)) EXITS