linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Firoz Khan <firoz.khan@linaro.org>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>, Stefan Agner <stefan@agner.ch>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kate Stewart <kstewart@linuxfoundation.org>
Cc: y2038@lists.linaro.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, arnd@arndb.de,
	deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org,
	firoz.khan@linaro.org
Subject: [PATCH 2/3] arm64: assign __NR_*_Linux_syscalls generated by the scripts
Date: Thu,  3 Jan 2019 21:10:24 +0530	[thread overview]
Message-ID: <1546530025-26014-3-git-send-email-firoz.khan@linaro.org> (raw)
In-Reply-To: <1546530025-26014-1-git-send-email-firoz.khan@linaro.org>

Assign the generated values - __NR_C32_Linux_syscalls and
__NR_64_Linux_syscalls instead of __NR_compat_syscalls and
__NR_syscalls respectively. It is better than hard coding
it.

One of the patch in the patch series will generate the
headers and calculate the total number of syscalls that
can be assigned. Otherwise the hard coded values need to
be changed whenever we either add a new system call or
delete a existing system call.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/arm64/include/asm/unistd.h | 10 ++++++----
 arch/arm64/kernel/sys.c         |  4 ++--
 arch/arm64/kernel/sys32.c       |  4 ++--
 arch/arm64/kernel/syscall.c     |  4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index b13ca091..fca2186 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -13,6 +13,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#include <asm/unistd_nr_64.h>
+#include <asm/unistd_nr_c32.h>
+
 #ifdef CONFIG_COMPAT
 #define __ARCH_WANT_COMPAT_STAT64
 #define __ARCH_WANT_SYS_GETHOSTNAME
@@ -42,14 +46,12 @@
 #define __ARM_NR_COMPAT_BASE		0x0f0000
 #define __ARM_NR_compat_cacheflush	(__ARM_NR_COMPAT_BASE+2)
 #define __ARM_NR_compat_set_tls		(__ARM_NR_COMPAT_BASE+5)
-
-#define __NR_compat_syscalls		399
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_NEW_STAT
 
 #ifndef __COMPAT_SYSCALL_NR
 #include <uapi/asm/unistd.h>
 #endif
-
-#define NR_syscalls (__NR_syscalls)
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index b44065f..f4ee0f5 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -62,7 +62,7 @@
 #undef __SYSCALL
 #define __SYSCALL(nr, sym)	[nr] = (syscall_fn_t)__arm64_##sym,
 
-const syscall_fn_t sys_call_table[__NR_syscalls] = {
-	[0 ... __NR_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
+const syscall_fn_t sys_call_table[__NR_64_Linux_syscalls] = {
+	[0 ... __NR_64_Linux_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
 #include <asm/unistd.h>
 };
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
index 0f8bcb7..772eaf2 100644
--- a/arch/arm64/kernel/sys32.c
+++ b/arch/arm64/kernel/sys32.c
@@ -143,7 +143,7 @@
 #undef __SYSCALL
 #define __SYSCALL(nr, sym)	[nr] = (syscall_fn_t)__arm64_##sym,
 
-const syscall_fn_t compat_sys_call_table[__NR_compat_syscalls] = {
-	[0 ... __NR_compat_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
+const syscall_fn_t compat_sys_call_table[__NR_C32_Linux_syscalls] = {
+	[0 ... __NR_C32_Linux_syscalls - 1] = (syscall_fn_t)sys_ni_syscall,
 #include <asm/unistd32.h>
 };
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index 032d223..4e50b1a 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -127,13 +127,13 @@ static inline void sve_user_discard(void)
 asmlinkage void el0_svc_handler(struct pt_regs *regs)
 {
 	sve_user_discard();
-	el0_svc_common(regs, regs->regs[8], __NR_syscalls, sys_call_table);
+	el0_svc_common(regs, regs->regs[8], __NR_64_Linux_syscalls, sys_call_table);
 }
 
 #ifdef CONFIG_COMPAT
 asmlinkage void el0_svc_compat_handler(struct pt_regs *regs)
 {
-	el0_svc_common(regs, regs->regs[7], __NR_compat_syscalls,
+	el0_svc_common(regs, regs->regs[7], __NR_C32_Linux_syscalls,
 		       compat_sys_call_table);
 }
 #endif
-- 
1.9.1


  parent reply	other threads:[~2019-01-03 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 15:40 [PATCH 0/3] arm64: system call table generation for asm-generic Firoz Khan
2019-01-03 15:40 ` [PATCH 1/3] arm64: add system call table generation files Firoz Khan
2019-01-03 15:40 ` Firoz Khan [this message]
2019-01-03 15:40 ` [PATCH 3/3] arm64: generate uapi and kapi headers Firoz Khan
2019-01-19 23:56 ` [PATCH 0/3] arm64: system call table generation for asm-generic Will Deacon
2019-01-21 15:53   ` Arnd Bergmann
2019-01-22  4:17     ` Firoz Khan

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=1546530025-26014-3-git-send-email-firoz.khan@linaro.org \
    --to=firoz.khan@linaro.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=deepa.kernel@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.juszkiewicz@linaro.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=pombredanne@nexb.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=stefan@agner.ch \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=y2038@lists.linaro.org \
    /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).