From cecdc99f38bcd7a737bcaf70b911d8d1cf513999 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 25 Jan 2017 08:32:54 -0600 Subject: [PATCH] arm: cmsis: Convert _ScbIsNestedExc to use direct CMSIS register access Jira: ZEP-1568 Change-Id: I3d41fe88293bab2f40d9177cedb56e9265250dff Signed-off-by: Kumar Gala --- arch/arm/core/fault_s.S | 2 +- arch/arm/include/cortex_m/exc.h | 3 ++- include/arch/arm/cortex_m/scb.h | 15 --------------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/arch/arm/core/fault_s.S b/arch/arm/core/fault_s.S index 9109a792b71..8a7d47b560c 100644 --- a/arch/arm/core/fault_s.S +++ b/arch/arm/core/fault_s.S @@ -88,7 +88,7 @@ _stack_frame_endif: eors.n r0, r0 msr BASEPRI, r0 - /* this reimplements _ScbIsNestedExc() */ + /* this checks to see if we are in a nested exception */ ldr ip, =_SCS_ICSR ldr ip, [ip] ands.w ip, #_SCS_ICSR_RETTOBASE diff --git a/arch/arm/include/cortex_m/exc.h b/arch/arm/include/cortex_m/exc.h index dff2f845e10..a6b3f9f391d 100644 --- a/arch/arm/include/cortex_m/exc.h +++ b/arch/arm/include/cortex_m/exc.h @@ -53,7 +53,8 @@ static ALWAYS_INLINE int _IsInIsr(void) #if defined(CONFIG_ARMV6_M) return (vector > 10) || (vector == 3); #elif defined(CONFIG_ARMV7_M) - return (vector > 10) || (vector && _ScbIsNestedExc()); + return (vector > 10) || + (vector && !(SCB->ICSR & SCB_ICSR_RETTOBASE_Msk)); #else #error Unknown ARM architecture #endif /* CONFIG_ARMV6_M */ diff --git a/include/arch/arm/cortex_m/scb.h b/include/arch/arm/cortex_m/scb.h index d2bbdf224e5..fecb5679b22 100644 --- a/include/arch/arm/cortex_m/scb.h +++ b/include/arch/arm/cortex_m/scb.h @@ -61,21 +61,6 @@ static inline uint32_t _ScbActiveVectorGet(void) #if defined(CONFIG_ARMV6_M) #elif defined(CONFIG_ARMV7_M) -/** - * - * @brief Find out if the currently executing exception is nested - * - * This routine determines if the currently executing exception is nested. - * - * @return 1 if nested, 0 otherwise - */ - -static inline int _ScbIsNestedExc(void) -{ - /* !bit == preempted exceptions */ - return !__scs.scb.icsr.bit.rettobase; -} - /** * * @brief Enable faulting on division by zero