This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 91d02f5db8 arm/arch: using __builtin_frame_address(0) implement
up_getsp().
91d02f5db8 is described below
commit 91d02f5db8962827d7020f5fd73e21f01289443f
Author: wangbowen6 <[email protected]>
AuthorDate: Fri Apr 15 17:35:00 2022 +0800
arm/arch: using __builtin_frame_address(0) implement up_getsp().
Signed-off-by: wangbowen6 <[email protected]>
---
arch/arm/include/arch.h | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/arch/arm/include/arch.h b/arch/arm/include/arch.h
index 42607cb5c3..0cf52ce5c2 100644
--- a/arch/arm/include/arch.h
+++ b/arch/arm/include/arch.h
@@ -40,6 +40,8 @@
* Pre-processor Prototypes
****************************************************************************/
+#define up_getsp() (uintptr_t)__builtin_frame_address(0)
+
#ifdef CONFIG_PIC
/* This identifies the register the is used by the processor as the PIC base
@@ -108,24 +110,6 @@ do { \
* Inline functions
****************************************************************************/
-/****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint32_t up_getsp(void)
-{
- uint32_t sp;
- __asm__
- (
- "\tmov %0, sp\n\t"
- : "=r"(sp)
- );
-
- return sp;
-}
-
/****************************************************************************
* Public Types
****************************************************************************/