You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/07/09 12:51:16 UTC

[incubator-nuttx] branch master updated (5da9cb3 -> 924ba84)

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

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


    from 5da9cb3  libxx: Eanble HAVE_CXXINITIALIZE automatically if LIBCXX or UCLIBCXX enable
     new 05f6445  arch: Move *_getsp to the common place arch/arch.h
     new db02cea  arch/x86_64: Change up_getrsp to x64_getsp
     new 60b7b8b  arch/x86: change up_getsp to x86_getsp
     new 4176a38  arch/sim: implement sim_getsp
     new 924ba84  arch: call *_getsp in up_assert and board_crashdump

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/include/arch.h                    | 22 +++++++++++--
 arch/arm/include/tls.h                     | 18 -----------
 arch/arm/src/arm/arm_assert.c              | 21 ++-----------
 arch/arm/src/armv6-m/arm_assert.c          | 21 ++-----------
 arch/arm/src/armv7-a/arm_assert.c          | 21 ++-----------
 arch/arm/src/armv7-m/arm_assert.c          | 21 ++-----------
 arch/arm/src/armv7-r/arm_assert.c          | 21 ++-----------
 arch/arm/src/armv8-m/arm_assert.c          | 21 ++-----------
 arch/hc/include/arch.h                     | 15 +++++++++
 arch/hc/include/hcs12/irq.h                | 24 +++++---------
 arch/hc/include/tls.h                      | 15 ---------
 arch/hc/src/m9s12/m9s12_assert.c           |  4 +--
 arch/mips/include/arch.h                   | 15 +++++++++
 arch/mips/include/tls.h                    | 15 ---------
 arch/mips/src/mips32/mips_assert.c         |  2 +-
 arch/mips/src/mips32/mips_dumpstate.c      | 19 +-----------
 arch/misoc/include/arch.h                  | 50 ++++++++++++++++++++++++++++++
 arch/misoc/include/tls.h                   | 13 --------
 arch/misoc/src/lm32/lm32_assert.c          |  2 +-
 arch/misoc/src/lm32/lm32_dumpstate.c       | 27 ++++++----------
 arch/misoc/src/minerva/minerva_assert.c    |  2 +-
 arch/misoc/src/minerva/minerva_dumpstate.c | 27 ++++++----------
 arch/or1k/include/arch.h                   | 21 +++++++++++--
 arch/or1k/include/tls.h                    | 17 ----------
 arch/or1k/src/common/up_assert.c           | 27 ++--------------
 arch/sim/include/arch.h                    |  9 ++++++
 arch/sim/include/tls.h                     |  2 +-
 arch/sim/src/sim/up_head.c                 |  2 +-
 arch/x86/include/i486/arch.h               | 19 ++++++------
 arch/x86/include/tls.h                     |  2 +-
 arch/x86/src/common/up_assert.c            |  4 +--
 arch/x86_64/include/intel64/arch.h         |  2 +-
 arch/x86_64/include/tls.h                  |  2 +-
 arch/x86_64/src/common/up_assert.c         |  4 +--
 arch/xtensa/include/arch.h                 | 17 ++++++++++
 arch/xtensa/include/tls.h                  | 17 ----------
 arch/xtensa/src/common/xtensa_assert.c     |  2 +-
 arch/xtensa/src/common/xtensa_dumpstate.c  | 19 ------------
 38 files changed, 210 insertions(+), 352 deletions(-)


[incubator-nuttx] 02/05: arch/x86_64: Change up_getrsp to x64_getsp

Posted by ag...@apache.org.
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 db02cea58c1e58ca1b7a877d7db61f35a4fb33ea
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jul 9 03:08:51 2020 +0800

    arch/x86_64: Change up_getrsp to x64_getsp
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/x86_64/include/intel64/arch.h | 2 +-
 arch/x86_64/include/tls.h          | 2 +-
 arch/x86_64/src/common/up_assert.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86_64/include/intel64/arch.h b/arch/x86_64/include/intel64/arch.h
index 0a23f54..2e4624e 100644
--- a/arch/x86_64/include/intel64/arch.h
+++ b/arch/x86_64/include/intel64/arch.h
@@ -458,7 +458,7 @@ static inline void write_gsbase(unsigned long val)
 
 /* Return stack pointer */
 
