-
Jeffrey Lee authored
For pre-ARMv6K, we generally have two sets of atomic routines available: * Fast routines which use a SWP spinlock, but are unsafe for use from interrupt handlers and the like * Safe routines which disable IRQs, but (in usermode) are much slower due to requiring SWI calls to enable/disable IRQs. Currently CLib decides which set of routines to use: modules get the slow & safe ones, while applications get the fast & unsafe ones. This change gives control of that choice to the program, by introducing the _kernel_init_flags variable. The stub code will (weakly) import this symbol and pass the value to CLib when calling the init SWI. CLib will then use the value to decide whether to fill the stubs with the safe or unsafe versions of the routines. With this change, the default is now to use the slow & safe routines, for both modules and applications. This is to ensure that code which is written/tested for ARMv6K+ machines won't run into unexpected issues when run on older machines (since the ARMv6K+ routines are safe for use from all execution contexts). The init flags are used to opt-in to the unsafe routines. Clients which are directly linked with CLib (ROM code, ANSILib) should be unaffected by this change, and will continue to use the safe routines, as before. Version 6.14. Tagged as 'RISC_OSLib-6_14'
afa04ff1