From: Huang Pei <huangpei@loongson.cn>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>, ambrosehua@gmail.com
Cc: Bibo Mao <maobibo@loongson.cn>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mips@vger.kernel.org, linux-arch@vger.kernel.org,
linux-mm@kvack.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
Paul Burton <paulburton@kernel.org>,
Li Xuefeng <lixuefeng@loongson.cn>,
Yang Tiezhu <yangtiezhu@loongson.cn>,
Gao Juxin <gaojuxin@loongson.cn>,
Huacai Chen <chenhuacai@loongson.cn>,
Jinyang He <hejinyang@loongson.cn>,
"Maciej W . Rozycki" <macro@orcam.me.uk>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH 2/4] MIPS: move FTRACE_SYSCALLS from ftrace.c into syscall.c
Date: Fri, 5 Mar 2021 18:19:31 +0800 [thread overview]
Message-ID: <20210305101933.9799-3-huangpei@loongson.cn> (raw)
In-Reply-To: <20210305101933.9799-1-huangpei@loongson.cn>
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
arch/mips/kernel/Makefile | 1 -
arch/mips/kernel/ftrace.c | 33 ---------------------------------
arch/mips/kernel/syscall.c | 32 ++++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 33e31ea10234..5b2b551058ac 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -39,7 +39,6 @@ obj-$(CONFIG_DEBUG_FS) += segment.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_MODULES) += module.o
-obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
sw-y := r4k_switch.o
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index f57e68f40a34..5156b2e54bfe 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -12,14 +12,11 @@
#include <linux/uaccess.h>
#include <linux/init.h>
#include <linux/ftrace.h>
-#include <linux/syscalls.h>
#include <asm/asm.h>
#include <asm/asm-offsets.h>
#include <asm/cacheflush.h>
-#include <asm/syscall.h>
#include <asm/uasm.h>
-#include <asm/unistd.h>
#include <asm-generic/sections.h>
@@ -382,33 +379,3 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
WARN_ON(1);
}
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-
-#ifdef CONFIG_32BIT
-unsigned long __init arch_syscall_addr(int nr)
-{
- return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
-}
-#endif
-
-#ifdef CONFIG_64BIT
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-#ifdef CONFIG_MIPS32_N32
- if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls)
- return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
-#endif
- if (nr >= __NR_64_Linux && nr < __NR_64_Linux + __NR_64_Linux_syscalls)
- return (unsigned long)sys_call_table[nr - __NR_64_Linux];
-#ifdef CONFIG_MIPS32_O32
- if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls)
- return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
-#endif
-
- return (unsigned long) &sys_ni_syscall;
-}
-#endif
-
-#endif /* CONFIG_FTRACE_SYSCALLS */
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 2afa3eef486a..797d9ce478da 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -39,7 +39,9 @@
#include <asm/shmparam.h>
#include <asm/sync.h>
#include <asm/sysmips.h>
+#include <asm/syscall.h>
#include <asm/switch_to.h>
+#include <asm/unistd.h>
/*
* For historic reasons the pipe(2) syscall on MIPS has an unusual calling
@@ -233,6 +235,36 @@ SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
return -EINVAL;
}
+#ifdef CONFIG_FTRACE_SYSCALLS
+
+#ifdef CONFIG_32BIT
+unsigned long __init arch_syscall_addr(int nr)
+{
+ return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
+}
+#endif
+
+#ifdef CONFIG_64BIT
+
+unsigned long __init arch_syscall_addr(int nr)
+{
+#ifdef CONFIG_MIPS32_N32
+ if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls)
+ return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
+#endif
+ if (nr >= __NR_64_Linux && nr < __NR_64_Linux + __NR_64_Linux_syscalls)
+ return (unsigned long)sys_call_table[nr - __NR_64_Linux];
+#ifdef CONFIG_MIPS32_O32
+ if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls)
+ return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
+#endif
+
+ return (unsigned long) &sys_ni_syscall;
+}
+#endif
+
+#endif /* CONFIG_FTRACE_SYSCALLS */
+
/*
* No implemented yet ...
*/
--
2.17.1
next prev parent reply other threads:[~2021-03-05 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 10:19 [RFC]: MIPS: new ftrace implementation Huang Pei
2021-03-05 10:19 ` [PATCH 1/4] MIPS: replace -pg with CC_FLAGS_FTRACE Huang Pei
2021-03-05 10:19 ` Huang Pei [this message]
2021-03-05 10:19 ` [PATCH 3/4] MIPS: prepare for new ftrace implementation Huang Pei
2021-03-05 10:19 ` [PATCH 4/4] MIPS: add DYNAMIC_FTRACE_WITH_REGS Huang Pei
2021-03-07 10:50 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210305101933.9799-3-huangpei@loongson.cn \
--to=huangpei@loongson.cn \
--cc=akpm@linux-foundation.org \
--cc=ambrosehua@gmail.com \
--cc=chenhuacai@loongson.cn \
--cc=gaojuxin@loongson.cn \
--cc=hejinyang@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lixuefeng@loongson.cn \
--cc=macro@orcam.me.uk \
--cc=maobibo@loongson.cn \
--cc=paulburton@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tsbogend@alpha.franken.de \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).