arm/arch: using __builtin_frame_address(0) implement up_getsp().
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
6af167c086
commit
91d02f5db8
@ -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
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user