You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/03/14 19:38:02 UTC
[incubator-nuttx] 01/02: arm/armv7-a/r: unified syscall registers dump
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit d398ffb9309cc2ce1ad99281b907c103e666e78e
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Mar 14 22:45:53 2022 +0800
arm/armv7-a/r: unified syscall registers dump
Signed-off-by: chao.an <an...@xiaomi.com>
---
arch/arm/src/armv7-a/arm_syscall.c | 52 ++++++++++++++++++++------------------
arch/arm/src/armv7-r/arm_syscall.c | 48 ++++++++++++++++++++---------------
2 files changed, 56 insertions(+), 44 deletions(-)
diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c
index ebb09e4..fc78010 100644
--- a/arch/arm/src/armv7-a/arm_syscall.c
+++ b/arch/arm/src/armv7-a/arm_syscall.c
@@ -45,6 +45,32 @@
****************************************************************************/
/****************************************************************************
+ * Name: dump_syscall
+ *
+ * Description:
+ * Dump the syscall registers
+ *
+ ****************************************************************************/
+
+static void dump_syscall(const char *tag, uint32_t cmd, const uint32_t *regs)
+{
+ /* The SVCall software interrupt is called with R0 = system call command
+ * and R1..R7 = variable number of arguments depending on the system call.
+ */
+
+ svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 "\n", tag, regs, cmd);
+ svcinfo(" R0: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+ " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
+ regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
+ regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
+ svcinfo(" R8: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+ " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
+ regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
+ regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
+ svcinfo("CPSR: %08" PRIx32 "\n", regs[REG_CPSR]);
+}
+
+/****************************************************************************
* Name: dispatch_syscall
*
* Description:
@@ -104,10 +130,6 @@ static void dispatch_syscall(void)
#endif
/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
* Public Functions
****************************************************************************/
@@ -142,16 +164,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* and R1..R7 = variable number of arguments depending on the system call.
*/
- svcinfo("SYSCALL Entry: regs: %p cmd: %" PRId32 "\n", regs, cmd);
- svcinfo(" R0: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
- " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
- regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
- regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
- svcinfo(" R8: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
- " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
- regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
- regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
- svcinfo("CPSR: %08" PRIx32 "\n", regs[REG_CPSR]);
+ dump_syscall("Entry", cmd, regs);
/* Handle the SVCall according to the command in R0 */
@@ -512,16 +525,7 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Report what happened */
- svcinfo("SYSCALL Exit: regs: %p\n", regs);
- svcinfo(" R0: %" PRIx32 " %" PRIx32 " %" PRIx32 " %" PRIx32
- " %" PRIx32 " %" PRIx32 " %" PRIx32 " %" PRIx32 "\n",
- regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
- regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
- svcinfo(" R8: %" PRIx32 " %" PRIx32 " %" PRIx32 " %" PRIx32
- " %" PRIx32 " %" PRIx32 " %" PRIx32 " %" PRIx32 "\n",
- regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
- regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
- svcinfo("CPSR: %08" PRIx32 "\n", regs[REG_CPSR]);
+ dump_syscall("Exit", cmd, regs);
/* Return the last value of curent_regs. This supports context switches
* on return from the exception. That capability is only used with the
diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c
index 6ba06d3..b7a094d 100644
--- a/arch/arm/src/armv7-r/arm_syscall.c
+++ b/arch/arm/src/armv7-r/arm_syscall.c
@@ -42,6 +42,32 @@
****************************************************************************/
/****************************************************************************
+ * Name: dump_syscall
+ *
+ * Description:
+ * Dump the syscall registers
+ *
+ ****************************************************************************/
+
+static void dump_syscall(const char *tag, uint32_t cmd, const uint32_t *regs)
+{
+ /* The SVCall software interrupt is called with R0 = system call command
+ * and R1..R7 = variable number of arguments depending on the system call.
+ */
+
+ svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 "\n", tag, regs, cmd);
+ svcinfo(" R0: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+ " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
+ regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
+ regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
+ svcinfo(" R8: %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+ " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n",
+ regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
+ regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
+ svcinfo("CPSR: %08" PRIx32 "\n", regs[REG_CPSR]);
+}
+
+/****************************************************************************
* Name: dispatch_syscall
*
* Description:
@@ -101,10 +127,6 @@ static void dispatch_syscall(void)
#endif
/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
* Public Functions
****************************************************************************/
@@ -139,14 +161,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* and R1..R7 = variable number of arguments depending on the system call.
*/
- svcinfo("SYSCALL Entry: regs: %p cmd: %d\n", regs, cmd);
- svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
- regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
- svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
- regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
- svcinfo("CPSR: %08x\n", regs[REG_CPSR]);
+ dump_syscall("Entry", cmd, regs);
/* Handle the SVCall according to the command in R0 */
@@ -507,14 +522,7 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Report what happened */
- svcinfo("SYSCALL Exit: regs: %p\n", regs);
- svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
- regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
- svcinfo(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
- regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
- svcinfo("CPSR: %08x\n", regs[REG_CPSR]);
+ dump_syscall("Exit", cmd, regs);
/* Return the last value of curent_regs. This supports context switches
* on return from the exception. That capability is only used with the