Commit 8a699bda authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Prefer CPS over MSR when performing PSR manipulation

Detail:
  s/irqs - ensure_irqs_off / ensure_irqs_on now use CPS when building for ARMv6+, as it has better performance than MSR
Admin:
  Tested on Cortex-A15


Version 0.18. Tagged as 'AsmUtils-0_18'
parent 7347eaed
/* (0.17)
/* (0.18)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.17
#define Module_MajorVersion_CMHG 0.18
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 Sep 2014
#define Module_Date_CMHG 08 May 2016
#define Module_MajorVersion "0.17"
#define Module_Version 17
#define Module_MajorVersion "0.18"
#define Module_Version 18
#define Module_MinorVersion ""
#define Module_Date "19 Sep 2014"
#define Module_Date "08 May 2016"
#define Module_ApplicationDate "19-Sep-14"
#define Module_ApplicationDate "08-May-16"
#define Module_ComponentName "AsmUtils"
#define Module_ComponentPath "castle/RiscOS/Sources/Lib/AsmUtils"
#define Module_FullVersion "0.17"
#define Module_HelpVersion "0.17 (19 Sep 2014)"
#define Module_LibraryVersionInfo "0:17"
#define Module_FullVersion "0.18"
#define Module_HelpVersion "0.18 (08 May 2016)"
#define Module_LibraryVersionInfo "0:18"
......@@ -27,6 +27,7 @@
GET Hdr:Macros
GET Hdr:System
GET Hdr:APCS.<APCS>
GET Hdr:CPU.Arch
EXPORT irqs_off
EXPORT irqs_on
......@@ -43,6 +44,7 @@
; suitable for passing to restore_irqs/irqs_on.
ensure_irqs_off
irqs_off
[ NoARMv6
[ :LNOT: (No32bitCode :LOR: No26bitCode)
; 32 or 26 bit selected at run time
; The 26 bit case preserves flags, so works with APCS-R (and APCS-32)
......@@ -63,6 +65,15 @@ cond SETS "AL"
AND r0, r0, #I32_bit ; return previous state of bit
Return ,LinkNotStacked
]
|
; Skipping the CPS is faster if we know IRQs are already off, although
; it does put us at the mercy of branch prediction.
MRS r0, CPSR
ANDS r0, r0, #I32_bit
Return ,LinkNotStacked,NE
CPSID i
Return ,LinkNotStacked
]
; restore_irqs/irqs_on: Re-enable IRQs if they were enabled prior to
; the earlier call to ensure_irqs_off/ensure_irqs_on/irqs_off
......@@ -92,6 +103,7 @@ cond SETS "AL"
; ensure_irqs_on: Enable IRQs, returning a value
; suitable for passing to restore_irqs/irqs_on
ensure_irqs_on
[ NoARMv6
[ :LNOT: (No32bitCode :LOR: No26bitCode)
; 32 or 26 bit selected at run time
; The 26 bit case preserves flags, so works with APCS-R (and APCS-32)
......@@ -112,5 +124,14 @@ cond SETS "AL"
AND r0, r0, #I32_bit ; return previous state of bit
Return ,LinkNotStacked
]
|
; Skipping the CPS is faster if we know IRQs are already on, although
; it does put us at the mercy of branch prediction.
MRS r0, CPSR
ANDS r0, r0, #I32_bit
Return ,LinkNotStacked,EQ
CPSIE i
Return ,LinkNotStacked
]
END
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