arch/sim: implement sim_getsp

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-07-09 03:18:10 +08:00 committed by Abdelatif Guettouche
parent 60b7b8b3f0
commit 4176a3828b
3 changed files with 11 additions and 2 deletions

View File

@ -52,6 +52,15 @@
* Inline functions * Inline functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: sim_getsp
****************************************************************************/
static inline uintptr_t sim_getsp(void)
{
return (uintptr_t)__builtin_frame_address(0);
}
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/

View File

@ -65,7 +65,7 @@
#ifdef CONFIG_TLS_ALIGNED #ifdef CONFIG_TLS_ALIGNED
static inline FAR struct tls_info_s *up_tls_info(void) static inline FAR struct tls_info_s *up_tls_info(void)
{ {
return TLS_INFO((uintptr_t)__builtin_frame_address(0)); return TLS_INFO(sim_getsp());
} }
#else #else
# define up_tls_info() tls_get_info() # define up_tls_info() tls_get_info()

View File

@ -123,7 +123,7 @@ void up_assert(const uint8_t *filename, int line)
/* Allow for any board/configuration specific crash information */ /* Allow for any board/configuration specific crash information */
#ifdef CONFIG_BOARD_CRASHDUMP #ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), this_task(), filename, line); board_crashdump(sim_getsp(), this_task(), filename, line);
#endif #endif
/* Exit the simulation */ /* Exit the simulation */