From: Firoz Khan <firoz.khan@linaro.org>
To: linux-ia64@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>
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 1/5] ia64: Replace NR_syscalls macro from asm/unistd.h
Date: Thu, 09 Aug 2018 05:17:11 +0000 [thread overview]
Message-ID: <1533791115-3681-2-git-send-email-firoz.khan@linaro.org> (raw)
In-Reply-To: <1533791115-3681-1-git-send-email-firoz.khan@linaro.org>
__NR_syscalls macro holds the number of system call exist in IA64
architecture. This macro is currently the part of asm/unistd.h file.
We have to change the value of __NR_syscalls, if we add or delete a
system call.
One of the patch in this patch series has a script which will generate
a uapi header based on syscall.tbl file. The syscall.tbl file contains
the number of system call information. So we have two option to update
__NR_syscalls value.
1. Update __NR_syscalls in asm/unistd.h manually by counting the
no.of system calls. No need to update __NR_syscalls untill
we either add a new system call or delete an existing system
call.
2. We can keep this feature it above mentioned script, that'll
count the number of syscalls and keep it in a generated file.
In this case we don't need to explicitly update __NR_syscalls
in asm/unistd.h file.
The 2nd option will be the recommended one. For that, I moved the
NR_syscalls macro from asm/unistd.h to uapi/asm/unistd.h. The macro
name also changed form NR_syscalls to __NR_syscalls for making the
name convention same across all architecture. While __NR_syscalls
isn't strictly part of the uapi, having it as part of the generated
header to simplifies the implementation.
Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
arch/ia64/include/asm/unistd.h | 4 ----
arch/ia64/include/uapi/asm/unistd.h | 2 ++
arch/ia64/kernel/entry.S | 4 ++--
arch/ia64/kernel/fsys.S | 2 +-
arch/ia64/kernel/gate.S | 4 ++--
arch/ia64/kernel/ivt.S | 2 +-
arch/ia64/kernel/patch.c | 2 +-
arch/ia64/mm/init.c | 6 +++---
8 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index ffb705d..6d1b047 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -10,10 +10,6 @@
#include <uapi/asm/unistd.h>
-
-
-#define NR_syscalls 326 /* length of syscall table */
-
/*
* The following defines stop scripts/checksyscalls.sh from complaining about
* unimplemented system calls. Glibc provides for each of these by using
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 5fe71d4..52c6712 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -341,4 +341,6 @@
#define __NR_preadv2 1348
#define __NR_pwritev2 1349
+#define __NR_syscalls 326 /* length of syscall table */
+
#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 68362b3..f40d9fd 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -501,7 +501,7 @@ GLOBAL_ENTRY(ia64_trace_syscall)
adds r15=PT(R15)+16,sp // r15 = &pt_regs.r15 (syscall #)
;;
ld8 r15=[r15]
- mov r3=NR_syscalls - 1
+ mov r3=__NR_syscalls - 1
;;
adds r15=-1024,r15
movl r16=sys_call_table
@@ -1757,4 +1757,4 @@ sys_call_table:
data8 sys_preadv2
data8 sys_pwritev2
- .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
+ .org sys_call_table + 8*__NR_syscalls // guard against failures to increase __NR_syscalls
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index fe742ff..2d33cff 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -834,4 +834,4 @@ fsyscall_table:
// fill in zeros for the remaining entries
.zero:
- .space fsyscall_table + 8*NR_syscalls - .zero, 0
+ .space fsyscall_table + 8*__NR_syscalls - .zero, 0
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
index 9f235cd..eeafa31 100644
--- a/arch/ia64/kernel/gate.S
+++ b/arch/ia64/kernel/gate.S
@@ -331,12 +331,12 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
;;
mov r16=IA64_KR(CURRENT) // M2 (12 cyc)
shladd r18=r17,3,r14 // A
- mov r19=NR_syscalls-1 // A
+ mov r19=__NR_syscalls-1 // A
;;
lfetch [r18] // M0|1
MOV_FROM_PSR(p0, r29, r8) // M2 (12 cyc)
// If r17 is a NaT, p6 will be zero
- cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+NR_syscalls)?
+ cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+__NR_syscalls)?
;;
mov r21=ar.fpsr // M2 (12 cyc)
tnat.nz p10,p9=r15 // I0
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index 1efcbe5..93ddc00 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -763,7 +763,7 @@ ENTRY(break_fault)
adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
adds r15=-1024,r15 // A subtract 1024 from syscall number
- mov r3=NR_syscalls - 1
+ mov r3=__NR_syscalls - 1
;;
ld1.bias r17=[r16] // M0|1 r17 = current->thread.on_ustack flag
ld4 r9=[r9] // M0|1 r9 = current_thread_info()->flags
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index 7f21a8c..d2e7e31 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -172,7 +172,7 @@
static void __init
patch_fsyscall_table (unsigned long start, unsigned long end)
{
- extern unsigned long fsyscall_table[NR_syscalls];
+ extern unsigned long fsyscall_table[__NR_syscalls];
s32 *offp = (s32 *) start;
u64 ip;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 3b85c3e..0096be4 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -635,9 +635,9 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
* (heavy-weight) handler, but mark it by setting bit 0, so the fsyscall entry
* code can tell them apart.
*/
- for (i = 0; i < NR_syscalls; ++i) {
- extern unsigned long fsyscall_table[NR_syscalls];
- extern unsigned long sys_call_table[NR_syscalls];
+ for (i = 0; i < __NR_syscalls; ++i) {
+ extern unsigned long fsyscall_table[__NR_syscalls];
+ extern unsigned long sys_call_table[__NR_syscalls];
if (!fsyscall_table[i] || nolwsys)
fsyscall_table[i] = sys_call_table[i] | 1;
--
1.9.1
next prev parent reply other threads:[~2018-08-09 5:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 5:17 [PATCH 0/5] System call table generation support Firoz Khan
2018-08-09 5:17 ` Firoz Khan [this message]
2018-08-09 5:17 ` [PATCH 2/5] ia64: Added an offset for system call number Firoz Khan
2018-08-09 5:17 ` [PATCH 3/5] ia64: Replaced the system call table entry from entry.S Firoz Khan
2018-08-09 5:17 ` [PATCH 4/5] ia64: Added system call table generation support Firoz Khan
2018-08-09 5:17 ` [PATCH 5/5] ia64: uapi header and system call table file generation Firoz Khan
2018-08-10 16:20 ` [PATCH 0/5] System call table generation support Luck, Tony
2018-09-18 9:37 ` 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=1533791115-3681-2-git-send-email-firoz.khan@linaro.org \
--to=firoz.khan@linaro.org \
--cc=arnd@arndb.de \
--cc=deepa.kernel@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.juszkiewicz@linaro.org \
--cc=tony.luck@intel.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).