-static inline uint64_t up_getrsp()
+static inline uint64_t x64_getsp()
 {
   uint64_t regval;
 
diff --git a/arch/x86_64/include/tls.h b/arch/x86_64/include/tls.h
index 51856b9..8bbfc66 100644
--- a/arch/x86_64/include/tls.h
+++ b/arch/x86_64/include/tls.h
@@ -66,7 +66,7 @@
 static inline FAR struct tls_info_s *up_tls_info(void)
 {
   DEBUGASSERT(!up_interrupt_context());
-  return TLS_INFO((uintptr_t)up_getrsp());
+  return TLS_INFO((uintptr_t)x64_getsp());
 }
 #else
 #  define up_tls_info() tls_get_info()
diff --git a/arch/x86_64/src/common/up_assert.c b/arch/x86_64/src/common/up_assert.c
index ae9f15f..50737f8 100644
--- a/arch/x86_64/src/common/up_assert.c
+++ b/arch/x86_64/src/common/up_assert.c
@@ -109,7 +109,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = this_task();
-  uint64_t sp = up_getrsp();
+  uint64_t sp = x64_getsp();
   uint64_t ustackbase;
   uint64_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -259,7 +259,7 @@ void up_assert(const uint8_t *filename, int lineno)
   up_dumpstate();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getrsp(), this_task(), filename, lineno);
+  board_crashdump(x64_getsp(), this_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);


[incubator-nuttx] 01/05: arch: Move *_getsp to the common place arch/arch.h

Posted by ag...@apache.org.
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 05f6445493e6bb76eb97490914e79d1f0139abb5
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jul 9 02:39:29 2020 +0800

    arch: Move *_getsp to the common place arch/arch.h
    
    so other place can get the stack pointer easily
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/arm/include/arch.h                   | 22 ++++++++++++--
 arch/arm/include/tls.h                    | 18 -----------
 arch/hc/include/arch.h                    | 15 ++++++++++
 arch/hc/include/hcs12/irq.h               | 24 +++++----------
 arch/hc/include/tls.h                     | 15 ----------
 arch/mips/include/arch.h                  | 15 ++++++++++
 arch/mips/include/tls.h                   | 15 ----------
 arch/misoc/include/arch.h                 | 50 +++++++++++++++++++++++++++++++
 arch/misoc/include/tls.h                  | 13 --------
 arch/or1k/include/arch.h                  | 21 +++++++++++--
 arch/or1k/include/tls.h                   | 17 -----------
 arch/xtensa/include/arch.h                | 17 +++++++++++
 arch/xtensa/include/tls.h                 | 17 -----------
 arch/xtensa/src/common/xtensa_dumpstate.c | 19 ------------
 14 files changed, 143 insertions(+), 135 deletions(-)

