Commit d89ca652 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Eliminate some global OS_SynchroniseCodeAreas calls

Detail:
  kernel/s/k_body - Eliminate a couple of global OS_SynchroniseCodeAreas calls in _kernel_init and _kernel_system
  s/initmodule - Eliminate a global OS_SynchroniseCodeAreas call in _Shared_Lib_Module_SWI_Code
Admin:
  Tested on iMx6
  Improves performance with SMP ROMs, where global D-cache clean isn't really possible


Version 5.93. Tagged as 'RISC_OSLib-5_93'
parent e52669b7
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "5.92" Module_MajorVersion SETS "5.93"
Module_Version SETA 592 Module_Version SETA 593
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "28 May 2016" Module_Date SETS "03 Sep 2017"
Module_ApplicationDate SETS "28-May-16" Module_ApplicationDate SETS "03-Sep-17"
Module_ComponentName SETS "RISC_OSLib" Module_ComponentName SETS "RISC_OSLib"
Module_ComponentPath SETS "castle/RiscOS/Sources/Lib/RISC_OSLib" Module_ComponentPath SETS "castle/RiscOS/Sources/Lib/RISC_OSLib"
Module_FullVersion SETS "5.92" Module_FullVersion SETS "5.93"
Module_HelpVersion SETS "5.92 (28 May 2016)" Module_HelpVersion SETS "5.93 (03 Sep 2017)"
END END
/* (5.92) /* (5.93)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * 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_MinorVersion_CMHG
#define Module_Date_CMHG 28 May 2016 #define Module_Date_CMHG 03 Sep 2017
#define Module_MajorVersion "5.92" #define Module_MajorVersion "5.93"
#define Module_Version 592 #define Module_Version 593
#define Module_MinorVersion "" #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_ComponentName "RISC_OSLib"
#define Module_ComponentPath "castle/RiscOS/Sources/Lib/RISC_OSLib" #define Module_ComponentPath "castle/RiscOS/Sources/Lib/RISC_OSLib"
#define Module_FullVersion "5.92" #define Module_FullVersion "5.93"
#define Module_HelpVersion "5.92 (28 May 2016)" #define Module_HelpVersion "5.93 (03 Sep 2017)"
#define Module_LibraryVersionInfo "5:92" #define Module_LibraryVersionInfo "5:93"
...@@ -502,8 +502,12 @@ uwb_size # 0 ...@@ -502,8 +502,12 @@ uwb_size # 0
BL CopyHandler BL CopyHandler
[ StrongARM ;CopyHandler does some dynamic code [ StrongARM ;CopyHandler does some dynamic code
;r0,lr are free to use here MOV r0, #1
MOV r0, #0 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 SWI XOS_SynchroniseCodeAreas
] ]
...@@ -2325,6 +2329,9 @@ ErrorExitV6Stacked ...@@ -2325,6 +2329,9 @@ ErrorExitV6Stacked
ADD r5, v6, #O_languageEnvSave ADD r5, v6, #O_languageEnvSave
STMIA r5, {sl, fp, ip} ; save ptr to moved stack STMIA r5, {sl, fp, ip} ; save ptr to moved stack
ADD v6, v6, r14 ; now points to the to be copied data 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 ; 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, ; itself by jumping to its copied copy as soon as it has copied itself,
...@@ -2347,7 +2354,7 @@ CopyUp CMP r14, #0 ...@@ -2347,7 +2354,7 @@ CopyUp CMP r14, #0
[ StrongARM [ StrongARM
;in case we are jumping to code we have just copied here (ie not shared Clib)... ;in case we are jumping to code we have just copied here (ie not shared Clib)...
CMP v2, #0 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 SWINE XOS_SynchroniseCodeAreas
] ]
ADD r0, pc, v2 ; ... go to moved image ADD r0, pc, v2 ; ... go to moved image
...@@ -2423,7 +2430,11 @@ s_Exit2 ...@@ -2423,7 +2430,11 @@ s_Exit2
BL SetWimpSlot_Save_r4r5 ; set slot size back to value before CLI BL SetWimpSlot_Save_r4r5 ; set slot size back to value before CLI
LDMFD sp!, {r4, r5} 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 SUB v6, v6, v5 ; ...and the static data ptr
; The following loop copies the image down memory. It avoids overwriting ; The following loop copies the image down memory. It avoids overwriting
...@@ -2448,7 +2459,7 @@ CopyDn ...@@ -2448,7 +2459,7 @@ CopyDn
;in case we are jumping to code we have just copied here (ie not shared Clib)... ;in case we are jumping to code we have just copied here (ie not shared Clib)...
MOV r1, r0 MOV r1, r0
CMP v1, #0 CMP v1, #0
MOVNE r0, #0 MOVNE r0, #0 ; Inefficient, but this is only for static lib version
SWINE XOS_SynchroniseCodeAreas SWINE XOS_SynchroniseCodeAreas
MOV r0, r1 MOV r0, r1
] ]
...@@ -2462,8 +2473,11 @@ CopyDn ...@@ -2462,8 +2473,11 @@ CopyDn
CopyDnDone CopyDnDone
[ StrongARM [ StrongARM
;you've guessed it ;you've guessed it
MOV r0, #0 MOV r0, #1
SWI XOS_SynchroniseCodeAreas LDR r1, [sp], #4
MOV r2, v2
CMP r1, r2
SWINE XOS_SynchroniseCodeAreas
] ]
LDR r0, [sp], #4 ; old memoryLimit LDR r0, [sp], #4 ; old memoryLimit
BL InstallHandlers BL InstallHandlers
......
...@@ -271,11 +271,24 @@ CheckEnoughStore ...@@ -271,11 +271,24 @@ CheckEnoughStore
MOVMI r4, r1 MOVMI r4, r1
SUBPLS r6, r3, r4 SUBPLS r6, r3, r4
BLE ZeroInitClientStatics BLE ZeroInitClientStatics
[ StrongARM
STR r1, [sp, #-4]!
]
CopyClientStatics CopyClientStatics
LDR lr, [r4], #+4 LDR lr, [r4], #+4
STR lr, [r1], #+4 STR lr, [r1], #+4
SUBS r6, r6, #4 SUBS r6, r6, #4
BNE CopyClientStatics 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 ; Zero the client statics which need zeroing
ZeroInitClientStatics ZeroInitClientStatics
...@@ -408,6 +421,15 @@ FixEntries ...@@ -408,6 +421,15 @@ FixEntries
] ]
ChunkEntriesDone 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 ; 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 ; The space reserved in the image for static data for this chunk
...@@ -495,6 +517,10 @@ staticsizeok ...@@ -495,6 +517,10 @@ staticsizeok
BNE Failed BNE Failed
MOV r5, r1 MOV r5, r1
[ StrongARM
STMFD sp!, {r2,r14}
]
; Copy the data from our fixed static data area to the clients dynamic ; Copy the data from our fixed static data area to the clients dynamic
; static data area. No zero initialised data at all. ; static data area. No zero initialised data at all.
CopyLibStatics CopyLibStatics
...@@ -503,6 +529,15 @@ CopyLibStatics ...@@ -503,6 +529,15 @@ CopyLibStatics
SUBS r3, r3, #4 SUBS r3, r3, #4
BNE CopyLibStatics 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] LDR r1, [r14, #LI_Id-LI_ItemSize]
CMP r1, #1 ; was this the library kernel? CMP r1, #1 ; was this the library kernel?
BNE NextLibraryChunk BNE NextLibraryChunk
...@@ -516,12 +551,6 @@ EndStubInit ...@@ -516,12 +551,6 @@ EndStubInit
LDR r12, [r13, #Proc_RegOffset + 4] ; r1 out LDR r12, [r13, #Proc_RegOffset + 4] ; r1 out
STR r5, [r12, #SC_SLOffset+SL_Lib_Offset] 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 MOV r6, #LibraryVersionNumber
Proc_RegList SETS "r0-r5, r12" ; don't restore r6 (hacky :)) Proc_RegList SETS "r0-r5, r12" ; don't restore r6 (hacky :))
EXITS EXITS
......
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