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:03 UTC
[incubator-nuttx] 02/02: syscall/names: export the syscall name in STUB module
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 ea42981cc69a6ede9df76df8f2ee78d4dcf0176b
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Mar 15 00:05:41 2022 +0800
syscall/names: export the syscall name in STUB module
Signed-off-by: chao.an <an...@xiaomi.com>
---
arch/arm/src/armv7-a/arm_syscall.c | 13 ++++++++++++-
arch/arm/src/armv7-r/arm_syscall.c | 13 ++++++++++++-
include/sys/syscall.h | 4 ----
syscall/Makefile | 2 ++
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c
index fc78010..c571b73 100644
--- a/arch/arm/src/armv7-a/arm_syscall.c
+++ b/arch/arm/src/armv7-a/arm_syscall.c
@@ -58,7 +58,18 @@ static void dump_syscall(const char *tag, uint32_t cmd, const uint32_t *regs)
* and R1..R7 = variable number of arguments depending on the system call.
*/
- svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 "\n", tag, regs, cmd);
+#ifdef CONFIG_LIB_SYSCALL
+ if (cmd >= CONFIG_SYS_RESERVED)
+ {
+ svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 " name: %s\n", tag,
+ regs, cmd, g_funcnames[cmd - CONFIG_SYS_RESERVED]);
+ }
+ else
+#endif
+ {
+ 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],
diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c
index b7a094d..0311803 100644
--- a/arch/arm/src/armv7-r/arm_syscall.c
+++ b/arch/arm/src/armv7-r/arm_syscall.c
@@ -55,7 +55,18 @@ static void dump_syscall(const char *tag, uint32_t cmd, const uint32_t *regs)
* and R1..R7 = variable number of arguments depending on the system call.
*/
- svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 "\n", tag, regs, cmd);
+#ifdef CONFIG_LIB_SYSCALL
+ if (cmd >= CONFIG_SYS_RESERVED)
+ {
+ svcinfo("SYSCALL %s: regs: %p cmd: %" PRId32 " name: %s\n", tag,
+ regs, cmd, g_funcnames[cmd - CONFIG_SYS_RESERVED]);
+ }
+ else
+#endif
+ {
+ 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],
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index 41df746..8267f4d 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -89,16 +89,12 @@ EXTERN const uintptr_t g_stublookup[SYS_nsyscalls];
#endif
-#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
-
/* Given the system call number, the corresponding entry in this table
* provides the name of the function.
*/
EXTERN const char *g_funcnames[SYS_nsyscalls];
-#endif
-
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
diff --git a/syscall/Makefile b/syscall/Makefile
index 150edb3..7965907 100644
--- a/syscall/Makefile
+++ b/syscall/Makefile
@@ -27,6 +27,8 @@ include wraps/Make.defs
MKSYSCALL = "$(TOPDIR)$(DELIM)tools$(DELIM)mksyscall$(HOSTEXEEXT)"
CSVFILE = "$(TOPDIR)$(DELIM)syscall$(DELIM)syscall.csv"
+STUB_SRCS += syscall_names.c
+
ifeq ($(CONFIG_SCHED_INSTRUMENTATION_SYSCALL),y)
ifeq ($(CONFIG_LIB_SYSCALL),y)
PROXY_SRCS += syscall_names.c