diff --git a/arch/arm/include/arch.h b/arch/arm/include/arch.h
index 88828b0..6f55a37 100644
--- a/arch/arm/include/arch.h
+++ b/arch/arm/include/arch.h
@@ -124,6 +124,24 @@ do { \
  ****************************************************************************/
 
 /****************************************************************************
+ * Name: arm_getsp
+ ****************************************************************************/
+
+/* I don't know if the builtin to get SP is enabled */
+
+static inline uint32_t arm_getsp(void)
+{
+  uint32_t sp;
+  __asm__
+  (
+    "\tmov %0, sp\n\t"
+    : "=r"(sp)
+  );
+
+  return sp;
+}
+
+/****************************************************************************
  * Public Types
  ****************************************************************************/
 
@@ -134,8 +152,8 @@ do { \
  * nuttx/arch/<architecture>/include/arch.h.
  *
  * These tables would hold the physical address of the level 2 page tables.
- * All would be initially NULL and would not be backed up with physical memory
- * until mappings in the level 2 page table are required.
+ * All would be initially NULL and would not be backed up with physical
+ * memory until mappings in the level 2 page table are required.
  */
 
 struct group_addrenv_s
diff --git a/arch/arm/include/tls.h b/arch/arm/include/tls.h
index c6d86fd..fec56ad 100644
--- a/arch/arm/include/tls.h
+++ b/arch/arm/include/tls.h
@@ -35,24 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: arm_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint32_t arm_getsp(void)
-{
-  uint32_t sp;
-  __asm__
-  (
-    "\tmov %0, sp\n\t"
-    : "=r"(sp)
-  );
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/hc/include/arch.h b/arch/hc/include/arch.h
index cfef5de..ff28e1f 100644
--- a/arch/hc/include/arch.h
+++ b/arch/hc/include/arch.h
@@ -55,6 +55,21 @@
  ****************************************************************************/
 
 /****************************************************************************
+ * Name: hc_getsp
+ ****************************************************************************/
+
+static inline uint16_t hc_getsp(void)
+{
+  uint16_t ret;
+  __asm__
+  (
+    "\tsts %0\n"
+  : "=m"(ret) :
+  );
+  return ret;
+}
+
+/****************************************************************************
  * Public Types
  ****************************************************************************/
 
diff --git a/arch/hc/include/hcs12/irq.h b/arch/hc/include/hcs12/irq.h
index a3d1ba2..4989180 100644
--- a/arch/hc/include/hcs12/irq.h
+++ b/arch/hc/include/hcs12/irq.h
@@ -50,6 +50,7 @@
 /************************************************************************************
  * Pre-processor Definitions
  ************************************************************************************/
+
 /* CCR bit definitions */
 
 #define HCS12_CCR_C (1 << 0) /* Bit 0: Carry/Borrow status bit */
@@ -62,7 +63,7 @@
 #define HCS12_CCR_S (1 << 7) /* Bit 7: STOP instruction control bit */
 
 /************************************************************************************
- *	Register state save strucure
+ * Register state save strucure
  *   Low Address        <-- SP after state save
  *                [PPAGE]
  *                [soft regisers]
@@ -88,6 +89,7 @@
  ************************************************************************************/
 
 /* Byte offsets */
+
 /* PPAGE register (only in banked mode) */
 
 #ifndef CONFIG_HCS12_NONBANKED
@@ -174,9 +176,9 @@ struct xcptcontext
   uint8_t regs[XCPTCONTEXT_REGS];
 };
 
-/****************************************************************************
+/************************************************************************************
  * Inline functions
- ****************************************************************************/
+ ************************************************************************************/
 
 /* Name: up_irq_save, up_irq_restore, and friends.
  *
@@ -194,19 +196,6 @@ struct xcptcontext
 #define xenable()  __asm("andcc #0xbf")
 #define xdisable() __asm("orcc #0x40")
 
-/* Get the current value of the stack pointer */
-
-static inline uint16_t up_getsp(void)
-{
-  uint16_t ret;
-  __asm__
-  (
-    "\tsts %0\n"
-	: "=m"(ret) :
-  );
-  return ret;
-}
-
 /* Get the current value of the CCR */
 
 static inline irqstate_t up_getccr(void)
@@ -256,6 +245,7 @@ static inline void system_call3(unsigned int nbr, uintptr_t parm1,
                                 uintptr_t parm2, uintptr_t parm3)
 {
   /* To be provided */
+
   /* __asm("swi") */
 }
 
@@ -272,7 +262,7 @@ extern "C"
 #endif
 
 /************************************************************************************
- * Public Functions
+ * Public Functions Prototypes
  ************************************************************************************/
 
 #undef EXTERN
diff --git a/arch/hc/include/tls.h b/arch/hc/include/tls.h
index a390f0b..f258c6c 100644
--- a/arch/hc/include/tls.h
+++ b/arch/hc/include/tls.h
@@ -35,21 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: hc_getsp
- ****************************************************************************/
-
-static inline uint16_t hc_getsp(void)
-{
-  uint16_t ret;
-  __asm__
-  (
-    "\tsts %0\n"
-  : "=m"(ret) :
-  );
-  return ret;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/mips/include/arch.h b/arch/mips/include/arch.h
index 40ffc02..d730e11 100644
--- a/arch/mips/include/arch.h
+++ b/arch/mips/include/arch.h
@@ -55,6 +55,21 @@
  ****************************************************************************/
 
 /****************************************************************************
+ * Name: mips_getsp
+ ****************************************************************************/
+
+static inline uint32_t mips_getsp(void)
+{
+  register uint32_t sp;
+  __asm__
+  (
+    "\tadd  %0, $0, $29\n"
+    : "=r"(sp)
+  );
+  return sp;
+}
+
+/****************************************************************************
  * Public Types
  ****************************************************************************/
 
diff --git a/arch/mips/include/tls.h b/arch/mips/include/tls.h
index d29c0a0..2510cfa 100644
--- a/arch/mips/include/tls.h
+++ b/arch/mips/include/tls.h
@@ -35,21 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: mips_getsp
- ****************************************************************************/
-
-static inline uint32_t mips_getsp(void)
-{
-  register uint32_t sp;
-  __asm__
-  (
-    "\tadd  %0, $0, $29\n"
-    : "=r"(sp)
-  );
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/misoc/include/arch.h b/arch/misoc/include/arch.h
index 8b13789..f054c46 100644
--- a/arch/misoc/include/arch.h
+++ b/arch/misoc/include/arch.h
@@ -1 +1,51 @@
+/****************************************************************************
+ * arch/misoc/include/arch.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
 
+/* This file should never be included directly but, rather,
+ * only indirectly through nuttx/arch.h
+ */
+
+#ifndef __ARCH_MISOC_INCLUDE_ARCH_H
+#define __ARCH_MISOC_INCLUDE_ARCH_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: misoc_getsp
+ ****************************************************************************/
+
+static inline uint32_t misoc_getsp(void)
+{
+  register uint32_t sp;
+
+  __asm__ __volatile__("addi %0, sp, 0" : "=r" (sp));
+
+  return sp;
+}
+
+#endif /* __ARCH_MISOC_INCLUDE_ARCH_H */
diff --git a/arch/misoc/include/tls.h b/arch/misoc/include/tls.h
index 3fc95a1..f751e66 100644
--- a/arch/misoc/include/tls.h
+++ b/arch/misoc/include/tls.h
@@ -35,19 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: misoc_getsp
- ****************************************************************************/
-
-static inline uint32_t misoc_getsp(void)
-{
-  register uint32_t sp;
-
-  __asm__ __volatile__("addi %0, sp, 0" : "=r" (sp));
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/or1k/include/arch.h b/arch/or1k/include/arch.h
index 15d92c1..47d0b68 100644
--- a/arch/or1k/include/arch.h
+++ b/arch/or1k/include/arch.h
@@ -88,6 +88,23 @@
  ****************************************************************************/
 
 /****************************************************************************
+ * Name: or1k_getsp
+ ****************************************************************************/
+
+static inline uint32_t or1k_getsp(void)
+{
+  uint32_t sp;
+
+  __asm__
+  (
+    "\tmov %0, sp\n\t"
+    : "=r"(sp)
+  );
+
+  return sp;
+}
+
+/****************************************************************************
  * Public Types
  ****************************************************************************/
 
@@ -98,8 +115,8 @@
  * nuttx/arch/<architecture>/include/arch.h.
  *
  * These tables would hold the physical address of the level 2 page tables.
- * All would be initially NULL and would not be backed up with physical memory
- * until mappings in the level 2 page table are required.
+ * All would be initially NULL and would not be backed up with physical
+ * memory until mappings in the level 2 page table are required.
  */
 
 struct group_addrenv_s
diff --git a/arch/or1k/include/tls.h b/arch/or1k/include/tls.h
index 85759e2..92d8bbd 100644
--- a/arch/or1k/include/tls.h
+++ b/arch/or1k/include/tls.h
@@ -35,23 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: or1k_getsp
- ****************************************************************************/
-
-static inline uint32_t or1k_getsp(void)
-{
-  uint32_t sp;
-
-  __asm__
-  (
-    "\tmov %0, sp\n\t"
-    : "=r"(sp)
-  );
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/xtensa/include/arch.h b/arch/xtensa/include/arch.h
index b986c7f..cc073a1 100644
--- a/arch/xtensa/include/arch.h
+++ b/arch/xtensa/include/arch.h
@@ -55,6 +55,23 @@
  ****************************************************************************/
 
 /****************************************************************************
+ * Name: xtensa_getsp
+ ****************************************************************************/
+
+static inline uint32_t xtensa_getsp(void)
+{
+  register uint32_t sp;
+
+  __asm__ __volatile__
+  (
+    "mov %0, sp\n"
+    : "=r" (sp)
+  );
+
+  return sp;
+}
+
+/****************************************************************************
  * Public Types
  ****************************************************************************/
 
diff --git a/arch/xtensa/include/tls.h b/arch/xtensa/include/tls.h
index e351cf8..a7968fb 100644
--- a/arch/xtensa/include/tls.h
+++ b/arch/xtensa/include/tls.h
@@ -35,23 +35,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: xtensa_getsp
- ****************************************************************************/
-
-static inline uint32_t xtensa_getsp(void)
-{
-  register uint32_t sp;
-
-  __asm__ __volatile__
-  (
-    "mov %0, sp\n"
-    : "=r" (sp)
-  );
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_tls_info
  *
  * Description:
diff --git a/arch/xtensa/src/common/xtensa_dumpstate.c b/arch/xtensa/src/common/xtensa_dumpstate.c
index 42274f7..6f5beac 100644
--- a/arch/xtensa/src/common/xtensa_dumpstate.c
+++ b/arch/xtensa/src/common/xtensa_dumpstate.c
@@ -66,25 +66,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * Name: xtensa_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint32_t xtensa_getsp(void)
-{
-  register uint32_t sp;
-
-  __asm__ __volatile__
-  (
-    "mov %0, sp\n"
-    : "=r" (sp)
-  );
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_taskdump
  ****************************************************************************/
 


[incubator-nuttx] 05/05: arch: call *_getsp in up_assert and board_crashdump

Posted by ag...@apache.org.
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 924ba8473770eae5e2edb9631724fc80397ce49e
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jul 9 03:05:56 2020 +0800

    arch: call *_getsp in up_assert and board_crashdump
    
    and remove the static up_getsp
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/arm/src/arm/arm_assert.c              | 21 ++-------------------
 arch/arm/src/armv6-m/arm_assert.c          | 21 ++-------------------
 arch/arm/src/armv7-a/arm_assert.c          | 21 ++-------------------
 arch/arm/src/armv7-m/arm_assert.c          | 21 ++-------------------
 arch/arm/src/armv7-r/arm_assert.c          | 21 ++-------------------
 arch/arm/src/armv8-m/arm_assert.c          | 21 ++-------------------
 arch/hc/src/m9s12/m9s12_assert.c           |  4 ++--
 arch/mips/src/mips32/mips_assert.c         |  2 +-
 arch/mips/src/mips32/mips_dumpstate.c      | 19 +------------------
 arch/misoc/src/lm32/lm32_assert.c          |  2 +-
 arch/misoc/src/lm32/lm32_dumpstate.c       | 27 +++++++++------------------
 arch/misoc/src/minerva/minerva_assert.c    |  2 +-
 arch/misoc/src/minerva/minerva_dumpstate.c | 27 +++++++++------------------
 arch/or1k/src/common/up_assert.c           | 27 ++-------------------------
 arch/xtensa/src/common/xtensa_assert.c     |  2 +-
 15 files changed, 39 insertions(+), 199 deletions(-)

diff --git a/arch/arm/src/arm/arm_assert.c b/arch/arm/src/arm/arm_assert.c
index fdd9b3e..f34f47c 100644
--- a/arch/arm/src/arm/arm_assert.c
+++ b/arch/arm/src/arm/arm_assert.c
@@ -85,23 +85,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -190,7 +173,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp   = up_getsp();
+  uint32_t sp   = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -369,7 +352,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/arm/src/armv6-m/arm_assert.c b/arch/arm/src/armv6-m/arm_assert.c
index 4ba020c..c8bd7d3 100644
--- a/arch/arm/src/armv6-m/arm_assert.c
+++ b/arch/arm/src/armv6-m/arm_assert.c
@@ -83,23 +83,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -227,7 +210,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -426,7 +409,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/arm/src/armv7-a/arm_assert.c b/arch/arm/src/armv7-a/arm_assert.c
index 4d55d4e..b4cb872 100644
--- a/arch/arm/src/armv7-a/arm_assert.c
+++ b/arch/arm/src/armv7-a/arm_assert.c
@@ -71,23 +71,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -212,7 +195,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp   = up_getsp();
+  uint32_t sp   = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
@@ -460,7 +443,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/arm/src/armv7-m/arm_assert.c b/arch/arm/src/armv7-m/arm_assert.c
index 3383d8b..41b69c2 100644
--- a/arch/arm/src/armv7-m/arm_assert.c
+++ b/arch/arm/src/armv7-m/arm_assert.c
@@ -71,23 +71,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -220,7 +203,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
@@ -449,7 +432,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/arm/src/armv7-r/arm_assert.c b/arch/arm/src/armv7-r/arm_assert.c
index 165e867..f4791b8 100644
--- a/arch/arm/src/armv7-r/arm_assert.c
+++ b/arch/arm/src/armv7-r/arm_assert.c
@@ -68,23 +68,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -209,7 +192,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp   = up_getsp();
+  uint32_t sp   = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -419,7 +402,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/arm/src/armv8-m/arm_assert.c b/arch/arm/src/armv8-m/arm_assert.c
index b9dced4..6e9b633 100644
--- a/arch/arm/src/armv8-m/arm_assert.c
+++ b/arch/arm/src/armv8-m/arm_assert.c
@@ -71,23 +71,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * 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;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -220,7 +203,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = arm_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
@@ -449,7 +432,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(arm_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/hc/src/m9s12/m9s12_assert.c b/arch/hc/src/m9s12/m9s12_assert.c
index 4bad193..390c1e0 100644
--- a/arch/hc/src/m9s12/m9s12_assert.c
+++ b/arch/hc/src/m9s12/m9s12_assert.c
@@ -185,7 +185,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint16_t sp = up_getsp();
+  uint16_t sp = hc_getsp();
   uint16_t ustackbase;
   uint16_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -354,7 +354,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(hc_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/mips/src/mips32/mips_assert.c b/arch/mips/src/mips32/mips_assert.c
index 5e3f2e7..754eb10 100644
--- a/arch/mips/src/mips32/mips_assert.c
+++ b/arch/mips/src/mips32/mips_assert.c
@@ -177,7 +177,7 @@ void up_assert(const uint8_t *filename, int lineno)
 #endif
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(mips_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/mips/src/mips32/mips_dumpstate.c b/arch/mips/src/mips32/mips_dumpstate.c
index d6e249f..58c3da6 100644
--- a/arch/mips/src/mips32/mips_dumpstate.c
+++ b/arch/mips/src/mips32/mips_dumpstate.c
@@ -59,23 +59,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint32_t up_getsp(void)
-{
-  register uint32_t sp;
-  __asm__
-  (
-    "\tadd  %0, $0, $29\n"
-    : "=r"(sp)
-  );
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -147,7 +130,7 @@ static inline void up_registerdump(void)
 void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = mips_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
diff --git a/arch/misoc/src/lm32/lm32_assert.c b/arch/misoc/src/lm32/lm32_assert.c
index 2f56aa7..36d0b07 100644
--- a/arch/misoc/src/lm32/lm32_assert.c
+++ b/arch/misoc/src/lm32/lm32_assert.c
@@ -182,7 +182,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(misoc_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/misoc/src/lm32/lm32_dumpstate.c b/arch/misoc/src/lm32/lm32_dumpstate.c
index a88a301..f6ff679 100644
--- a/arch/misoc/src/lm32/lm32_dumpstate.c
+++ b/arch/misoc/src/lm32/lm32_dumpstate.c
@@ -59,19 +59,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-static inline uint32_t up_getsp(void)
-{
-  register uint32_t sp;
-
-  __asm__ __volatile__("addi %0, sp, 0" : "=r" (sp));
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -100,22 +87,26 @@ static inline void up_registerdump(void)
     {
       _alert("EPC:%08x \n",
             g_current_regs[REG_EPC]);
-      _alert(" X0:%08x  A0:%08x  A1:%08x  A2:%08x  A3:%08x  A4:%08x  A5:%08x  A6:%08x\n",
+      _alert(" X0:%08x  A0:%08x  A1:%08x  A2:%08x "
+             " A3:%08x  A4:%08x  A5:%08x  A6:%08x\n",
             g_current_regs[REG_X0_NDX], g_current_regs[REG_X1_NDX],
             g_current_regs[REG_X2_NDX], g_current_regs[REG_X3_NDX],
             g_current_regs[REG_X4_NDX], g_current_regs[REG_X5_NDX],
             g_current_regs[REG_X6_NDX], g_current_regs[REG_X7_NDX]);
-      _alert(" A7:%08x  X9:%08x X10:%08x X11:%08x X12:%08x X13:%08x X14:%08x X15:%08x\n",
+      _alert(" A7:%08x  X9:%08x X10:%08x X11:%08x "
+             "X12:%08x X13:%08x X14:%08x X15:%08x\n",
             g_current_regs[REG_X8_NDX], g_current_regs[REG_X9_NDX],
             g_current_regs[REG_X10_NDX], g_current_regs[REG_X11_NDX],
             g_current_regs[REG_X12_NDX], g_current_regs[REG_X13_NDX],
             g_current_regs[REG_X14_NDX], g_current_regs[REG_X15_NDX]);
-      _alert("X16:%08x X17:%08x X18:%08x X19:%08x X20:%08x X21:%08x X22:%08x X23:%08x\n",
+      _alert("X16:%08x X17:%08x X18:%08x X19:%08x "
+             "X20:%08x X21:%08x X22:%08x X23:%08x\n",
             g_current_regs[REG_X16_NDX], g_current_regs[REG_X17_NDX],
             g_current_regs[REG_X18_NDX], g_current_regs[REG_X19_NDX],
             g_current_regs[REG_X20_NDX], g_current_regs[REG_X21_NDX],
             g_current_regs[REG_X22_NDX], g_current_regs[REG_X23_NDX]);
-      _alert("X24:%08x X25:%08x  GP:%08x  FP:%08x  SP:%08x  RA:%08x  EA:%08x  BA:%08x\n",
+      _alert("X24:%08x X25:%08x  GP:%08x  FP:%08x "
+             " SP:%08x  RA:%08x  EA:%08x  BA:%08x\n",
             g_current_regs[REG_X24_NDX], g_current_regs[REG_X25_NDX],
             g_current_regs[REG_X26_NDX], g_current_regs[REG_X27_NDX],
             g_current_regs[REG_X28_NDX], g_current_regs[REG_X29_NDX],
@@ -136,7 +127,7 @@ static inline void up_registerdump(void)
 void lm32_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = misoc_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
diff --git a/arch/misoc/src/minerva/minerva_assert.c b/arch/misoc/src/minerva/minerva_assert.c
index e67c13c..fe47be2 100644
--- a/arch/misoc/src/minerva/minerva_assert.c
+++ b/arch/misoc/src/minerva/minerva_assert.c
@@ -181,7 +181,7 @@ void up_assert(const uint8_t * filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(misoc_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/misoc/src/minerva/minerva_dumpstate.c b/arch/misoc/src/minerva/minerva_dumpstate.c
index f02f2dd..6bd5548 100644
--- a/arch/misoc/src/minerva/minerva_dumpstate.c
+++ b/arch/misoc/src/minerva/minerva_dumpstate.c
@@ -59,19 +59,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-static inline uint32_t up_getsp(void)
-{
-  register uint32_t sp;
-
-  __asm__ __volatile__("addi %0, sp, 0":"=r"(sp));
-
-  return sp;
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -100,25 +87,29 @@ static inline void up_registerdump(void)
     {
       _alert("EPC:%08x \n", g_current_regs[REG_CSR_MEPC]);
       _alert
-        (" X0:%08x  A0:%08x  A1:%08x  A2:%08x  A3:%08x  A4:%08x  A5:%08x  A6:%08x\n",
+        (" X0:%08x  A0:%08x  A1:%08x  A2:%08x "
+         " A3:%08x  A4:%08x  A5:%08x  A6:%08x\n",
          g_current_regs[REG_X0_NDX], g_current_regs[REG_X1_NDX],
          g_current_regs[REG_X2_NDX], g_current_regs[REG_X3_NDX],
          g_current_regs[REG_X4_NDX], g_current_regs[REG_X5_NDX],
          g_current_regs[REG_X6_NDX], g_current_regs[REG_X7_NDX]);
       _alert
-        (" A7:%08x  X9:%08x X10:%08x X11:%08x X12:%08x X13:%08x X14:%08x X15:%08x\n",
+        (" A7:%08x  X9:%08x X10:%08x X11:%08x "
+         "X12:%08x X13:%08x X14:%08x X15:%08x\n",
          g_current_regs[REG_X8_NDX], g_current_regs[REG_X9_NDX],
          g_current_regs[REG_X10_NDX], g_current_regs[REG_X11_NDX],
          g_current_regs[REG_X12_NDX], g_current_regs[REG_X13_NDX],
          g_current_regs[REG_X14_NDX], g_current_regs[REG_X15_NDX]);
       _alert
-        ("X16:%08x X17:%08x X18:%08x X19:%08x X20:%08x X21:%08x X22:%08x X23:%08x\n",
+        ("X16:%08x X17:%08x X18:%08x X19:%08x "
+         "X20:%08x X21:%08x X22:%08x X23:%08x\n",
          g_current_regs[REG_X16_NDX], g_current_regs[REG_X17_NDX],
          g_current_regs[REG_X18_NDX], g_current_regs[REG_X19_NDX],
          g_current_regs[REG_X20_NDX], g_current_regs[REG_X21_NDX],
          g_current_regs[REG_X22_NDX], g_current_regs[REG_X23_NDX]);
       _alert
-        ("X24:%08x X25:%08x  GP:%08x  FP:%08x  SP:%08x  RA:%08x  EA:%08x  BA:%08x\n",
+        ("X24:%08x X25:%08x  GP:%08x  FP:%08x "
+         " SP:%08x  RA:%08x  EA:%08x  BA:%08x\n",
          g_current_regs[REG_X24_NDX], g_current_regs[REG_X25_NDX],
          g_current_regs[REG_X26_NDX], g_current_regs[REG_X27_NDX],
          g_current_regs[REG_X28_NDX], g_current_regs[REG_X29_NDX],
@@ -138,7 +129,7 @@ static inline void up_registerdump(void)
 void minerva_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = misoc_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
diff --git a/arch/or1k/src/common/up_assert.c b/arch/or1k/src/common/up_assert.c
index d2a6170..53aa77c 100644
--- a/arch/or1k/src/common/up_assert.c
+++ b/arch/or1k/src/common/up_assert.c
@@ -82,29 +82,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
- ****************************************************************************/
-
-/* I don't know if the builtin to get SP is enabled */
-
-static inline uint32_t up_getsp(void)
-{
-#if 0
-  uint32_t sp;
-
-  __asm__
-  (
-    "\tmov %0, sp\n\t"
-    : "=r"(sp)
-  );
-
-  return sp;
-#else
-  return 0;
-#endif
-}
-
-/****************************************************************************
  * Name: up_stackdump
  ****************************************************************************/
 
@@ -233,7 +210,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = or1k_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -432,7 +409,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(or1k_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);
diff --git a/arch/xtensa/src/common/xtensa_assert.c b/arch/xtensa/src/common/xtensa_assert.c
index 94e2b28..5cce6ec 100644
--- a/arch/xtensa/src/common/xtensa_assert.c
+++ b/arch/xtensa/src/common/xtensa_assert.c
@@ -117,7 +117,7 @@ static void xtensa_assert(int errorcode)
 #ifdef CONFIG_BOARD_CRASHDUMP
   /* Perform board-specific crash dump */
 
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(xtensa_getsp(), running_task(), filename, lineno);
 #endif
 
   /* Flush any buffered SYSLOG data (from the above) */


[incubator-nuttx] 03/05: arch/x86: change up_getsp to x86_getsp

Posted by ag...@apache.org.
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 60b7b8b3f065389b5f91b0531e2f0e3bfeca224b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Jul 9 03:09:57 2020 +0800

    arch/x86: change up_getsp to x86_getsp
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/x86/include/i486/arch.h    | 19 ++++++++++---------
 arch/x86/include/tls.h          |  2 +-
 arch/x86/src/common/up_assert.c |  4 ++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/include/i486/arch.h b/arch/x86/include/i486/arch.h
index a06acc5..f869cc5 100644
--- a/arch/x86/include/i486/arch.h
+++ b/arch/x86/include/i486/arch.h
@@ -170,16 +170,17 @@
 #  define PIC_OCW3_PCMD_MASK     (3 << PIC_OCW3_PCMD_SHIFT)
 #    define PIC_OCW3_PCMD_IRR    (2 << PIC_OCW3_PCMD_SHIFT) /* Next Read Returns Interrupt Request Register */
 #    define PIC_OCW3_PCMD_ISR    (3 << PIC_OCW3_PCMD_SHIFT) /* Next Read Returns In-Service Register */
-#  define PIC_OCW3_POLLCMD       (1 << 2) /* Poll command */
-#  define PIC_OCW3_ONE           (1 << 3) /* Must be set to 1 */
+#  define PIC_OCW3_POLLCMD       (1 << 2)                   /* Poll command */
+#  define PIC_OCW3_ONE           (1 << 3)                   /* Must be set to 1 */
 #  define PIC_OCW3_SM_SHIFT      (5)
 #  define PIC_OCW3_SM_MASK       (3 << PIC_OCW3_SM_SHIFT)
 #    define PIC_OCW3_RSM         (2 << PIC_OCW3_SM_SHIFT) /* Reset Special Mask */
 #    define PIC_OCW3_SSM         (3 << PIC_OCW3_SM_SHIFT) /* Set Special Mask */
 
-/* If the PIC has been reset, it must be initialized with 2 to 4 Initialization
- * Command Words (ICW) before it will accept and process Interrupt Requests. The
- * following outlines the four possible Initialization Command Words.
+/* If the PIC has been reset, it must be initialized with 2 to 4
+ * Initialization Command Words (ICW) before it will accept and process
+ * Interrupt Requests. The following outlines the four possible
+ * Initialization Command Words.
  */
 
 #define PIC1_ICW1                0x20
@@ -243,8 +244,8 @@
 #    define PIC_ICW4_BMODE_NON   (0 << PIC_ICW4_BMODE_SHIFT) /* Non - Buffered Mode */
 #    define PIC_ICW4_BMODE_SLAVE (2 << PIC_ICW4_BMODE_SHIFT) /* Buffered Mode - Slave */
 #    define PIC_ICW4_BMODE_MSTR  (3 << PIC_ICW4_BMODE_SHIFT) /* Buffered Mode - Master */
-#  define PIC_ICW4_AEOI          (1 << 1) /* Auto EOI  */
-#  define PIC_ICW4_808xMODE      (1 << 0) /* 8086/8080 Mode (vs MCS-80/85) */
+#  define PIC_ICW4_AEOI          (1 << 1)                    /* Auto EOI  */
+#  define PIC_ICW4_808xMODE      (1 << 0)                    /* 8086/8080 Mode (vs MCS-80/85) */
 
 /* Interrupt Mask Register */
 
@@ -340,7 +341,7 @@ begin_packed_struct struct gdt_ptr_s
 /* IDT data structures ******************************************************
  *
  * The Interrupt Descriptor Table (IDT) is a data structure used by the x86
- * architecture to implement an interrupt vector table. The IDT is used by the
+ * architecture to implement an interrupt vector table. IDT is used by the
  * processor to determine the correct response to interrupts and exceptions.
  */
 
@@ -371,7 +372,7 @@ begin_packed_struct struct idt_ptr_s
 
 /* Return stack pointer */
 
-static inline uint32_t up_getsp()
+static inline uint32_t x86_getsp()
 {
   uint32_t regval;
 
diff --git a/arch/x86/include/tls.h b/arch/x86/include/tls.h
index 0298349..c9a1ea1 100644
--- a/arch/x86/include/tls.h
+++ b/arch/x86/include/tls.h
@@ -66,7 +66,7 @@
 static inline FAR struct tls_info_s *up_tls_info(void)
 {
   DEBUGASSERT(!up_interrupt_context());
-  return TLS_INFO((uintptr_t)up_getsp());
+  return TLS_INFO((uintptr_t)x86_getsp());
 }
 #else
 #  define up_tls_info() tls_get_info()
diff --git a/arch/x86/src/common/up_assert.c b/arch/x86/src/common/up_assert.c
index 0da152b..f27d075 100644
--- a/arch/x86/src/common/up_assert.c
+++ b/arch/x86/src/common/up_assert.c
@@ -136,7 +136,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
 static void up_dumpstate(void)
 {
   struct tcb_s *rtcb = running_task();
-  uint32_t sp = up_getsp();
+  uint32_t sp = x86_getsp();
   uint32_t ustackbase;
   uint32_t ustacksize;
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -315,7 +315,7 @@ void up_assert(const uint8_t *filename, int lineno)
   syslog_flush();
 
 #ifdef CONFIG_BOARD_CRASHDUMP
-  board_crashdump(up_getsp(), running_task(), filename, lineno);
+  board_crashdump(x86_getsp(), running_task(), filename, lineno);
 #endif
 
   _up_assert(EXIT_FAILURE);


[incubator-nuttx] 04/05: arch/sim: implement sim_getsp

Posted by ag...@apache.org.
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 <xi...@xiaomi.com>
AuthorDate: Thu Jul 9 03:18:10 2020 +0800

    arch/sim: implement sim_getsp
    
    Signed-off-by: Xiang Xiao <xi...@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 */