This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4176a3828bacfb743dd6660cd08cb80c32041467
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Thu Jul 9 03:18:10 2020 +0800

    arch/sim: implement sim_getsp
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 arch/sim/include/arch.h    | 9 +++++++++
 arch/sim/include/tls.h     | 2 +-
 arch/sim/src/sim/up_head.c | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/sim/include/arch.h b/arch/sim/include/arch.h
index 8ad48cce..4798968 100644
--- a/arch/sim/include/arch.h
+++ b/arch/sim/include/arch.h
@@ -53,6 +53,15 @@
  ****************************************************************************/
 
 /****************************************************************************
+ * 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 a621069..2682579 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 9fd93e7..000fef9 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 */

Reply via email to