diff --git a/arch/sim/include/arch.h b/arch/sim/include/arch.h index 8ad48ccebb..4798968085 100644 --- a/arch/sim/include/arch.h +++ b/arch/sim/include/arch.h @@ -52,6 +52,15 @@ * Inline functions ****************************************************************************/ +/**************************************************************************** + * Name: sim_getsp + ****************************************************************************/ + +static inline uintptr_t sim_getsp(void) +{ + return (uintptr_t)__builtin_frame_address(0); +} + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/sim/include/tls.h b/arch/sim/include/tls.h index a6210691ff..2682579065 100644 --- a/arch/sim/include/tls.h +++ b/arch/sim/include/tls.h @@ -65,7 +65,7 @@ #ifdef CONFIG_TLS_ALIGNED 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 # define up_tls_info() tls_get_info() diff --git a/arch/sim/src/sim/up_head.c b/arch/sim/src/sim/up_head.c index 9fd93e70f1..000fef940b 100644 --- a/arch/sim/src/sim/up_head.c +++ b/arch/sim/src/sim/up_head.c @@ -123,7 +123,7 @@ void up_assert(const uint8_t *filename, int line) /* Allow for any board/configuration specific crash information */ #ifdef CONFIG_BOARD_CRASHDUMP - board_crashdump(up_getsp(), this_task(), filename, line); + board_crashdump(sim_getsp(), this_task(), filename, line); #endif /* Exit the simulation */