From patchwork Sat Mar 13 06:41:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Pei X-Patchwork-Id: 12136535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F4CC433E0 for ; Sat, 13 Mar 2021 06:42:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1843664F1B for ; Sat, 13 Mar 2021 06:42:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1843664F1B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4EB386B0071; Sat, 13 Mar 2021 01:42:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 46F936B0073; Sat, 13 Mar 2021 01:42:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24E996B0072; Sat, 13 Mar 2021 01:42:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id E647D6B0070 for ; Sat, 13 Mar 2021 01:42:28 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9D598A2C0 for ; Sat, 13 Mar 2021 06:42:28 +0000 (UTC) X-FDA: 77913907176.09.E9F6D38 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by imf28.hostedemail.com (Postfix) with ESMTP id 3B6D920053EB for ; Sat, 13 Mar 2021 06:42:25 +0000 (UTC) Received: from localhost.localdomain (unknown [222.209.9.50]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxGda4XkxgjLUYAA--.9506S4; Sat, 13 Mar 2021 14:42:10 +0800 (CST) From: Huang Pei To: Thomas Bogendoerfer , ambrosehua@gmail.com Cc: Bibo Mao , linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Huacai Chen , Jinyang He , "Maciej W . Rozycki" , Steven Rostedt , Jisheng Zhang , Masami Hiramatsu Subject: [PATCH 2/6] MIPS: move FTRACE_SYSCALLS from ftrace.c into syscall.c Date: Sat, 13 Mar 2021 14:41:45 +0800 Message-Id: <20210313064149.29276-3-huangpei@loongson.cn> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210313064149.29276-1-huangpei@loongson.cn> References: <20210313064149.29276-1-huangpei@loongson.cn> X-CM-TRANSID: AQAAf9AxGda4XkxgjLUYAA--.9506S4 X-Coremail-Antispam: 1UD129KBjvJXoWxAF4ktr1xZr15Xry3WF4UJwb_yoWrGFykpF s8Z3ZrG395WF10y347ZryFkrZ3Jw4kZryay3ZrK34rZ3Wxt3W5XrZ29a4ktryktFWq9FW8 uFWxGr15Cr4ru3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmj14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UM2 8EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr1j6rxd M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7MxkIecxEwVAFwVW8AwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8 JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1V AFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I 8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2Kfnx nUUI43ZEXa7VUjkhLUUUUUU== X-CM-SenderInfo: xkxd0whshlqz5rrqw2lrqou0/ X-Stat-Signature: uhmuzro998da8jkx1f15js4ygfiuwztw X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3B6D920053EB Received-SPF: none (loongson.cn>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=loongson.cn; client-ip=114.242.206.163 X-HE-DKIM-Result: none/none X-HE-Tag: 1615617745-420832 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000826, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Huang Pei --- 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 #include #include -#include #include #include #include -#include #include -#include #include @@ -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 #include #include +#include #include +#include /* * 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 ... */