All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] System call table generation support
@ 2018-07-16 10:23 Firoz Khan
  2018-07-16 10:23 ` [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header Firoz Khan
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

The goal of this patch series is to easily add/modify/delete a
system call by changing entry in syscall.tbl file. No need
to manually edit many files.

The another goal of this patch series is to to unify the system
call implementation across all the architectures. ARM, s390 and 
x86 architecuture does have the similar support. I leverage their 
implementation to come up with a generic solution.

I have done the same support for work for ia64, m68k, microblaze, 
mips, parisc, powerpc, sh, sparc, and xtensa. But I started sending 
the patch for one architecuture for review. Below mentioned git
repository contains more details.
Git repo:- https://github.com/frzkhn/system_call_table_generator/

Finally, this is the ground work for solving the Y2038 issue. We 
need to change two dozen of system calls to solve Y2038 issue. So
this implementation will help to easily modify from existing system
call to Y2038 compatible system calls.

Firoz Khan (6):
  alpha: Move __IGNORE* entries to non uapi header
  alpha: Add CONFIG_OSF4_COMPAT for compat syscall support
  alpha: Unify the not-implemented system call entry name
  alpha: Replace NR_SYSCALLS macro from asm/unistd.h
  alpha: Add system call table generation support
  alpha: uapi header and system call table file generation

 arch/alpha/Makefile                      |   3 +
 arch/alpha/include/asm/Kbuild            |   3 +-
 arch/alpha/include/asm/unistd.h          |   7 +-
 arch/alpha/include/uapi/asm/Kbuild       |   2 +
 arch/alpha/include/uapi/asm/unistd.h     | 489 ---------------------------
 arch/alpha/kernel/Makefile               |   2 +-
 arch/alpha/kernel/entry.S                |   4 +-
 arch/alpha/kernel/osf_sys.c              |   9 +-
 arch/alpha/kernel/syscall.S              |  20 ++
 arch/alpha/kernel/syscalls/Makefile      |  37 +++
 arch/alpha/kernel/syscalls/syscall.tbl   | 450 +++++++++++++++++++++++++
 arch/alpha/kernel/syscalls/syscallhdr.sh |  33 ++
 arch/alpha/kernel/syscalls/syscalltbl.sh |  28 ++
 arch/alpha/kernel/systbls.S              | 552 -------------------------------
 14 files changed, 589 insertions(+), 1050 deletions(-)
 delete mode 100644 arch/alpha/include/uapi/asm/unistd.h
 create mode 100644 arch/alpha/kernel/syscall.S
 create mode 100644 arch/alpha/kernel/syscalls/Makefile
 create mode 100644 arch/alpha/kernel/syscalls/syscall.tbl
 create mode 100644 arch/alpha/kernel/syscalls/syscallhdr.sh
 create mode 100644 arch/alpha/kernel/syscalls/syscalltbl.sh
 delete mode 100644 arch/alpha/kernel/systbls.S

-- 
2.7.4


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-08-11 19:28     ` Al Viro
  2018-07-16 10:23 ` [PATCH 2/6] alpha: Add CONFIG_OSF4_COMPAT for compat syscall support Firoz Khan
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

It is correct to keep __IGNORE* entry in non uapi header
asm/unistd.h while uapi/asm/unistd.h must hold information
only useful for user space applications.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/alpha/include/asm/unistd.h      | 5 +++++
 arch/alpha/include/uapi/asm/unistd.h | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index d6e29a1..1d19087 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -17,4 +17,9 @@
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
+/* Alpha doesn't have protection keys. */
+#define __IGNORE_pkey_mprotect
+#define __IGNORE_pkey_alloc
+#define __IGNORE_pkey_free
+
 #endif /* _ALPHA_UNISTD_H */
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index e153ca6..3bb6ac1 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -481,9 +481,4 @@
 #define __NR_pwritev2			521
 #define __NR_statx			522
 
-/* Alpha doesn't have protection keys. */
-#define __IGNORE_pkey_mprotect
-#define __IGNORE_pkey_alloc
-#define __IGNORE_pkey_free
-
 #endif /* _UAPI_ALPHA_UNISTD_H */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/6] alpha: Add CONFIG_OSF4_COMPAT for compat syscall support
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
  2018-07-16 10:23 ` [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-07-16 10:23 ` [PATCH 3/6] alpha: Unify the not-implemented system call entry name Firoz Khan
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

Removed the CONFIG_OSF4_COMPAT check from systbls.S and
kept it in osf_sys.c, so it will provide the same system
call support. To do so, we can keep a generic formatted
system call table file across all architectures.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/alpha/kernel/osf_sys.c | 9 ++++++---
 arch/alpha/kernel/systbls.S | 5 -----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 6e92175..696a6b7 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1349,7 +1349,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
 }
 
 #ifdef CONFIG_OSF4_COMPAT
-
 /* Clear top 32 bits of iov_len in the user's buffer for
    compatibility with old versions of OSF/1 where iov_len
    was defined as int. */
@@ -1366,27 +1365,31 @@ osf_fix_iov_len(const struct iovec __user *iov, unsigned long count)
 	}
 	return 0;
 }
+#endif
 
 SYSCALL_DEFINE3(osf_readv, unsigned long, fd,
 		const struct iovec __user *, vector, unsigned long, count)
 {
+#ifdef CONFIG_OSF4_COMPAT
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
 			return -EFAULT;
+#endif
+
 	return sys_readv(fd, vector, count);
 }
 
 SYSCALL_DEFINE3(osf_writev, unsigned long, fd,
 		const struct iovec __user *, vector, unsigned long, count)
 {
+#ifdef CONFIG_OSF4_COMPAT
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
 			return -EFAULT;
+#endif
 	return sys_writev(fd, vector, count);
 }
 
-#endif
-
 SYSCALL_DEFINE2(osf_getpriority, int, which, int, who)
 {
 	int prio = sys_getpriority(which, who);
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 1374e59..fcf2f60 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -132,13 +132,8 @@ sys_call_table:
 	.quad sys_osf_getrusage
 	.quad sys_getsockopt
 	.quad alpha_ni_syscall
-#ifdef CONFIG_OSF4_COMPAT
 	.quad sys_osf_readv			/* 120 */
 	.quad sys_osf_writev
-#else
-	.quad sys_readv				/* 120 */
-	.quad sys_writev
-#endif
 	.quad sys_osf_settimeofday
 	.quad sys_fchown
 	.quad sys_fchmod
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
  2018-07-16 10:23 ` [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header Firoz Khan
  2018-07-16 10:23 ` [PATCH 2/6] alpha: Add CONFIG_OSF4_COMPAT for compat syscall support Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-08-11  0:04     ` Al Viro
  2018-07-16 10:23 ` [PATCH 4/6] alpha: Replace NR_SYSCALLS macro from asm/unistd.h Firoz Khan
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

systbl.S contain two types of system call entry name which are
alpha_ni_syscall and sys_ni_syscall. So this patch will unify
the not-implemented system call entry name as alpha_ni_syscall.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/alpha/kernel/systbls.S | 320 ++++++++++++++++++++++----------------------
 1 file changed, 161 insertions(+), 159 deletions(-)

diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index fcf2f60..7ef6925 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -7,97 +7,99 @@
 
 #include <asm/unistd.h>
 
+#define sys_ni_syscall alpha_ni_syscall
+
 	.data
 	.align 3
 	.globl sys_call_table
 sys_call_table:
-	.quad alpha_ni_syscall			/* 0 */
+	.quad sys_ni_syscall			/* 0 */
 	.quad sys_exit
 	.quad alpha_fork
 	.quad sys_read
 	.quad sys_write
-	.quad alpha_ni_syscall			/* 5 */
+	.quad sys_ni_syscall			/* 5 */
 	.quad sys_close
 	.quad sys_osf_wait4
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_link
 	.quad sys_unlink			/* 10 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_chdir
 	.quad sys_fchdir
 	.quad sys_mknod
 	.quad sys_chmod				/* 15 */
 	.quad sys_chown
 	.quad sys_osf_brk
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_lseek
 	.quad sys_getxpid			/* 20 */
 	.quad sys_osf_mount
 	.quad sys_umount
 	.quad sys_setuid
 	.quad sys_getxuid
-	.quad alpha_ni_syscall			/* 25 */
+	.quad sys_ni_syscall			/* 25 */
 	.quad sys_ptrace
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 30 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 30 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_access
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 35 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 35 */
 	.quad sys_sync
 	.quad sys_kill
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
-	.quad alpha_ni_syscall			/* 40 */
+	.quad sys_ni_syscall			/* 40 */
 	.quad sys_dup
 	.quad sys_alpha_pipe
 	.quad sys_osf_set_program_attributes
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_open				/* 45 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getxgid
 	.quad sys_osf_sigprocmask
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 50 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 50 */
 	.quad sys_acct
 	.quad sys_sigpending
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_ioctl
-	.quad alpha_ni_syscall			/* 55 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall			/* 55 */
+	.quad sys_ni_syscall
 	.quad sys_symlink
 	.quad sys_readlink
 	.quad sys_execve
 	.quad sys_umask				/* 60 */
 	.quad sys_chroot
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgrp
 	.quad sys_getpagesize
-	.quad alpha_ni_syscall			/* 65 */
+	.quad sys_ni_syscall			/* 65 */
 	.quad alpha_vfork
 	.quad sys_newstat
 	.quad sys_newlstat
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 70 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 70 */
 	.quad sys_osf_mmap
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_munmap
 	.quad sys_mprotect
 	.quad sys_madvise			/* 75 */
 	.quad sys_vhangup
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getgroups
 	/* map BSD's setpgrp to sys_setpgid for binary compatibility: */
 	.quad sys_setgroups			/* 80 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
 	.quad sys_osf_setitimer
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 85 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 85 */
 	.quad sys_osf_getitimer
 	.quad sys_gethostname
 	.quad sys_sethostname
@@ -119,19 +121,19 @@ sys_call_table:
 	.quad sys_bind
 	.quad sys_setsockopt			/* 105 */
 	.quad sys_listen
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 110 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 110 */
 	.quad sys_sigsuspend
 	.quad sys_osf_sigstack
 	.quad sys_recvmsg
 	.quad sys_sendmsg
-	.quad alpha_ni_syscall			/* 115 */
+	.quad sys_ni_syscall			/* 115 */
 	.quad sys_osf_gettimeofday
 	.quad sys_osf_getrusage
 	.quad sys_getsockopt
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_readv			/* 120 */
 	.quad sys_osf_writev
 	.quad sys_osf_settimeofday
@@ -151,66 +153,66 @@ sys_call_table:
 	.quad sys_mkdir
 	.quad sys_rmdir
 	.quad sys_osf_utimes
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 140 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 140 */
 	.quad sys_getpeername
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getrlimit
 	.quad sys_setrlimit			/* 145 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setsid
 	.quad sys_quotactl
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getsockname			/* 150 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 155 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 155 */
 	.quad sys_osf_sigaction
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdirentries
 	.quad sys_osf_statfs			/* 160 */
 	.quad sys_osf_fstatfs
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdomainname		/* 165 */
 	.quad sys_setdomainname
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 170 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 175 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 180 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 185 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 190 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 195 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 170 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 175 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 180 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 185 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 190 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 195 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	/* The OSF swapon has two extra arguments, but we ignore them.  */
 	.quad sys_swapon
 	.quad sys_msgctl			/* 200 */
@@ -226,93 +228,93 @@ sys_call_table:
 	.quad sys_shmctl			/* 210 */
 	.quad sys_shmdt
 	.quad sys_shmget
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 215 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 215 */
+	.quad sys_ni_syscall
 	.quad sys_msync
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 220 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 220 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_stat
 	.quad sys_osf_lstat			/* 225 */
 	.quad sys_osf_fstat
 	.quad sys_osf_statfs64
 	.quad sys_osf_fstatfs64
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 230 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 230 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgid
 	.quad sys_getsid
 	.quad sys_sigaltstack			/* 235 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 240 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 240 */
 	.quad sys_osf_sysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_proplist_syscall
-	.quad alpha_ni_syscall			/* 245 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 250 */
+	.quad sys_ni_syscall			/* 245 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 250 */
 	.quad sys_osf_usleep_thread
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_sysfs
-	.quad alpha_ni_syscall			/* 255 */
+	.quad sys_ni_syscall			/* 255 */
 	.quad sys_osf_getsysinfo
 	.quad sys_osf_setsysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 260 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 265 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 270 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 275 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 280 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 285 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 290 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 295 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 260 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 265 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 270 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 275 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 280 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 285 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 290 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 295 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 /* linux-specific system calls start at 300 */
 	.quad sys_bdflush			/* 300 */
 	.quad sys_sethae
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/6] alpha: Replace NR_SYSCALLS macro from asm/unistd.h
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
                   ` (2 preceding siblings ...)
  2018-07-16 10:23 ` [PATCH 3/6] alpha: Unify the not-implemented system call entry name Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-07-16 10:23 ` [PATCH 5/6] alpha: Add system call table generation support Firoz Khan
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

Replace NR_SYSCALLS from asm/unistd.h and keep equivalent macro
__NR_syscalls in uapi/asm/unistd.h and this will make a unified
implementation across all the architecture and we can use a system
call generation script to generate __NR_syscalls.

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/alpha/include/asm/unistd.h      | 2 --
 arch/alpha/include/uapi/asm/unistd.h | 2 ++
 arch/alpha/kernel/entry.S            | 4 ++--
 arch/alpha/kernel/systbls.S          | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 1d19087..92c3f2e 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -4,8 +4,6 @@
 
 #include <uapi/asm/unistd.h>
 
-#define NR_SYSCALLS			523
-
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_GETHOSTNAME
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index 3bb6ac1..5d4b51e 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -481,4 +481,6 @@
 #define __NR_pwritev2			521
 #define __NR_statx			522
 
+#define __NR_syscalls                   523
+
 #endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index c64806a..8f0d706 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -454,7 +454,7 @@ entSys:
 	SAVE_ALL
 	lda	$8, 0x3fff
 	bic	$sp, $8, $8
-	lda	$4, NR_SYSCALLS($31)
+	lda	$4, __NR_syscalls($31)
 	stq	$16, SP_OFF+24($sp)
 	lda	$5, sys_call_table
 	lda	$27, sys_ni_syscall
@@ -585,7 +585,7 @@ strace:
 	ldq	$21, 88($sp)
 
 	/* get the system call pointer.. */
-	lda	$1, NR_SYSCALLS($31)
+	lda	$1, __NR_syscalls($31)
 	lda	$2, sys_call_table
 	lda	$27, alpha_ni_syscall
 	cmpult	$0, $1, $1
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 7ef6925..de79de3 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -544,6 +544,6 @@ sys_call_table:
 	.type sys_call_table, @object
 
 /* Remember to update everything, kids.  */
-.ifne (. - sys_call_table) - (NR_SYSCALLS * 8)
+.ifne (. - sys_call_table) - (__NR_syscalls * 8)
 .err
 .endif
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 5/6] alpha: Add system call table generation support
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
                   ` (3 preceding siblings ...)
  2018-07-16 10:23 ` [PATCH 4/6] alpha: Replace NR_SYSCALLS macro from asm/unistd.h Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-07-16 10:23 ` [PATCH 6/6] alpha: uapi header and system call table file generation Firoz Khan
  2018-07-16 14:09 ` [PATCH 0/6] System call table generation support Arnd Bergmann
  6 siblings, 0 replies; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

The system call tables are in different format in all
architecture and it will be difficult to manually add or
modify the system calls in the respective files. To make
it easy by keeping a script and which'll generate the
header file and syscall table file so this change will
unify them across all architectures.

The system call table generation script is added in
syscalls directory which contain the script to generate
both uapi header file system call table generation file
and syscall.tbl file which'll be the input for the scripts.

syscall.tbl contains the list of available system calls
along with system call number and corresponding entry point.
Add a new system call in this architecture will be possible
by adding new entry in the syscall.tbl file.

Adding a new table entry consisting of:
        - System call number.
        - ABI.
        - System call name.
        - Entry point name.

syscallhdr.sh and syscalltbl.sh will generate uapi header-
unistd.h and syscall_table.h files respectively. File
syscall_table.h is included by syscall.S - the real system
call table. Both .sh files will parse the content syscall.tbl
to generate the header and table files.

ARM, s390 and x86 architecuture does have the similar support.
I leverage their implementation to come up with a generic
solution.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/alpha/kernel/syscalls/Makefile      |  37 +++
 arch/alpha/kernel/syscalls/syscall.tbl   | 450 +++++++++++++++++++++++++++++++
 arch/alpha/kernel/syscalls/syscallhdr.sh |  33 +++
 arch/alpha/kernel/syscalls/syscalltbl.sh |  28 ++
 4 files changed, 548 insertions(+)
 create mode 100644 arch/alpha/kernel/syscalls/Makefile
 create mode 100644 arch/alpha/kernel/syscalls/syscall.tbl
 create mode 100644 arch/alpha/kernel/syscalls/syscallhdr.sh
 create mode 100644 arch/alpha/kernel/syscalls/syscalltbl.sh

diff --git a/arch/alpha/kernel/syscalls/Makefile b/arch/alpha/kernel/syscalls/Makefile
new file mode 100644
index 0000000..96d82b8
--- /dev/null
+++ b/arch/alpha/kernel/syscalls/Makefile
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+out := arch/$(SRCARCH)/include/generated/asm
+uapi := arch/$(SRCARCH)/include/generated/uapi/asm
+
+_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
+	  $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
+
+syscall := $(srctree)/$(src)/syscall.tbl
+
+syshdr := $(srctree)/$(src)/syscallhdr.sh
+systbl := $(srctree)/$(src)/syscalltbl.sh
+
+quiet_cmd_syshdr = SYSHDR  $@
+      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \
+		   '$(syshdr_abi_$(basetarget))'          \
+		   '$(syshdr_pfx_$(basetarget))'          \
+		   '$(syshdr_offset_$(basetarget))'
+
+quiet_cmd_systbl = SYSTBL  $@
+      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \
+		   '$(systbl_abi_$(basetarget))'
+
+$(uapi)/unistd.h: $(syscall) $(syshdr)
+	$(call if_changed,syshdr)
+
+$(out)/syscall_table.h: $(syscall) $(systbl)
+	$(call if_changed,systbl)
+
+uapisyshdr-y			+= unistd.h
+syshdr-y			+= syscall_table.h
+
+targets	+= $(uapisyshdr-y) $(syshdr-y)
+
+PHONY += all (addprefix $(uapi)/,$(uapisyshdr-y)) $(addprefix $(out)/,$(syshdr-y))
+all: $(addprefix $(uapi)/,$(uapisyshdr-y))
+all: $(addprefix $(out)/,$(syshdr-y))
+	@:
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
new file mode 100644
index 0000000..946a8fb
--- /dev/null
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -0,0 +1,450 @@
+#
+# Linux system call numbers and entry vectors
+#
+# The format is:
+# <number> <abi> <name> <entry point>
+#
+# The abi is always common for this file.
+#
+0       common  osf_syscall                     sys_ni_syscall
+1       common  exit                            sys_exit
+2       common  fork                            alpha_fork
+3       common  read                            sys_read
+4       common  write                           sys_write
+5       common  osf_old_open                    sys_ni_syscall
+6       common  close                           sys_close
+7       common  osf_wait4                       sys_osf_wait4
+8       common  osf_old_creat                   sys_ni_syscall
+9       common  link                            sys_link
+10      common  unlink                          sys_unlink
+11      common  osf_execve                      sys_ni_syscall
+12      common  chdir                           sys_chdir
+13      common  fchdir                          sys_fchdir
+14      common  mknod                           sys_mknod
+15      common  chmod                           sys_chmod
+16      common  chown                           sys_chown
+17      common  brk                             sys_osf_brk
+18      common  osf_getfsstat                   sys_ni_syscall
+19      common  lseek                           sys_lseek
+20      common  getxpid                         sys_getxpid
+21      common  osf_mount                       sys_osf_mount
+22      common  umount                          sys_umount
+23      common  setuid                          sys_setuid
+24      common  getxuid                         sys_getxuid
+25      common  exec_with_loader                sys_ni_syscall
+26      common  ptrace                          sys_ptrace
+27      common  osf_nrecvmsg                    sys_ni_syscall
+28      common  osf_nsendmsg                    sys_ni_syscall
+29      common  osf_nrecvfrom                   sys_ni_syscall
+30      common  osf_naccept                     sys_ni_syscall
+31      common  osf_ngetpeername                sys_ni_syscall
+32      common  osf_ngetsockname                sys_ni_syscall
+33      common  access                          sys_access
+34      common  osf_chflags                     sys_ni_syscall
+35      common  osf_fchflags                    sys_ni_syscall
+36      common  sync                            sys_sync
+37      common  kill                            sys_kill
+38      common  osf_old_stat                    sys_ni_syscall
+39      common  setpgid                         sys_setpgid
+40      common  osf_old_lstat                   sys_ni_syscall
+41      common  dup                             sys_dup
+42      common  pipe                            sys_alpha_pipe
+43      common  osf_set_program_attributes      sys_osf_set_program_attributes
+44      common  osf_profil                      sys_ni_syscall
+45      common  open                            sys_open
+46      common  osf_old_sigaction               sys_ni_syscall
+47      common  getxgid                         sys_getxgid
+48      common  osf_sigprocmask                 sys_osf_sigprocmask
+49      common  osf_getlogin                    sys_ni_syscall
+50      common  osf_setlogin                    sys_ni_syscall
+51      common  acct                            sys_acct
+52      common  sigpending                      sys_sigpending
+54      common  ioctl                           sys_ioctl
+55      common  osf_reboot                      sys_ni_syscall
+56      common  osf_revoke                      sys_ni_syscall
+57      common  symlink                         sys_symlink
+58      common  readlink                        sys_readlink
+59      common  execve                          sys_execve
+60      common  umask                           sys_umask
+61      common  chroot                          sys_chroot
+62      common  osf_old_fstat                   sys_ni_syscall
+63      common  getpgrp                         sys_getpgrp
+64      common  getpagesize                     sys_getpagesize
+65      common  osf_mremap                      sys_ni_syscall
+66      common  vfork                           alpha_vfork
+67      common  stat                            sys_newstat
+68      common  lstat                           sys_newlstat
+69      common  osf_sbrk                        sys_ni_syscall
+70      common  osf_sstk                        sys_ni_syscall
+71      common  mmap                            sys_osf_mmap
+72      common  osf_old_vadvise                 sys_ni_syscall
+73      common  munmap                          sys_munmap
+74      common  mprotect                        sys_mprotect
+75      common  madvise                         sys_madvise
+76      common  vhangup                         sys_vhangup
+77      common  osf_kmodcall                    sys_ni_syscall
+78      common  osf_mincore                     sys_ni_syscall
+79      common  getgroups                       sys_getgroups
+80      common  setgroups                       sys_setgroups
+81      common  osf_old_getpgrp                 sys_ni_syscall
+82      common  setpgrp                         sys_setpgid
+83      common  osf_setitimer                   sys_osf_setitimer
+84      common  osf_old_wait                    sys_ni_syscall
+85      common  osf_table                       sys_ni_syscall
+86      common  osf_getitimer                   sys_osf_getitimer
+87      common  gethostname                     sys_gethostname
+88      common  sethostname                     sys_sethostname
+89      common  getdtablesize                   sys_getdtablesize
+90      common  dup2                            sys_dup2
+91      common  fstat                           sys_newfstat
+92      common  fcntl                           sys_fcntl
+93      common  osf_select                      sys_osf_select
+94      common  poll                            sys_poll
+95      common  fsync                           sys_fsync
+96      common  setpriority                     sys_setpriority
+97      common  socket                          sys_socket
+98      common  connect                         sys_connect
+99      common  accept                          sys_accept
+100     common  getpriority                     sys_osf_getpriority
+101     common  send                            sys_send
+102     common  recv                            sys_recv
+103     common  sigreturn                       sys_sigreturn
+104     common  bind                            sys_bind
+105     common  setsockopt                      sys_setsockopt
+106     common  listen                          sys_listen
+107     common  osf_plock                       sys_ni_syscall
+108     common  osf_old_sigvec                  sys_ni_syscall
+109     common  osf_old_sigblock                sys_ni_syscall
+110     common  osf_old_sigsetmask              sys_ni_syscall
+111     common  sigsuspend                      sys_sigsuspend
+112     common  osf_sigstack                    sys_osf_sigstack
+113     common  recvmsg                         sys_recvmsg
+114     common  sendmsg                         sys_sendmsg
+115     common  osf_old_vtrace                  sys_ni_syscall
+116     common  osf_gettimeofday                sys_osf_gettimeofday
+117     common  osf_getrusage                   sys_osf_getrusage
+118     common  getsockopt                      sys_getsockopt
+120     common  readv                           sys_osf_readv
+121     common  writev                          sys_osf_writev
+122     common  osf_settimeofday                sys_osf_settimeofday
+123     common  fchown                          sys_fchown
+124     common  fchmod                          sys_fchmod
+125     common  recvfrom                        sys_recvfrom
+126     common  setreuid                        sys_setreuid
+127     common  setregid                        sys_setregid
+128     common  rename                          sys_rename
+129     common  truncate                        sys_truncate
+130     common  ftruncate                       sys_ftruncate
+131     common  flock                           sys_flock
+132     common  setgid                          sys_setgid
+133     common  sendto                          sys_sendto
+134     common  shutdown                        sys_shutdown
+135     common  socketpair                      sys_socketpair
+136     common  mkdir                           sys_mkdir
+137     common  rmdir                           sys_rmdir
+138     common  osf_utimes                      sys_osf_utimes
+139     common  osf_old_sigreturn               sys_ni_syscall
+140     common  osf_adjtime                     sys_ni_syscall
+141     common  getpeername                     sys_getpeername
+142     common  osf_gethostid                   sys_ni_syscall
+143     common  osf_sethostid                   sys_ni_syscall
+144     common  getrlimit                       sys_getrlimit
+145     common  setrlimit                       sys_setrlimit
+146     common  osf_old_killpg                  sys_ni_syscall
+147     common  setsid                          sys_setsid
+148     common  quotactl                        sys_quotactl
+149     common  osf_oldquota                    sys_ni_syscall
+150     common  getsockname                     sys_getsockname
+153     common  osf_pid_block                   sys_ni_syscall
+154     common  osf_pid_unblock                 sys_ni_syscall
+156     common  sigaction                       sys_osf_sigaction
+157     common  osf_sigwaitprim                 sys_ni_syscall
+158     common  osf_nfssvc                      sys_ni_syscall
+159     common  osf_getdirentries               sys_osf_getdirentries
+160     common  osf_statfs                      sys_osf_statfs
+161     common  osf_fstatfs                     sys_osf_fstatfs
+163     common  osf_asynch_daemon               sys_ni_syscall
+164     common  osf_getfh                       sys_ni_syscall
+165     common  osf_getdomainname               sys_osf_getdomainname
+166     common  setdomainname                   sys_setdomainname
+169     common  osf_exportfs                    sys_ni_syscall
+181     common  osf_alt_plock                   sys_ni_syscall
+184     common  osf_getmnt                      sys_ni_syscall
+187     common  osf_alt_sigpending              sys_ni_syscall
+188     common  osf_alt_setsid                  sys_ni_syscall
+199     common  osf_swapon                      sys_swapon
+200     common  msgctl                          sys_msgctl
+201     common  msgget                          sys_msgget
+202     common  msgrcv                          sys_msgrcv
+203     common  msgsnd                          sys_msgsnd
+204     common  semctl                          sys_semctl
+205     common  semget                          sys_semget
+206     common  semop                           sys_semop
+207     common  osf_utsname                     sys_osf_utsname
+208     common  lchown                          sys_lchown
+209     common  osf_shmat                       sys_shmat
+210     common  shmctl                          sys_shmctl
+211     common  shmdt                           sys_shmdt
+212     common  shmget                          sys_shmget
+213     common  osf_mvalid                      sys_ni_syscall
+214     common  osf_getaddressconf              sys_ni_syscall
+215     common  osf_msleep                      sys_ni_syscall
+216     common  osf_mwakeup                     sys_ni_syscall
+217     common  msync                           sys_msync
+218     common  osf_signal                      sys_ni_syscall
+219     common  osf_utc_gettime                 sys_ni_syscall
+220     common  osf_utc_adjtime                 sys_ni_syscall
+222     common  osf_security                    sys_ni_syscall
+223     common  osf_kloadcall                   sys_ni_syscall
+224     common  osf_stat                        sys_osf_stat
+225     common  osf_lstat                       sys_osf_lstat
+226     common  osf_fstat                       sys_osf_fstat
+227     common  osf_statfs64                    sys_osf_statfs64
+228     common  osf_fstatfs64                   sys_osf_fstatfs64
+233     common  getpgid                         sys_getpgid
+234     common  getsid                          sys_getsid
+235     common  sigaltstack                     sys_sigaltstack
+236     common  osf_waitid                      sys_ni_syscall
+237     common  osf_priocntlset                 sys_ni_syscall
+238     common  osf_sigsendset                  sys_ni_syscall
+239     common  osf_set_speculative             sys_ni_syscall
+240     common  osf_msfs_syscall                sys_ni_syscall
+241     common  osf_sysinfo                     sys_osf_sysinfo
+242     common  osf_uadmin                      sys_ni_syscall
+243     common  osf_fuser                       sys_ni_syscall
+244     common  osf_proplist_syscall            sys_osf_proplist_syscall
+245     common  osf_ntp_adjtime                 sys_ni_syscall
+246     common  osf_ntp_gettime                 sys_ni_syscall
+247     common  osf_pathconf                    sys_ni_syscall
+248     common  osf_fpathconf                   sys_ni_syscall
+250     common  osf_uswitch                     sys_ni_syscall
+251     common  osf_usleep_thread               sys_osf_usleep_thread
+252     common  osf_audcntl                     sys_ni_syscall
+253     common  osf_audgen                      sys_ni_syscall
+254     common  sysfs                           sys_sysfs
+255     common  osf_subsys_info                 sys_ni_syscall
+256     common  osf_getsysinfo                  sys_osf_getsysinfo
+257     common  osf_setsysinfo                  sys_osf_setsysinfo
+258     common  osf_afs_syscall                 sys_ni_syscall
+259     common  osf_swapctl                     sys_ni_syscall
+260     common  osf_memcntl                     sys_ni_syscall
+261     common  osf_fdatasync                   sys_ni_syscall
+300     common  bdflush                         sys_bdflush
+301     common  sethae                          sys_sethae
+302     common  mount                           sys_mount
+303     common  old_adjtimex                    sys_old_adjtimex
+304     common  swapoff                         sys_swapoff
+305     common  getdents                        sys_getdents
+306     common  create_module                   sys_ni_syscall
+307     common  init_module                     sys_init_module
+308     common  delete_module                   sys_delete_module
+309     common  get_kernel_syms                 sys_ni_syscall
+310     common  syslog                          sys_syslog
+311     common  reboot                          sys_reboot
+312     common  clone                           alpha_clone
+313     common  uselib                          sys_uselib
+314     common  mlock                           sys_mlock
+315     common  munlock                         sys_munlock
+316     common  mlockall                        sys_mlockall
+317     common  munlockall                      sys_munlockall
+318     common  sysinfo                         sys_sysinfo
+319     common  _sysctl                         sys_sysctl
+321     common  oldumount                       sys_oldumount
+322     common  swapon                          sys_swapon
+323     common  times                           sys_times
+324     common  personality                     sys_personality
+325     common  setfsuid                        sys_setfsuid
+326     common  setfsgid                        sys_setfsgid
+327     common  ustat                           sys_ustat
+328     common  statfs                          sys_statfs
+329     common  fstatfs                         sys_fstatfs
+330     common  sched_setparam                  sys_sched_setparam
+331     common  sched_getparam                  sys_sched_getparam
+332     common  sched_setscheduler              sys_sched_setscheduler
+333     common  sched_getscheduler              sys_sched_getscheduler
+334     common  sched_yield                     sys_sched_yield
+335     common  sched_get_priority_max          sys_sched_get_priority_max
+336     common  sched_get_priority_min          sys_sched_get_priority_min
+337     common  sched_rr_get_interval           sys_sched_rr_get_interval
+338     common  afs_syscall                     sys_ni_syscall
+339     common  uname                           sys_newuname
+340     common  nanosleep                       sys_nanosleep
+341     common  mremap                          sys_mremap
+342     common  nfsservctl                      sys_ni_syscall
+343     common  setresuid                       sys_setresuid
+344     common  getresuid                       sys_getresuid
+345     common  pciconfig_read                  sys_pciconfig_read
+346     common  pciconfig_write                 sys_pciconfig_write
+347     common  query_module                    sys_ni_syscall
+348     common  prctl                           sys_prctl
+349     common  pread64                         sys_pread64
+350     common  pwrite64                        sys_pwrite64
+351     common  rt_sigreturn                    sys_rt_sigreturn
+352     common  rt_sigaction                    sys_rt_sigaction
+353     common  rt_sigprocmask                  sys_rt_sigprocmask
+354     common  rt_sigpending                   sys_rt_sigpending
+355     common  rt_sigtimedwait                 sys_rt_sigtimedwait
+356     common  rt_sigqueueinfo                 sys_rt_sigqueueinfo
+357     common  rt_sigsuspend                   sys_rt_sigsuspend
+358     common  select                          sys_select
+359     common  gettimeofday                    sys_gettimeofday
+360     common  settimeofday                    sys_settimeofday
+361     common  getitimer                       sys_getitimer
+362     common  setitimer                       sys_setitimer
+363     common  utimes                          sys_utimes
+364     common  getrusage                       sys_getrusage
+365     common  wait4                           sys_wait4
+366     common  adjtimex                        sys_adjtimex
+367     common  getcwd                          sys_getcwd
+368     common  capget                          sys_capget
+369     common  capset                          sys_capset
+370     common  sendfile                        sys_sendfile64
+371     common  setresgid                       sys_setresgid
+372     common  getresgid                       sys_getresgid
+373     common  dipc                            sys_ni_syscall
+374     common  pivot_root                      sys_pivot_root
+375     common  mincore                         sys_mincore
+376     common  pciconfig_iobase                sys_pciconfig_iobase
+377     common  getdents64                      sys_getdents64
+378     common  gettid                          sys_gettid
+379     common  readahead                       sys_readahead
+381     common  tkill                           sys_tkill
+382     common  setxattr                        sys_setxattr
+383     common  lsetxattr                       sys_lsetxattr
+384     common  fsetxattr                       sys_fsetxattr
+385     common  getxattr                        sys_getxattr
+386     common  lgetxattr                       sys_lgetxattr
+387     common  fgetxattr                       sys_fgetxattr
+388     common  listxattr                       sys_listxattr
+389     common  llistxattr                      sys_llistxattr
+390     common  flistxattr                      sys_flistxattr
+391     common  removexattr                     sys_removexattr
+392     common  lremovexattr                    sys_lremovexattr
+393     common  fremovexattr                    sys_fremovexattr
+394     common  futex                           sys_futex
+395     common  sched_setaffinity               sys_sched_setaffinity
+396     common  sched_getaffinity               sys_sched_getaffinity
+397     common  tuxcall                         sys_ni_syscall
+398     common  io_setup                        sys_io_setup
+399     common  io_destroy                      sys_io_destroy
+400     common  io_getevents                    sys_io_getevents
+401     common  io_submit                       sys_io_submit
+402     common  io_cancel                       sys_io_cancel
+405     common  exit_group                      sys_exit_group
+406     common  lookup_dcookie                  sys_lookup_dcookie
+407     common  epoll_create                    sys_epoll_create
+408     common  epoll_ctl                       sys_epoll_ctl
+409     common  epoll_wait                      sys_epoll_wait
+410     common  remap_file_pages                sys_remap_file_pages
+411     common  set_tid_address                 sys_set_tid_address
+412     common  restart_syscall                 sys_restart_syscall
+413     common  fadvise64                       sys_fadvise64
+414     common  timer_create                    sys_timer_create
+415     common  timer_settime                   sys_timer_settime
+416     common  timer_gettime                   sys_timer_gettime
+417     common  timer_getoverrun                sys_timer_getoverrun
+418     common  timer_delete                    sys_timer_delete
+419     common  clock_settime                   sys_clock_settime
+420     common  clock_gettime                   sys_clock_gettime
+421     common  clock_getres                    sys_clock_getres
+422     common  clock_nanosleep                 sys_clock_nanosleep
+423     common  semtimedop                      sys_semtimedop
+424     common  tgkill                          sys_tgkill
+425     common  stat64                          sys_stat64
+426     common  lstat64                         sys_lstat64
+427     common  fstat64                         sys_fstat64
+428     common  vserver                         sys_ni_syscall
+429     common  mbind                           sys_ni_syscall
+430     common  get_mempolicy                   sys_ni_syscall
+431     common  set_mempolicy                   sys_ni_syscall
+432     common  mq_open                         sys_mq_open
+433     common  mq_unlink                       sys_mq_unlink
+434     common  mq_timedsend                    sys_mq_timedsend
+435     common  mq_timedreceive                 sys_mq_timedreceive
+436     common  mq_notify                       sys_mq_notify
+437     common  mq_getsetattr                   sys_mq_getsetattr
+438     common  waitid                          sys_waitid
+439     common  add_key                         sys_add_key
+440     common  request_key                     sys_request_key
+441     common  keyctl                          sys_keyctl
+442     common  ioprio_set                      sys_ioprio_set
+443     common  ioprio_get                      sys_ioprio_get
+444     common  inotify_init                    sys_inotify_init
+445     common  inotify_add_watch               sys_inotify_add_watch
+446     common  inotify_rm_watch                sys_inotify_rm_watch
+447     common  fdatasync                       sys_fdatasync
+448     common  kexec_load                      sys_kexec_load
+449     common  migrate_pages                   sys_migrate_pages
+450     common  openat                          sys_openat
+451     common  mkdirat                         sys_mkdirat
+452     common  mknodat                         sys_mknodat
+453     common  fchownat                        sys_fchownat
+454     common  futimesat                       sys_futimesat
+455     common  fstatat64                       sys_fstatat64
+456     common  unlinkat                        sys_unlinkat
+457     common  renameat                        sys_renameat
+458     common  linkat                          sys_linkat
+459     common  symlinkat                       sys_symlinkat
+460     common  readlinkat                      sys_readlinkat
+461     common  fchmodat                        sys_fchmodat
+462     common  faccessat                       sys_faccessat
+463     common  pselect6                        sys_pselect6
+464     common  ppoll                           sys_ppoll
+465     common  unshare                         sys_unshare
+466     common  set_robust_list                 sys_set_robust_list
+467     common  get_robust_list                 sys_get_robust_list
+468     common  splice                          sys_splice
+469     common  sync_file_range                 sys_sync_file_range
+470     common  tee                             sys_tee
+471     common  vmsplice                        sys_vmsplice
+472     common  move_pages                      sys_move_pages
+473     common  getcpu                          sys_getcpu
+474     common  epoll_pwait                     sys_epoll_pwait
+475     common  utimensat                       sys_utimensat
+476     common  signalfd                        sys_signalfd
+477     common  timerfd                         sys_ni_syscall
+478     common  eventfd                         sys_eventfd
+479     common  recvmmsg                        sys_recvmmsg
+480     common  fallocate                       sys_fallocate
+481     common  timerfd_create                  sys_timerfd_create
+482     common  timerfd_settime                 sys_timerfd_settime
+483     common  timerfd_gettime                 sys_timerfd_gettime
+484     common  signalfd4                       sys_signalfd4
+485     common  eventfd2                        sys_eventfd2
+486     common  epoll_create1                   sys_epoll_create1
+487     common  dup3                            sys_dup3
+488     common  pipe2                           sys_pipe2
+489     common  inotify_init1                   sys_inotify_init1
+490     common  preadv                          sys_preadv
+491     common  pwritev                         sys_pwritev
+492     common  rt_tgsigqueueinfo               sys_rt_tgsigqueueinfo
+493     common  perf_event_open                 sys_perf_event_open
+494     common  fanotify_init                   sys_fanotify_init
+495     common  fanotify_mark                   sys_fanotify_mark
+496     common  prlimit64                       sys_prlimit64
+497     common  name_to_handle_at               sys_name_to_handle_at
+498     common  open_by_handle_at               sys_open_by_handle_at
+499     common  clock_adjtime                   sys_clock_adjtime
+500     common  syncfs                          sys_syncfs
+501     common  setns                           sys_setns
+502     common  accept4                         sys_accept4
+503     common  sendmmsg                        sys_sendmmsg
+504     common  process_vm_readv                sys_process_vm_readv
+505     common  process_vm_writev               sys_process_vm_writev
+506     common  kcmp                            sys_kcmp
+507     common  finit_module                    sys_finit_module
+508     common  sched_setattr                   sys_sched_setattr
+509     common  sched_getattr                   sys_sched_getattr
+510     common  renameat2                       sys_renameat2
+511     common  getrandom                       sys_getrandom
+512     common  memfd_create                    sys_memfd_create
+513     common  execveat                        sys_execveat
+514     common  seccomp                         sys_seccomp
+515     common  bpf                             sys_bpf
+516     common  userfaultfd                     sys_userfaultfd
+517     common  membarrier                      sys_membarrier
+518     common  mlock2                          sys_mlock2
+519     common  copy_file_range                 sys_copy_file_range
+520     common  preadv2                         sys_preadv2
+521     common  pwritev2                        sys_pwritev2
+522     common  statx                           sys_statx
diff --git a/arch/alpha/kernel/syscalls/syscallhdr.sh b/arch/alpha/kernel/syscalls/syscallhdr.sh
new file mode 100644
index 0000000..e71b902
--- /dev/null
+++ b/arch/alpha/kernel/syscalls/syscallhdr.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+in="$1"
+out="$2"
+my_abis=`echo "($3)" | tr ',' '|'`
+prefix="$4"
+offset="$5"
+
+fileguard=_UAPI_ALPHA_`basename "$out" | sed \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+    -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
+    echo "#ifndef ${fileguard}"
+    echo "#define ${fileguard}"
+    echo ""
+
+    nxt=0
+    while read nr abi name entry ; do
+	if [ -z "$offset" ]; then
+	    echo -e "#define __NR_${prefix}${name}\t$nr"
+	else
+	    echo -e "#define __NR_${prefix}${name}\t($offset + $nr)"
+	fi
+	nxt=$nr
+	let nxt=nxt+1
+    done
+
+    echo ""
+    echo -e "#define __NR_syscalls\t$nxt"
+    echo ""
+    echo "#endif /* ${fileguard} */"
+) > "$out"
diff --git a/arch/alpha/kernel/syscalls/syscalltbl.sh b/arch/alpha/kernel/syscalls/syscalltbl.sh
new file mode 100644
index 0000000..4f5cebd
--- /dev/null
+++ b/arch/alpha/kernel/syscalls/syscalltbl.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+in="$1"
+out="$2"
+abi="$3"
+
+emit() {
+    nxt="$1"
+    nr="$2"
+    entry="$3"
+
+    while [ $nxt -lt $nr ]; do
+	echo "__SYSCALL($nxt, sys_ni_syscall, )"
+        let nxt=nxt+1
+    done
+
+    echo "__SYSCALL($nr, $entry, )"
+}
+
+grep '^[0-9]' "$in" | sort -n | (
+    nxt=0
+    while read nr abi name entry ; do
+	emit $nxt $nr $entry
+	nxt=$nr
+	let nxt=nxt+1
+    done
+) > "$out"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 6/6] alpha: uapi header and system call table file generation
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
                   ` (4 preceding siblings ...)
  2018-07-16 10:23 ` [PATCH 5/6] alpha: Add system call table generation support Firoz Khan
@ 2018-07-16 10:23 ` Firoz Khan
  2018-07-16 16:23     ` kbuild test robot
  2018-07-16 14:09 ` [PATCH 0/6] System call table generation support Arnd Bergmann
  6 siblings, 1 reply; 26+ messages in thread
From: Firoz Khan @ 2018-07-16 10:23 UTC (permalink / raw)
  To: linux-alpha, rth, ink, mattst88
  Cc: y2038, linux-kernel, linux-arch, arnd, deepa.kernel, Firoz Khan

This change will generate unistd.h and syscall_table.h files by the
syscall table generation script invoked by arch/alpha/Makefile and
the generated files against the removed files will be identical.

The generated uapi header file will be included in uapi/asm/unistd.h
and generated system call table support file will be included by
alpha/kernel/syscall.S file.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/alpha/Makefile                  |   3 +
 arch/alpha/include/asm/Kbuild        |   3 +-
 arch/alpha/include/uapi/asm/Kbuild   |   2 +
 arch/alpha/include/uapi/asm/unistd.h | 486 -------------------------------
 arch/alpha/kernel/Makefile           |   2 +-
 arch/alpha/kernel/syscall.S          |  20 ++
 arch/alpha/kernel/systbls.S          | 549 -----------------------------------
 7 files changed, 28 insertions(+), 1037 deletions(-)
 delete mode 100644 arch/alpha/include/uapi/asm/unistd.h
 create mode 100644 arch/alpha/kernel/syscall.S
 delete mode 100644 arch/alpha/kernel/systbls.S

diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index c5ec8c0..12dee59 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -61,6 +61,9 @@ bootimage bootpfile bootpzfile: vmlinux
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
 
+archheaders:
+	$(Q)$(MAKE) $(build)=arch/alpha/kernel/syscalls all
+
 define archhelp
   echo '* boot		- Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
   echo '  bootimage	- SRM bootable image (arch/alpha/boot/bootimage)'
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 0580cb8..d8e09eb 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-
 generic-y += compat.h
 generic-y += exec.h
 generic-y += export.h
@@ -13,3 +12,5 @@ generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += current.h
 generic-y += kprobes.h
+
+generated-y += syscall_table.h
\ No newline at end of file
diff --git a/arch/alpha/include/uapi/asm/Kbuild b/arch/alpha/include/uapi/asm/Kbuild
index 1a5b753..3c1036f 100644
--- a/arch/alpha/include/uapi/asm/Kbuild
+++ b/arch/alpha/include/uapi/asm/Kbuild
@@ -7,3 +7,5 @@ generic-y += msgbuf.h
 generic-y += poll.h
 generic-y += sembuf.h
 generic-y += shmbuf.h
+
+generated-y += unistd.h
\ No newline at end of file
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
deleted file mode 100644
index 5d4b51e..0000000
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ /dev/null
@@ -1,486 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _UAPI_ALPHA_UNISTD_H
-#define _UAPI_ALPHA_UNISTD_H
-
-#define __NR_osf_syscall	  0	/* not implemented */
-#define __NR_exit		  1
-#define __NR_fork		  2
-#define __NR_read		  3
-#define __NR_write		  4
-#define __NR_osf_old_open	  5	/* not implemented */
-#define __NR_close		  6
-#define __NR_osf_wait4		  7
-#define __NR_osf_old_creat	  8	/* not implemented */
-#define __NR_link		  9
-#define __NR_unlink		 10
-#define __NR_osf_execve		 11	/* not implemented */
-#define __NR_chdir		 12
-#define __NR_fchdir		 13
-#define __NR_mknod		 14
-#define __NR_chmod		 15
-#define __NR_chown		 16
-#define __NR_brk		 17
-#define __NR_osf_getfsstat	 18	/* not implemented */
-#define __NR_lseek		 19
-#define __NR_getxpid		 20
-#define __NR_osf_mount		 21
-#define __NR_umount		 22
-#define __NR_setuid		 23
-#define __NR_getxuid		 24
-#define __NR_exec_with_loader	 25	/* not implemented */
-#define __NR_ptrace		 26
-#define __NR_osf_nrecvmsg	 27	/* not implemented */
-#define __NR_osf_nsendmsg	 28	/* not implemented */
-#define __NR_osf_nrecvfrom	 29	/* not implemented */
-#define __NR_osf_naccept	 30	/* not implemented */
-#define __NR_osf_ngetpeername	 31	/* not implemented */
-#define __NR_osf_ngetsockname	 32	/* not implemented */
-#define __NR_access		 33
-#define __NR_osf_chflags	 34	/* not implemented */
-#define __NR_osf_fchflags	 35	/* not implemented */
-#define __NR_sync		 36
-#define __NR_kill		 37
-#define __NR_osf_old_stat	 38	/* not implemented */
-#define __NR_setpgid		 39
-#define __NR_osf_old_lstat	 40	/* not implemented */
-#define __NR_dup		 41
-#define __NR_pipe		 42
-#define __NR_osf_set_program_attributes	43
-#define __NR_osf_profil		 44	/* not implemented */
-#define __NR_open		 45
-#define __NR_osf_old_sigaction	 46	/* not implemented */
-#define __NR_getxgid		 47
-#define __NR_osf_sigprocmask	 48
-#define __NR_osf_getlogin	 49	/* not implemented */
-#define __NR_osf_setlogin	 50	/* not implemented */
-#define __NR_acct		 51
-#define __NR_sigpending		 52
-
-#define __NR_ioctl		 54
-#define __NR_osf_reboot		 55	/* not implemented */
-#define __NR_osf_revoke		 56	/* not implemented */
-#define __NR_symlink		 57
-#define __NR_readlink		 58
-#define __NR_execve		 59
-#define __NR_umask		 60
-#define __NR_chroot		 61
-#define __NR_osf_old_fstat	 62	/* not implemented */
-#define __NR_getpgrp		 63
-#define __NR_getpagesize	 64
-#define __NR_osf_mremap		 65	/* not implemented */
-#define __NR_vfork		 66
-#define __NR_stat		 67
-#define __NR_lstat		 68
-#define __NR_osf_sbrk		 69	/* not implemented */
-#define __NR_osf_sstk		 70	/* not implemented */
-#define __NR_mmap		 71	/* OSF/1 mmap is superset of Linux */
-#define __NR_osf_old_vadvise	 72	/* not implemented */
-#define __NR_munmap		 73
-#define __NR_mprotect		 74
-#define __NR_madvise		 75
-#define __NR_vhangup		 76
-#define __NR_osf_kmodcall	 77	/* not implemented */
-#define __NR_osf_mincore	 78	/* not implemented */
-#define __NR_getgroups		 79
-#define __NR_setgroups		 80
-#define __NR_osf_old_getpgrp	 81	/* not implemented */
-#define __NR_setpgrp		 82	/* BSD alias for setpgid */
-#define __NR_osf_setitimer	 83
-#define __NR_osf_old_wait	 84	/* not implemented */
-#define __NR_osf_table		 85	/* not implemented */
-#define __NR_osf_getitimer	 86
-#define __NR_gethostname	 87
-#define __NR_sethostname	 88
-#define __NR_getdtablesize	 89
-#define __NR_dup2		 90
-#define __NR_fstat		 91
-#define __NR_fcntl		 92
-#define __NR_osf_select		 93
-#define __NR_poll		 94
-#define __NR_fsync		 95
-#define __NR_setpriority	 96
-#define __NR_socket		 97
-#define __NR_connect		 98
-#define __NR_accept		 99
-#define __NR_getpriority	100
-#define __NR_send		101
-#define __NR_recv		102
-#define __NR_sigreturn		103
-#define __NR_bind		104
-#define __NR_setsockopt		105
-#define __NR_listen		106
-#define __NR_osf_plock		107	/* not implemented */
-#define __NR_osf_old_sigvec	108	/* not implemented */
-#define __NR_osf_old_sigblock	109	/* not implemented */
-#define __NR_osf_old_sigsetmask	110	/* not implemented */
-#define __NR_sigsuspend		111
-#define __NR_osf_sigstack	112
-#define __NR_recvmsg		113
-#define __NR_sendmsg		114
-#define __NR_osf_old_vtrace	115	/* not implemented */
-#define __NR_osf_gettimeofday	116
-#define __NR_osf_getrusage	117
-#define __NR_getsockopt		118
-
-#define __NR_readv		120
-#define __NR_writev		121
-#define __NR_osf_settimeofday	122
-#define __NR_fchown		123
-#define __NR_fchmod		124
-#define __NR_recvfrom		125
-#define __NR_setreuid		126
-#define __NR_setregid		127
-#define __NR_rename		128
-#define __NR_truncate		129
-#define __NR_ftruncate		130
-#define __NR_flock		131
-#define __NR_setgid		132
-#define __NR_sendto		133
-#define __NR_shutdown		134
-#define __NR_socketpair		135
-#define __NR_mkdir		136
-#define __NR_rmdir		137
-#define __NR_osf_utimes		138
-#define __NR_osf_old_sigreturn	139	/* not implemented */
-#define __NR_osf_adjtime	140	/* not implemented */
-#define __NR_getpeername	141
-#define __NR_osf_gethostid	142	/* not implemented */
-#define __NR_osf_sethostid	143	/* not implemented */
-#define __NR_getrlimit		144
-#define __NR_setrlimit		145
-#define __NR_osf_old_killpg	146	/* not implemented */
-#define __NR_setsid		147
-#define __NR_quotactl		148
-#define __NR_osf_oldquota	149	/* not implemented */
-#define __NR_getsockname	150
-
-#define __NR_osf_pid_block	153	/* not implemented */
-#define __NR_osf_pid_unblock	154	/* not implemented */
-
-#define __NR_sigaction		156
-#define __NR_osf_sigwaitprim	157	/* not implemented */
-#define __NR_osf_nfssvc		158	/* not implemented */
-#define __NR_osf_getdirentries	159
-#define __NR_osf_statfs		160
-#define __NR_osf_fstatfs	161
-
-#define __NR_osf_asynch_daemon	163	/* not implemented */
-#define __NR_osf_getfh		164	/* not implemented */	
-#define __NR_osf_getdomainname	165
-#define __NR_setdomainname	166
-
-#define __NR_osf_exportfs	169	/* not implemented */
-
-#define __NR_osf_alt_plock	181	/* not implemented */
-
-#define __NR_osf_getmnt		184	/* not implemented */
-
-#define __NR_osf_alt_sigpending	187	/* not implemented */
-#define __NR_osf_alt_setsid	188	/* not implemented */
-
-#define __NR_osf_swapon		199
-#define __NR_msgctl		200
-#define __NR_msgget		201
-#define __NR_msgrcv		202
-#define __NR_msgsnd		203
-#define __NR_semctl		204
-#define __NR_semget		205
-#define __NR_semop		206
-#define __NR_osf_utsname	207
-#define __NR_lchown		208
-#define __NR_osf_shmat		209
-#define __NR_shmctl		210
-#define __NR_shmdt		211
-#define __NR_shmget		212
-#define __NR_osf_mvalid		213	/* not implemented */
-#define __NR_osf_getaddressconf	214	/* not implemented */
-#define __NR_osf_msleep		215	/* not implemented */
-#define __NR_osf_mwakeup	216	/* not implemented */
-#define __NR_msync		217
-#define __NR_osf_signal		218	/* not implemented */
-#define __NR_osf_utc_gettime	219	/* not implemented */
-#define __NR_osf_utc_adjtime	220	/* not implemented */
-
-#define __NR_osf_security	222	/* not implemented */
-#define __NR_osf_kloadcall	223	/* not implemented */
-
-#define __NR_osf_stat		224
-#define __NR_osf_lstat		225
-#define __NR_osf_fstat		226
-#define __NR_osf_statfs64	227
-#define __NR_osf_fstatfs64	228
-
-#define __NR_getpgid		233
-#define __NR_getsid		234
-#define __NR_sigaltstack	235
-#define __NR_osf_waitid		236	/* not implemented */
-#define __NR_osf_priocntlset	237	/* not implemented */
-#define __NR_osf_sigsendset	238	/* not implemented */
-#define __NR_osf_set_speculative	239	/* not implemented */
-#define __NR_osf_msfs_syscall	240	/* not implemented */
-#define __NR_osf_sysinfo	241
-#define __NR_osf_uadmin		242	/* not implemented */
-#define __NR_osf_fuser		243	/* not implemented */
-#define __NR_osf_proplist_syscall    244
-#define __NR_osf_ntp_adjtime	245	/* not implemented */
-#define __NR_osf_ntp_gettime	246	/* not implemented */
-#define __NR_osf_pathconf	247	/* not implemented */
-#define __NR_osf_fpathconf	248	/* not implemented */
-
-#define __NR_osf_uswitch	250	/* not implemented */
-#define __NR_osf_usleep_thread	251
-#define __NR_osf_audcntl	252	/* not implemented */
-#define __NR_osf_audgen		253	/* not implemented */
-#define __NR_sysfs		254
-#define __NR_osf_subsys_info	255	/* not implemented */
-#define __NR_osf_getsysinfo	256
-#define __NR_osf_setsysinfo	257
-#define __NR_osf_afs_syscall	258	/* not implemented */
-#define __NR_osf_swapctl	259	/* not implemented */
-#define __NR_osf_memcntl	260	/* not implemented */
-#define __NR_osf_fdatasync	261	/* not implemented */
-
-/*
- * Ignore legacy syscalls that we don't use.
- */
-#define __IGNORE_alarm
-#define __IGNORE_creat
-#define __IGNORE_getegid
-#define __IGNORE_geteuid
-#define __IGNORE_getgid
-#define __IGNORE_getpid
-#define __IGNORE_getppid
-#define __IGNORE_getuid
-#define __IGNORE_pause
-#define __IGNORE_time
-#define __IGNORE_utime
-#define __IGNORE_umount2
-
-/*
- * Linux-specific system calls begin at 300
- */
-#define __NR_bdflush		300
-#define __NR_sethae		301
-#define __NR_mount		302
-#define __NR_old_adjtimex	303
-#define __NR_swapoff		304
-#define __NR_getdents		305
-#define __NR_create_module	306
-#define __NR_init_module	307
-#define __NR_delete_module	308
-#define __NR_get_kernel_syms	309
-#define __NR_syslog		310
-#define __NR_reboot		311
-#define __NR_clone		312
-#define __NR_uselib		313
-#define __NR_mlock		314
-#define __NR_munlock		315
-#define __NR_mlockall		316
-#define __NR_munlockall		317
-#define __NR_sysinfo		318
-#define __NR__sysctl		319
-/* 320 was sys_idle.  */
-#define __NR_oldumount		321
-#define __NR_swapon		322
-#define __NR_times		323
-#define __NR_personality	324
-#define __NR_setfsuid		325
-#define __NR_setfsgid		326
-#define __NR_ustat		327
-#define __NR_statfs		328
-#define __NR_fstatfs		329
-#define __NR_sched_setparam		330
-#define __NR_sched_getparam		331
-#define __NR_sched_setscheduler		332
-#define __NR_sched_getscheduler		333
-#define __NR_sched_yield		334
-#define __NR_sched_get_priority_max	335
-#define __NR_sched_get_priority_min	336
-#define __NR_sched_rr_get_interval	337
-#define __NR_afs_syscall		338
-#define __NR_uname			339
-#define __NR_nanosleep			340
-#define __NR_mremap			341
-#define __NR_nfsservctl			342
-#define __NR_setresuid			343
-#define __NR_getresuid			344
-#define __NR_pciconfig_read		345
-#define __NR_pciconfig_write		346
-#define __NR_query_module		347
-#define __NR_prctl			348
-#define __NR_pread64			349
-#define __NR_pwrite64			350
-#define __NR_rt_sigreturn		351
-#define __NR_rt_sigaction		352
-#define __NR_rt_sigprocmask		353
-#define __NR_rt_sigpending		354
-#define __NR_rt_sigtimedwait		355
-#define __NR_rt_sigqueueinfo		356
-#define __NR_rt_sigsuspend		357
-#define __NR_select			358
-#define __NR_gettimeofday		359
-#define __NR_settimeofday		360
-#define __NR_getitimer			361
-#define __NR_setitimer			362
-#define __NR_utimes			363
-#define __NR_getrusage			364
-#define __NR_wait4			365
-#define __NR_adjtimex			366
-#define __NR_getcwd			367
-#define __NR_capget			368
-#define __NR_capset			369
-#define __NR_sendfile			370
-#define __NR_setresgid			371
-#define __NR_getresgid			372
-#define __NR_dipc			373
-#define __NR_pivot_root			374
-#define __NR_mincore			375
-#define __NR_pciconfig_iobase		376
-#define __NR_getdents64			377
-#define __NR_gettid			378
-#define __NR_readahead			379
-/* 380 is unused */
-#define __NR_tkill			381
-#define __NR_setxattr			382
-#define __NR_lsetxattr			383
-#define __NR_fsetxattr			384
-#define __NR_getxattr			385
-#define __NR_lgetxattr			386
-#define __NR_fgetxattr			387
-#define __NR_listxattr			388
-#define __NR_llistxattr			389
-#define __NR_flistxattr			390
-#define __NR_removexattr		391
-#define __NR_lremovexattr		392
-#define __NR_fremovexattr		393
-#define __NR_futex			394
-#define __NR_sched_setaffinity		395     
-#define __NR_sched_getaffinity		396
-#define __NR_tuxcall			397
-#define __NR_io_setup			398
-#define __NR_io_destroy			399
-#define __NR_io_getevents		400
-#define __NR_io_submit			401
-#define __NR_io_cancel			402
-#define __NR_exit_group			405
-#define __NR_lookup_dcookie		406
-#define __NR_epoll_create		407
-#define __NR_epoll_ctl			408
-#define __NR_epoll_wait			409
-#define __NR_remap_file_pages		410
-#define __NR_set_tid_address		411
-#define __NR_restart_syscall		412
-#define __NR_fadvise64			413
-#define __NR_timer_create		414
-#define __NR_timer_settime		415
-#define __NR_timer_gettime		416
-#define __NR_timer_getoverrun		417
-#define __NR_timer_delete		418
-#define __NR_clock_settime		419
-#define __NR_clock_gettime		420
-#define __NR_clock_getres		421
-#define __NR_clock_nanosleep		422
-#define __NR_semtimedop			423
-#define __NR_tgkill			424
-#define __NR_stat64			425
-#define __NR_lstat64			426
-#define __NR_fstat64			427
-#define __NR_vserver			428
-#define __NR_mbind			429
-#define __NR_get_mempolicy		430
-#define __NR_set_mempolicy		431
-#define __NR_mq_open			432
-#define __NR_mq_unlink			433
-#define __NR_mq_timedsend		434
-#define __NR_mq_timedreceive		435
-#define __NR_mq_notify			436
-#define __NR_mq_getsetattr		437
-#define __NR_waitid			438
-#define __NR_add_key			439
-#define __NR_request_key		440
-#define __NR_keyctl			441
-#define __NR_ioprio_set			442
-#define __NR_ioprio_get			443
-#define __NR_inotify_init		444
-#define __NR_inotify_add_watch		445
-#define __NR_inotify_rm_watch		446
-#define __NR_fdatasync			447
-#define __NR_kexec_load			448
-#define __NR_migrate_pages		449
-#define __NR_openat			450
-#define __NR_mkdirat			451
-#define __NR_mknodat			452
-#define __NR_fchownat			453
-#define __NR_futimesat			454
-#define __NR_fstatat64			455
-#define __NR_unlinkat			456
-#define __NR_renameat			457
-#define __NR_linkat			458
-#define __NR_symlinkat			459
-#define __NR_readlinkat			460
-#define __NR_fchmodat			461
-#define __NR_faccessat			462
-#define __NR_pselect6			463
-#define __NR_ppoll			464
-#define __NR_unshare			465
-#define __NR_set_robust_list		466
-#define __NR_get_robust_list		467
-#define __NR_splice			468
-#define __NR_sync_file_range		469
-#define __NR_tee			470
-#define __NR_vmsplice			471
-#define __NR_move_pages			472
-#define __NR_getcpu			473
-#define __NR_epoll_pwait		474
-#define __NR_utimensat			475
-#define __NR_signalfd			476
-#define __NR_timerfd			477
-#define __NR_eventfd			478
-#define __NR_recvmmsg			479
-#define __NR_fallocate			480
-#define __NR_timerfd_create		481
-#define __NR_timerfd_settime		482
-#define __NR_timerfd_gettime		483
-#define __NR_signalfd4			484
-#define __NR_eventfd2			485
-#define __NR_epoll_create1		486
-#define __NR_dup3			487
-#define __NR_pipe2			488
-#define __NR_inotify_init1		489
-#define __NR_preadv			490
-#define __NR_pwritev			491
-#define __NR_rt_tgsigqueueinfo		492
-#define __NR_perf_event_open		493
-#define __NR_fanotify_init		494
-#define __NR_fanotify_mark		495
-#define __NR_prlimit64			496
-#define __NR_name_to_handle_at		497
-#define __NR_open_by_handle_at		498
-#define __NR_clock_adjtime		499
-#define __NR_syncfs			500
-#define __NR_setns			501
-#define __NR_accept4			502
-#define __NR_sendmmsg			503
-#define __NR_process_vm_readv		504
-#define __NR_process_vm_writev		505
-#define __NR_kcmp			506
-#define __NR_finit_module		507
-#define __NR_sched_setattr		508
-#define __NR_sched_getattr		509
-#define __NR_renameat2			510
-#define __NR_getrandom			511
-#define __NR_memfd_create		512
-#define __NR_execveat			513
-#define __NR_seccomp			514
-#define __NR_bpf			515
-#define __NR_userfaultfd		516
-#define __NR_membarrier			517
-#define __NR_mlock2			518
-#define __NR_copy_file_range		519
-#define __NR_preadv2			520
-#define __NR_pwritev2			521
-#define __NR_statx			522
-
-#define __NR_syscalls                   523
-
-#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 5a74581..75cfef9 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -9,7 +9,7 @@ ccflags-y	:= -Wno-sign-compare
 
 obj-y    := entry.o traps.o process.o osf_sys.o irq.o \
 	    irq_alpha.o signal.o setup.o ptrace.o time.o \
-	    systbls.o err_common.o io.o bugs.o
+	    syscall.o err_common.o io.o bugs.o
 
 obj-$(CONFIG_VGA_HOSE)	+= console.o
 obj-$(CONFIG_SMP)	+= smp.o
diff --git a/arch/alpha/kernel/syscall.S b/arch/alpha/kernel/syscall.S
new file mode 100644
index 0000000..eec54e4
--- /dev/null
+++ b/arch/alpha/kernel/syscall.S
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <asm/unistd.h>
+
+#define __SYSCALL(nr, entry, nargs) .quad entry
+
+#define sys_ni_syscall alpha_ni_syscall
+
+.data
+.align 3
+.globl sys_call_table
+sys_call_table:
+#include <asm/syscall_table.h>
+
+.size sys_call_table, . - sys_call_table
+.type sys_call_table, @object
+
+.ifne (. - sys_call_table) - (__NR_syscalls * 8)
+.err
+.endif
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
deleted file mode 100644
index de79de3..0000000
--- a/arch/alpha/kernel/systbls.S
+++ /dev/null
@@ -1,549 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * arch/alpha/kernel/systbls.S
- *
- * The system call table. 
- */
-
-#include <asm/unistd.h>
-
-#define sys_ni_syscall alpha_ni_syscall
-
-	.data
-	.align 3
-	.globl sys_call_table
-sys_call_table:
-	.quad sys_ni_syscall			/* 0 */
-	.quad sys_exit
-	.quad alpha_fork
-	.quad sys_read
-	.quad sys_write
-	.quad sys_ni_syscall			/* 5 */
-	.quad sys_close
-	.quad sys_osf_wait4
-	.quad sys_ni_syscall
-	.quad sys_link
-	.quad sys_unlink			/* 10 */
-	.quad sys_ni_syscall
-	.quad sys_chdir
-	.quad sys_fchdir
-	.quad sys_mknod
-	.quad sys_chmod				/* 15 */
-	.quad sys_chown
-	.quad sys_osf_brk
-	.quad sys_ni_syscall
-	.quad sys_lseek
-	.quad sys_getxpid			/* 20 */
-	.quad sys_osf_mount
-	.quad sys_umount
-	.quad sys_setuid
-	.quad sys_getxuid
-	.quad sys_ni_syscall			/* 25 */
-	.quad sys_ptrace
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 30 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_access
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 35 */
-	.quad sys_sync
-	.quad sys_kill
-	.quad sys_ni_syscall
-	.quad sys_setpgid
-	.quad sys_ni_syscall			/* 40 */
-	.quad sys_dup
-	.quad sys_alpha_pipe
-	.quad sys_osf_set_program_attributes
-	.quad sys_ni_syscall
-	.quad sys_open				/* 45 */
-	.quad sys_ni_syscall
-	.quad sys_getxgid
-	.quad sys_osf_sigprocmask
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 50 */
-	.quad sys_acct
-	.quad sys_sigpending
-	.quad sys_ni_syscall
-	.quad sys_ioctl
-	.quad sys_ni_syscall			/* 55 */
-	.quad sys_ni_syscall
-	.quad sys_symlink
-	.quad sys_readlink
-	.quad sys_execve
-	.quad sys_umask				/* 60 */
-	.quad sys_chroot
-	.quad sys_ni_syscall
-	.quad sys_getpgrp
-	.quad sys_getpagesize
-	.quad sys_ni_syscall			/* 65 */
-	.quad alpha_vfork
-	.quad sys_newstat
-	.quad sys_newlstat
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 70 */
-	.quad sys_osf_mmap
-	.quad sys_ni_syscall
-	.quad sys_munmap
-	.quad sys_mprotect
-	.quad sys_madvise			/* 75 */
-	.quad sys_vhangup
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_getgroups
-	/* map BSD's setpgrp to sys_setpgid for binary compatibility: */
-	.quad sys_setgroups			/* 80 */
-	.quad sys_ni_syscall
-	.quad sys_setpgid
-	.quad sys_osf_setitimer
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 85 */
-	.quad sys_osf_getitimer
-	.quad sys_gethostname
-	.quad sys_sethostname
-	.quad sys_getdtablesize
-	.quad sys_dup2				/* 90 */
-	.quad sys_newfstat
-	.quad sys_fcntl
-	.quad sys_osf_select
-	.quad sys_poll
-	.quad sys_fsync				/* 95 */
-	.quad sys_setpriority
-	.quad sys_socket
-	.quad sys_connect
-	.quad sys_accept
-	.quad sys_osf_getpriority			/* 100 */
-	.quad sys_send
-	.quad sys_recv
-	.quad sys_sigreturn
-	.quad sys_bind
-	.quad sys_setsockopt			/* 105 */
-	.quad sys_listen
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 110 */
-	.quad sys_sigsuspend
-	.quad sys_osf_sigstack
-	.quad sys_recvmsg
-	.quad sys_sendmsg
-	.quad sys_ni_syscall			/* 115 */
-	.quad sys_osf_gettimeofday
-	.quad sys_osf_getrusage
-	.quad sys_getsockopt
-	.quad sys_ni_syscall
-	.quad sys_osf_readv			/* 120 */
-	.quad sys_osf_writev
-	.quad sys_osf_settimeofday
-	.quad sys_fchown
-	.quad sys_fchmod
-	.quad sys_recvfrom			/* 125 */
-	.quad sys_setreuid
-	.quad sys_setregid
-	.quad sys_rename
-	.quad sys_truncate
-	.quad sys_ftruncate			/* 130 */
-	.quad sys_flock
-	.quad sys_setgid
-	.quad sys_sendto
-	.quad sys_shutdown
-	.quad sys_socketpair			/* 135 */
-	.quad sys_mkdir
-	.quad sys_rmdir
-	.quad sys_osf_utimes
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 140 */
-	.quad sys_getpeername
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_getrlimit
-	.quad sys_setrlimit			/* 145 */
-	.quad sys_ni_syscall
-	.quad sys_setsid
-	.quad sys_quotactl
-	.quad sys_ni_syscall
-	.quad sys_getsockname			/* 150 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 155 */
-	.quad sys_osf_sigaction
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_osf_getdirentries
-	.quad sys_osf_statfs			/* 160 */
-	.quad sys_osf_fstatfs
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_osf_getdomainname		/* 165 */
-	.quad sys_setdomainname
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 170 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 175 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 180 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 185 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 190 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 195 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	/* The OSF swapon has two extra arguments, but we ignore them.  */
-	.quad sys_swapon
-	.quad sys_msgctl			/* 200 */
-	.quad sys_msgget
-	.quad sys_msgrcv
-	.quad sys_msgsnd
-	.quad sys_semctl
-	.quad sys_semget			/* 205 */
-	.quad sys_semop
-	.quad sys_osf_utsname
-	.quad sys_lchown
-	.quad sys_shmat
-	.quad sys_shmctl			/* 210 */
-	.quad sys_shmdt
-	.quad sys_shmget
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 215 */
-	.quad sys_ni_syscall
-	.quad sys_msync
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 220 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_osf_stat
-	.quad sys_osf_lstat			/* 225 */
-	.quad sys_osf_fstat
-	.quad sys_osf_statfs64
-	.quad sys_osf_fstatfs64
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 230 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_getpgid
-	.quad sys_getsid
-	.quad sys_sigaltstack			/* 235 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 240 */
-	.quad sys_osf_sysinfo
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_osf_proplist_syscall
-	.quad sys_ni_syscall			/* 245 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 250 */
-	.quad sys_osf_usleep_thread
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_sysfs
-	.quad sys_ni_syscall			/* 255 */
-	.quad sys_osf_getsysinfo
-	.quad sys_osf_setsysinfo
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 260 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 265 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 270 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 275 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 280 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 285 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 290 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall			/* 295 */
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-	.quad sys_ni_syscall
-/* linux-specific system calls start at 300 */
-	.quad sys_bdflush			/* 300 */
-	.quad sys_sethae
-	.quad sys_mount
-	.quad sys_old_adjtimex
-	.quad sys_swapoff
-	.quad sys_getdents			/* 305 */
-	.quad sys_ni_syscall			/* 306: old create_module */
-	.quad sys_init_module
-	.quad sys_delete_module
-	.quad sys_ni_syscall			/* 309: old get_kernel_syms */
-	.quad sys_syslog			/* 310 */
-	.quad sys_reboot
-	.quad alpha_clone
-	.quad sys_uselib
-	.quad sys_mlock
-	.quad sys_munlock			/* 315 */
-	.quad sys_mlockall
-	.quad sys_munlockall
-	.quad sys_sysinfo
-	.quad sys_sysctl
-	.quad sys_ni_syscall			/* 320 */
-	.quad sys_oldumount
-	.quad sys_swapon
-	.quad sys_times
-	.quad sys_personality
-	.quad sys_setfsuid			/* 325 */
-	.quad sys_setfsgid
-	.quad sys_ustat
-	.quad sys_statfs
-	.quad sys_fstatfs
-	.quad sys_sched_setparam		/* 330 */
-	.quad sys_sched_getparam
-	.quad sys_sched_setscheduler
-	.quad sys_sched_getscheduler
-	.quad sys_sched_yield
-	.quad sys_sched_get_priority_max	/* 335 */
-	.quad sys_sched_get_priority_min
-	.quad sys_sched_rr_get_interval
-	.quad sys_ni_syscall			/* sys_afs_syscall */
-	.quad sys_newuname
-	.quad sys_nanosleep			/* 340 */
-	.quad sys_mremap
-	.quad sys_ni_syscall			/* old nfsservctl */
-	.quad sys_setresuid
-	.quad sys_getresuid
-	.quad sys_pciconfig_read		/* 345 */
-	.quad sys_pciconfig_write
-	.quad sys_ni_syscall			/* 347: old query_module */
-	.quad sys_prctl
-	.quad sys_pread64
-	.quad sys_pwrite64			/* 350 */
-	.quad sys_rt_sigreturn
-	.quad sys_rt_sigaction
-	.quad sys_rt_sigprocmask
-	.quad sys_rt_sigpending
-	.quad sys_rt_sigtimedwait		/* 355 */
-	.quad sys_rt_sigqueueinfo
-	.quad sys_rt_sigsuspend
-	.quad sys_select
-	.quad sys_gettimeofday
-	.quad sys_settimeofday			/* 360 */
-	.quad sys_getitimer
-	.quad sys_setitimer
-	.quad sys_utimes
-	.quad sys_getrusage
-	.quad sys_wait4				/* 365 */
-	.quad sys_adjtimex
-	.quad sys_getcwd
-	.quad sys_capget
-	.quad sys_capset
-	.quad sys_sendfile64			/* 370 */
-	.quad sys_setresgid
-	.quad sys_getresgid
-	.quad sys_ni_syscall			/* sys_dipc */
-	.quad sys_pivot_root
-	.quad sys_mincore			/* 375 */
-	.quad sys_pciconfig_iobase
-	.quad sys_getdents64
-	.quad sys_gettid
-	.quad sys_readahead
-	.quad sys_ni_syscall			/* 380 */
-	.quad sys_tkill
-	.quad sys_setxattr
-	.quad sys_lsetxattr
-	.quad sys_fsetxattr
-	.quad sys_getxattr			/* 385 */
-	.quad sys_lgetxattr
-	.quad sys_fgetxattr
-	.quad sys_listxattr
-	.quad sys_llistxattr
-	.quad sys_flistxattr			/* 390 */
-	.quad sys_removexattr
-	.quad sys_lremovexattr
-	.quad sys_fremovexattr
-	.quad sys_futex
-	.quad sys_sched_setaffinity		/* 395 */
-	.quad sys_sched_getaffinity
-	.quad sys_ni_syscall			/* 397, tux */
-	.quad sys_io_setup
-	.quad sys_io_destroy
-	.quad sys_io_getevents			/* 400 */
-	.quad sys_io_submit
-	.quad sys_io_cancel
-	.quad sys_ni_syscall			/* 403, sys_alloc_hugepages */
-	.quad sys_ni_syscall			/* 404, sys_free_hugepages */
-	.quad sys_exit_group			/* 405 */
-	.quad sys_lookup_dcookie
-	.quad sys_epoll_create
-	.quad sys_epoll_ctl
-	.quad sys_epoll_wait
-	.quad sys_remap_file_pages		/* 410 */
-	.quad sys_set_tid_address
-	.quad sys_restart_syscall
-	.quad sys_fadvise64
-	.quad sys_timer_create
-	.quad sys_timer_settime			/* 415 */
-	.quad sys_timer_gettime
-	.quad sys_timer_getoverrun
-	.quad sys_timer_delete
-	.quad sys_clock_settime
-	.quad sys_clock_gettime			/* 420 */
-	.quad sys_clock_getres
-	.quad sys_clock_nanosleep
-	.quad sys_semtimedop
-	.quad sys_tgkill
-	.quad sys_stat64			/* 425 */
-	.quad sys_lstat64
-	.quad sys_fstat64
-	.quad sys_ni_syscall			/* sys_vserver */
-	.quad sys_ni_syscall			/* sys_mbind */
-	.quad sys_ni_syscall			/* sys_get_mempolicy */
-	.quad sys_ni_syscall			/* sys_set_mempolicy */
-	.quad sys_mq_open
-	.quad sys_mq_unlink
-	.quad sys_mq_timedsend
-	.quad sys_mq_timedreceive		/* 435 */
-	.quad sys_mq_notify
-	.quad sys_mq_getsetattr
-	.quad sys_waitid
-	.quad sys_add_key
-	.quad sys_request_key			/* 440 */
-	.quad sys_keyctl
-	.quad sys_ioprio_set
-	.quad sys_ioprio_get
-	.quad sys_inotify_init
-	.quad sys_inotify_add_watch		/* 445 */
-	.quad sys_inotify_rm_watch
-	.quad sys_fdatasync
-	.quad sys_kexec_load
-	.quad sys_migrate_pages
-	.quad sys_openat			/* 450 */
-	.quad sys_mkdirat
-	.quad sys_mknodat
-	.quad sys_fchownat
-	.quad sys_futimesat
-	.quad sys_fstatat64			/* 455 */
-	.quad sys_unlinkat
-	.quad sys_renameat
-	.quad sys_linkat
-	.quad sys_symlinkat
-	.quad sys_readlinkat			/* 460 */
-	.quad sys_fchmodat
-	.quad sys_faccessat
-	.quad sys_pselect6
-	.quad sys_ppoll
-	.quad sys_unshare			/* 465 */
-	.quad sys_set_robust_list
-	.quad sys_get_robust_list
-	.quad sys_splice
-	.quad sys_sync_file_range
-	.quad sys_tee				/* 470 */
-	.quad sys_vmsplice
-	.quad sys_move_pages
-	.quad sys_getcpu
-	.quad sys_epoll_pwait
-	.quad sys_utimensat			/* 475 */
-	.quad sys_signalfd
-	.quad sys_ni_syscall			/* sys_timerfd */
-	.quad sys_eventfd
-	.quad sys_recvmmsg
-	.quad sys_fallocate			/* 480 */
-	.quad sys_timerfd_create
-	.quad sys_timerfd_settime
-	.quad sys_timerfd_gettime
-	.quad sys_signalfd4
-	.quad sys_eventfd2			/* 485 */
-	.quad sys_epoll_create1
-	.quad sys_dup3
-	.quad sys_pipe2
-	.quad sys_inotify_init1
-	.quad sys_preadv			/* 490 */
-	.quad sys_pwritev
-	.quad sys_rt_tgsigqueueinfo
-	.quad sys_perf_event_open
-	.quad sys_fanotify_init
-	.quad sys_fanotify_mark			/* 495 */
-	.quad sys_prlimit64
-	.quad sys_name_to_handle_at
-	.quad sys_open_by_handle_at
-	.quad sys_clock_adjtime
-	.quad sys_syncfs			/* 500 */
-	.quad sys_setns
-	.quad sys_accept4
-	.quad sys_sendmmsg
-	.quad sys_process_vm_readv
-	.quad sys_process_vm_writev		/* 505 */
-	.quad sys_kcmp
-	.quad sys_finit_module
-	.quad sys_sched_setattr
-	.quad sys_sched_getattr
-	.quad sys_renameat2			/* 510 */
-	.quad sys_getrandom
-	.quad sys_memfd_create
-	.quad sys_execveat
-	.quad sys_seccomp
-	.quad sys_bpf				/* 515 */
-	.quad sys_userfaultfd
-	.quad sys_membarrier
-	.quad sys_mlock2
-	.quad sys_copy_file_range
-	.quad sys_preadv2			/* 520 */
-	.quad sys_pwritev2
-	.quad sys_statx
-
-	.size sys_call_table, . - sys_call_table
-	.type sys_call_table, @object
-
-/* Remember to update everything, kids.  */
-.ifne (. - sys_call_table) - (__NR_syscalls * 8)
-.err
-.endif
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/6] System call table generation support
  2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
                   ` (5 preceding siblings ...)
  2018-07-16 10:23 ` [PATCH 6/6] alpha: uapi header and system call table file generation Firoz Khan
@ 2018-07-16 14:09 ` Arnd Bergmann
  6 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2018-07-16 14:09 UTC (permalink / raw)
  To: Firoz Khan
  Cc: linux-alpha, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	y2038 Mailman List, Linux Kernel Mailing List, linux-arch,
	Deepa Dinamani, Marcin Juszkiewicz

On Mon, Jul 16, 2018 at 12:23 PM, Firoz Khan <firoz.khan@linaro.org> wrote:
> The goal of this patch series is to easily add/modify/delete a
> system call by changing entry in syscall.tbl file. No need
> to manually edit many files.
>
> The another goal of this patch series is to to unify the system
> call implementation across all the architectures. ARM, s390 and
> x86 architecuture does have the similar support. I leverage their
> implementation to come up with a generic solution.
>
> I have done the same support for work for ia64, m68k, microblaze,
> mips, parisc, powerpc, sh, sparc, and xtensa. But I started sending
> the patch for one architecuture for review. Below mentioned git
> repository contains more details.
> Git repo:- https://github.com/frzkhn/system_call_table_generator/
>
> Finally, this is the ground work for solving the Y2038 issue. We
> need to change two dozen of system calls to solve Y2038 issue. So
> this implementation will help to easily modify from existing system
> call to Y2038 compatible system calls.

Thanks a lot Firoz for getting this started!

(adding Marcin to Cc)

I think doing this for all architectures will help in a number of ways.
As we need to do a relatively complex conversion for the system
calls for y2038 support (changing old calls into compat ones,
and adding the new ones at the end), this will give us some
confidence.

I also hope that this makes scripting easier when we can check
which calls are implemented on which architecture, and maybe get
to a common baseline again by adding the missing calls on
all architectures that are rarely updated, now that we have thrown
out the architectures that were simply unmaintained. (looking
at the syscall table used to be a good way to see how well
maintained an architecture is). Once the y2038 calls are added,
glibc and others will have to set a new minimum version of kernel
headers (e.g. changing from linux-3.2 to 4.20) to get the new calls,
and that at that time, it would be great to have all the recently
added calls available on all architectures, so a future glibc version
that takes linux-4.20 as the minimum runtime version doesn't have
to emulate those calls through older ones. In particular, this
would be helpful for the new mount() API and the rseq() call that
have recently been added.

We might run into a few problems on architectures while we
transition to generated tables at the same as as adding new
calls, we'll have to see how to deal with that.

      Arnd

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 6/6] alpha: uapi header and system call table file generation
  2018-07-16 10:23 ` [PATCH 6/6] alpha: uapi header and system call table file generation Firoz Khan
  2018-07-16 16:23     ` kbuild test robot
@ 2018-07-16 16:23     ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2018-07-16 16:23 UTC (permalink / raw)
  To: Firoz Khan
  Cc: kbuild-all, linux-alpha, rth, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel, Firoz Khan

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

Hi Firoz,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18-rc5 next-20180716]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Firoz-Khan/System-call-table-generation-support/20180716-212040
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=alpha 

All warnings (new ones prefixed by >>):

>> <stdin>:249:2: warning: #warning syscall getpid not implemented [-Wcpp]
>> <stdin>:261:2: warning: #warning syscall getuid not implemented [-Wcpp]
>> <stdin>:330:2: warning: #warning syscall getgid not implemented [-Wcpp]
>> <stdin>:336:2: warning: #warning syscall geteuid not implemented [-Wcpp]
>> <stdin>:339:2: warning: #warning syscall getegid not implemented [-Wcpp]
>> <stdin>:345:2: warning: #warning syscall umount2 not implemented [-Wcpp]
>> <stdin>:381:2: warning: #warning syscall getppid not implemented [-Wcpp]
   <stdin>:1332:2: warning: #warning syscall io_pgetevents not implemented [-Wcpp]
   <stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 53431 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 6/6] alpha: uapi header and system call table file generation
@ 2018-07-16 16:23     ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2018-07-16 16:23 UTC (permalink / raw)
  Cc: kbuild-all, linux-alpha, rth, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel, Firoz Khan

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

Hi Firoz,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18-rc5 next-20180716]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Firoz-Khan/System-call-table-generation-support/20180716-212040
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=alpha 

All warnings (new ones prefixed by >>):

>> <stdin>:249:2: warning: #warning syscall getpid not implemented [-Wcpp]
>> <stdin>:261:2: warning: #warning syscall getuid not implemented [-Wcpp]
>> <stdin>:330:2: warning: #warning syscall getgid not implemented [-Wcpp]
>> <stdin>:336:2: warning: #warning syscall geteuid not implemented [-Wcpp]
>> <stdin>:339:2: warning: #warning syscall getegid not implemented [-Wcpp]
>> <stdin>:345:2: warning: #warning syscall umount2 not implemented [-Wcpp]
>> <stdin>:381:2: warning: #warning syscall getppid not implemented [-Wcpp]
   <stdin>:1332:2: warning: #warning syscall io_pgetevents not implemented [-Wcpp]
   <stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 53431 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 6/6] alpha: uapi header and system call table file generation
@ 2018-07-16 16:23     ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2018-07-16 16:23 UTC (permalink / raw)
  To: Firoz Khan
  Cc: kbuild-all, linux-alpha, rth, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

Hi Firoz,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18-rc5 next-20180716]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Firoz-Khan/System-call-table-generation-support/20180716-212040
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=alpha 

All warnings (new ones prefixed by >>):

>> <stdin>:249:2: warning: #warning syscall getpid not implemented [-Wcpp]
>> <stdin>:261:2: warning: #warning syscall getuid not implemented [-Wcpp]
>> <stdin>:330:2: warning: #warning syscall getgid not implemented [-Wcpp]
>> <stdin>:336:2: warning: #warning syscall geteuid not implemented [-Wcpp]
>> <stdin>:339:2: warning: #warning syscall getegid not implemented [-Wcpp]
>> <stdin>:345:2: warning: #warning syscall umount2 not implemented [-Wcpp]
>> <stdin>:381:2: warning: #warning syscall getppid not implemented [-Wcpp]
   <stdin>:1332:2: warning: #warning syscall io_pgetevents not implemented [-Wcpp]
   <stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 53431 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-07-16 10:23 ` [PATCH 3/6] alpha: Unify the not-implemented system call entry name Firoz Khan
@ 2018-08-11  0:04     ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11  0:04 UTC (permalink / raw)
  To: Firoz Khan
  Cc: linux-alpha, rth, ink, mattst88, y2038, linux-kernel, linux-arch,
	arnd, deepa.kernel

On Mon, Jul 16, 2018 at 03:53:55PM +0530, Firoz Khan wrote:
> systbl.S contain two types of system call entry name which are
> alpha_ni_syscall and sys_ni_syscall. So this patch will unify
> the not-implemented system call entry name as alpha_ni_syscall.

Umm...  The thing is, alpha_ni_syscall should really be called
alpha_syscall_0.  Its use for other not implemented syscalls in
OSF syscall numbers range is a historical accident.

What that thing does is, in addition usual return -ENOSYS, is
the opposite of force_successful_syscall_return().

On alpha the syscall number is passed in r0.  So for every
real syscall we have non-zero current_pt_regs()->r0
and force_successful_syscall_return() simply assigns 0 to
that.

Return value goes in the same register; additionally, register #19
(a3) is left 0 on success and 1 on error.  Normally it's controlled
by the sign of sys_something() return value (left in r0), but for
some syscalls we want to be able to tell the userland that the damn
thing has succeeded, negative result be damned.

The original value of r0 is left in pt_regs; it will be used only
in case of syscall restarts, i.e. *not* in "that's no error" case.
And it's non-zero on any real syscall, so it serves as a nice
available place for storing the "it's not an error" flag.

That works nicely, but leaves a bit of a twist in one case: if we
tried to issue syscall 0, we want it to return -ENOSYS and we want
that to be treated as an error, TYVM.  That's where this trick
comes to bite - unlike the normal case, we have pt_regs->r0
containing zero, which would trigger the "that's no error" logics.

Since -ENOSYS is not a restart-triggering error, we don't need to
preserve the original value of pt_regs->r0 in this case either.
Solution:

alpha_ni_syscall:
	make current_pt_regs()->r0 non-zero
	return -ENOSYS

That's what the comment in
alpha_ni_syscall:
        .prologue 0
        /* Special because it also implements overflow handling via
           syscall number 0.  And if you recall, zero is a special
           trigger for "not an error".  Store large non-zero there.  */
        lda     $0, -ENOSYS
        unop
        stq     $0, 0($sp)
        ret
is about.

Once upon a time it used to have a C part that printed a warning
about unimplemented OSF syscalls.  That's what it's been doing
all over the OSF syscall range, while the native Linux syscall
range uses sys_ni_syscall().

With those warnings about unimplemented OSF syscalls gone (circa 2.4),
alpha_ni_syscall() has shrunk to that little bit of asm and the
only reason it hasn't been replaced with sys_ni_syscall() everywhere
is that extra twist needed in case of syscall #0.

Let's keep it only for syscall #0 and replace the rest with sys_ni_syscall.
And use sys_ni_syscall for "number out range" in ptraced-call case, as
we'd been doing for normal codepath since 2.1.86...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index c64806a2daf5..21840e7042f3 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -473,7 +473,7 @@ entSys:
 	bne     $3, strace
 	beq	$4, 1f
 	ldq	$27, 0($5)
-1:	jsr	$26, ($27), alpha_ni_syscall
+1:	jsr	$26, ($27), sys_ni_syscall
 	ldgp	$gp, 0($26)
 	blt	$0, $syscall_error	/* the call failed */
 	stq	$0, 0($sp)
@@ -587,7 +587,7 @@ strace:
 	/* get the system call pointer.. */
 	lda	$1, NR_SYSCALLS($31)
 	lda	$2, sys_call_table
-	lda	$27, alpha_ni_syscall
+	lda	$27, sys_ni_syscall
 	cmpult	$0, $1, $1
 	s8addq	$0, $2, $2
 	beq	$1, 1f
@@ -843,15 +843,20 @@ sys_rt_sigreturn:
 .end sys_rt_sigreturn
 
 	.align	4
-	.globl	alpha_ni_syscall
-	.ent	alpha_ni_syscall
-alpha_ni_syscall:
+	.globl	alpha_syscall_zero
+	.ent	alpha_syscall_zero
+alpha_syscall_zero:
 	.prologue 0
-	/* Special because it also implements overflow handling via
-	   syscall number 0.  And if you recall, zero is a special
-	   trigger for "not an error".  Store large non-zero there.  */
+	/* Special because it needs to do something opposite to
+	   force_successful_syscall_return().  We use the saved
+	   syscall number for that, zero meaning "not an error".
+	   That works nicely, but for real syscall 0 we need to
+	   make sure that this logics doesn't get confused.
+	   Store a non-zero there - -ENOSYS we need in register
+	   for our return value will do just fine.
+	  */
 	lda	$0, -ENOSYS
 	unop
 	stq	$0, 0($sp)
 	ret
-.end alpha_ni_syscall
+.end alpha_syscall_zero
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 1374e591511f..5b2e8ecb7ce3 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -11,93 +11,93 @@
 	.align 3
 	.globl sys_call_table
 sys_call_table:
-	.quad alpha_ni_syscall			/* 0 */
+	.quad alpha_syscall_zero		/* 0 */
 	.quad sys_exit
 	.quad alpha_fork
 	.quad sys_read
 	.quad sys_write
-	.quad alpha_ni_syscall			/* 5 */
+	.quad sys_ni_syscall			/* 5 */
 	.quad sys_close
 	.quad sys_osf_wait4
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_link
 	.quad sys_unlink			/* 10 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_chdir
 	.quad sys_fchdir
 	.quad sys_mknod
 	.quad sys_chmod				/* 15 */
 	.quad sys_chown
 	.quad sys_osf_brk
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_lseek
 	.quad sys_getxpid			/* 20 */
 	.quad sys_osf_mount
 	.quad sys_umount
 	.quad sys_setuid
 	.quad sys_getxuid
-	.quad alpha_ni_syscall			/* 25 */
+	.quad sys_ni_syscall			/* 25 */
 	.quad sys_ptrace
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 30 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 30 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_access
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 35 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 35 */
 	.quad sys_sync
 	.quad sys_kill
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
-	.quad alpha_ni_syscall			/* 40 */
+	.quad sys_ni_syscall			/* 40 */
 	.quad sys_dup
 	.quad sys_alpha_pipe
 	.quad sys_osf_set_program_attributes
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_open				/* 45 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getxgid
 	.quad sys_osf_sigprocmask
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 50 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 50 */
 	.quad sys_acct
 	.quad sys_sigpending
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_ioctl
-	.quad alpha_ni_syscall			/* 55 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall			/* 55 */
+	.quad sys_ni_syscall
 	.quad sys_symlink
 	.quad sys_readlink
 	.quad sys_execve
 	.quad sys_umask				/* 60 */
 	.quad sys_chroot
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgrp
 	.quad sys_getpagesize
-	.quad alpha_ni_syscall			/* 65 */
+	.quad sys_ni_syscall			/* 65 */
 	.quad alpha_vfork
 	.quad sys_newstat
 	.quad sys_newlstat
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 70 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 70 */
 	.quad sys_osf_mmap
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_munmap
 	.quad sys_mprotect
 	.quad sys_madvise			/* 75 */
 	.quad sys_vhangup
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getgroups
 	/* map BSD's setpgrp to sys_setpgid for binary compatibility: */
 	.quad sys_setgroups			/* 80 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
 	.quad sys_osf_setitimer
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 85 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 85 */
 	.quad sys_osf_getitimer
 	.quad sys_gethostname
 	.quad sys_sethostname
@@ -119,19 +119,19 @@ sys_call_table:
 	.quad sys_bind
 	.quad sys_setsockopt			/* 105 */
 	.quad sys_listen
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 110 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 110 */
 	.quad sys_sigsuspend
 	.quad sys_osf_sigstack
 	.quad sys_recvmsg
 	.quad sys_sendmsg
-	.quad alpha_ni_syscall			/* 115 */
+	.quad sys_ni_syscall			/* 115 */
 	.quad sys_osf_gettimeofday
 	.quad sys_osf_getrusage
 	.quad sys_getsockopt
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 #ifdef CONFIG_OSF4_COMPAT
 	.quad sys_osf_readv			/* 120 */
 	.quad sys_osf_writev
@@ -156,66 +156,66 @@ sys_call_table:
 	.quad sys_mkdir
 	.quad sys_rmdir
 	.quad sys_osf_utimes
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 140 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 140 */
 	.quad sys_getpeername
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getrlimit
 	.quad sys_setrlimit			/* 145 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setsid
 	.quad sys_quotactl
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getsockname			/* 150 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 155 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 155 */
 	.quad sys_osf_sigaction
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdirentries
 	.quad sys_osf_statfs			/* 160 */
 	.quad sys_osf_fstatfs
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdomainname		/* 165 */
 	.quad sys_setdomainname
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 170 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 175 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 180 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 185 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 190 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 195 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 170 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 175 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 180 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 185 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 190 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 195 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	/* The OSF swapon has two extra arguments, but we ignore them.  */
 	.quad sys_swapon
 	.quad sys_msgctl			/* 200 */
@@ -231,93 +231,93 @@ sys_call_table:
 	.quad sys_shmctl			/* 210 */
 	.quad sys_shmdt
 	.quad sys_shmget
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 215 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 215 */
+	.quad sys_ni_syscall
 	.quad sys_msync
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 220 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 220 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_stat
 	.quad sys_osf_lstat			/* 225 */
 	.quad sys_osf_fstat
 	.quad sys_osf_statfs64
 	.quad sys_osf_fstatfs64
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 230 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 230 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgid
 	.quad sys_getsid
 	.quad sys_sigaltstack			/* 235 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 240 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 240 */
 	.quad sys_osf_sysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_proplist_syscall
-	.quad alpha_ni_syscall			/* 245 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 250 */
+	.quad sys_ni_syscall			/* 245 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 250 */
 	.quad sys_osf_usleep_thread
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_sysfs
-	.quad alpha_ni_syscall			/* 255 */
+	.quad sys_ni_syscall			/* 255 */
 	.quad sys_osf_getsysinfo
 	.quad sys_osf_setsysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 260 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 265 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 270 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 275 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 280 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 285 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 290 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 295 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 260 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 265 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 270 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 275 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 280 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 285 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 290 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 295 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 /* linux-specific system calls start at 300 */
 	.quad sys_bdflush			/* 300 */
 	.quad sys_sethae

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
@ 2018-08-11  0:04     ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11  0:04 UTC (permalink / raw)
  To: Firoz Khan
  Cc: linux-arch, arnd, y2038, linux-kernel, ink, deepa.kernel,
	linux-alpha, mattst88, rth

On Mon, Jul 16, 2018 at 03:53:55PM +0530, Firoz Khan wrote:
> systbl.S contain two types of system call entry name which are
> alpha_ni_syscall and sys_ni_syscall. So this patch will unify
> the not-implemented system call entry name as alpha_ni_syscall.

Umm...  The thing is, alpha_ni_syscall should really be called
alpha_syscall_0.  Its use for other not implemented syscalls in
OSF syscall numbers range is a historical accident.

What that thing does is, in addition usual return -ENOSYS, is
the opposite of force_successful_syscall_return().

On alpha the syscall number is passed in r0.  So for every
real syscall we have non-zero current_pt_regs()->r0
and force_successful_syscall_return() simply assigns 0 to
that.

Return value goes in the same register; additionally, register #19
(a3) is left 0 on success and 1 on error.  Normally it's controlled
by the sign of sys_something() return value (left in r0), but for
some syscalls we want to be able to tell the userland that the damn
thing has succeeded, negative result be damned.

The original value of r0 is left in pt_regs; it will be used only
in case of syscall restarts, i.e. *not* in "that's no error" case.
And it's non-zero on any real syscall, so it serves as a nice
available place for storing the "it's not an error" flag.

That works nicely, but leaves a bit of a twist in one case: if we
tried to issue syscall 0, we want it to return -ENOSYS and we want
that to be treated as an error, TYVM.  That's where this trick
comes to bite - unlike the normal case, we have pt_regs->r0
containing zero, which would trigger the "that's no error" logics.

Since -ENOSYS is not a restart-triggering error, we don't need to
preserve the original value of pt_regs->r0 in this case either.
Solution:

alpha_ni_syscall:
	make current_pt_regs()->r0 non-zero
	return -ENOSYS

That's what the comment in
alpha_ni_syscall:
        .prologue 0
        /* Special because it also implements overflow handling via
           syscall number 0.  And if you recall, zero is a special
           trigger for "not an error".  Store large non-zero there.  */
        lda     $0, -ENOSYS
        unop
        stq     $0, 0($sp)
        ret
is about.

Once upon a time it used to have a C part that printed a warning
about unimplemented OSF syscalls.  That's what it's been doing
all over the OSF syscall range, while the native Linux syscall
range uses sys_ni_syscall().

With those warnings about unimplemented OSF syscalls gone (circa 2.4),
alpha_ni_syscall() has shrunk to that little bit of asm and the
only reason it hasn't been replaced with sys_ni_syscall() everywhere
is that extra twist needed in case of syscall #0.

Let's keep it only for syscall #0 and replace the rest with sys_ni_syscall.
And use sys_ni_syscall for "number out range" in ptraced-call case, as
we'd been doing for normal codepath since 2.1.86...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index c64806a2daf5..21840e7042f3 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -473,7 +473,7 @@ entSys:
 	bne     $3, strace
 	beq	$4, 1f
 	ldq	$27, 0($5)
-1:	jsr	$26, ($27), alpha_ni_syscall
+1:	jsr	$26, ($27), sys_ni_syscall
 	ldgp	$gp, 0($26)
 	blt	$0, $syscall_error	/* the call failed */
 	stq	$0, 0($sp)
@@ -587,7 +587,7 @@ strace:
 	/* get the system call pointer.. */
 	lda	$1, NR_SYSCALLS($31)
 	lda	$2, sys_call_table
-	lda	$27, alpha_ni_syscall
+	lda	$27, sys_ni_syscall
 	cmpult	$0, $1, $1
 	s8addq	$0, $2, $2
 	beq	$1, 1f
@@ -843,15 +843,20 @@ sys_rt_sigreturn:
 .end sys_rt_sigreturn
 
 	.align	4
-	.globl	alpha_ni_syscall
-	.ent	alpha_ni_syscall
-alpha_ni_syscall:
+	.globl	alpha_syscall_zero
+	.ent	alpha_syscall_zero
+alpha_syscall_zero:
 	.prologue 0
-	/* Special because it also implements overflow handling via
-	   syscall number 0.  And if you recall, zero is a special
-	   trigger for "not an error".  Store large non-zero there.  */
+	/* Special because it needs to do something opposite to
+	   force_successful_syscall_return().  We use the saved
+	   syscall number for that, zero meaning "not an error".
+	   That works nicely, but for real syscall 0 we need to
+	   make sure that this logics doesn't get confused.
+	   Store a non-zero there - -ENOSYS we need in register
+	   for our return value will do just fine.
+	  */
 	lda	$0, -ENOSYS
 	unop
 	stq	$0, 0($sp)
 	ret
-.end alpha_ni_syscall
+.end alpha_syscall_zero
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 1374e591511f..5b2e8ecb7ce3 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -11,93 +11,93 @@
 	.align 3
 	.globl sys_call_table
 sys_call_table:
-	.quad alpha_ni_syscall			/* 0 */
+	.quad alpha_syscall_zero		/* 0 */
 	.quad sys_exit
 	.quad alpha_fork
 	.quad sys_read
 	.quad sys_write
-	.quad alpha_ni_syscall			/* 5 */
+	.quad sys_ni_syscall			/* 5 */
 	.quad sys_close
 	.quad sys_osf_wait4
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_link
 	.quad sys_unlink			/* 10 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_chdir
 	.quad sys_fchdir
 	.quad sys_mknod
 	.quad sys_chmod				/* 15 */
 	.quad sys_chown
 	.quad sys_osf_brk
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_lseek
 	.quad sys_getxpid			/* 20 */
 	.quad sys_osf_mount
 	.quad sys_umount
 	.quad sys_setuid
 	.quad sys_getxuid
-	.quad alpha_ni_syscall			/* 25 */
+	.quad sys_ni_syscall			/* 25 */
 	.quad sys_ptrace
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 30 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 30 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_access
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 35 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 35 */
 	.quad sys_sync
 	.quad sys_kill
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
-	.quad alpha_ni_syscall			/* 40 */
+	.quad sys_ni_syscall			/* 40 */
 	.quad sys_dup
 	.quad sys_alpha_pipe
 	.quad sys_osf_set_program_attributes
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_open				/* 45 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getxgid
 	.quad sys_osf_sigprocmask
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 50 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 50 */
 	.quad sys_acct
 	.quad sys_sigpending
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_ioctl
-	.quad alpha_ni_syscall			/* 55 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall			/* 55 */
+	.quad sys_ni_syscall
 	.quad sys_symlink
 	.quad sys_readlink
 	.quad sys_execve
 	.quad sys_umask				/* 60 */
 	.quad sys_chroot
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgrp
 	.quad sys_getpagesize
-	.quad alpha_ni_syscall			/* 65 */
+	.quad sys_ni_syscall			/* 65 */
 	.quad alpha_vfork
 	.quad sys_newstat
 	.quad sys_newlstat
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 70 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 70 */
 	.quad sys_osf_mmap
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_munmap
 	.quad sys_mprotect
 	.quad sys_madvise			/* 75 */
 	.quad sys_vhangup
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getgroups
 	/* map BSD's setpgrp to sys_setpgid for binary compatibility: */
 	.quad sys_setgroups			/* 80 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setpgid
 	.quad sys_osf_setitimer
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 85 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 85 */
 	.quad sys_osf_getitimer
 	.quad sys_gethostname
 	.quad sys_sethostname
@@ -119,19 +119,19 @@ sys_call_table:
 	.quad sys_bind
 	.quad sys_setsockopt			/* 105 */
 	.quad sys_listen
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 110 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 110 */
 	.quad sys_sigsuspend
 	.quad sys_osf_sigstack
 	.quad sys_recvmsg
 	.quad sys_sendmsg
-	.quad alpha_ni_syscall			/* 115 */
+	.quad sys_ni_syscall			/* 115 */
 	.quad sys_osf_gettimeofday
 	.quad sys_osf_getrusage
 	.quad sys_getsockopt
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 #ifdef CONFIG_OSF4_COMPAT
 	.quad sys_osf_readv			/* 120 */
 	.quad sys_osf_writev
@@ -156,66 +156,66 @@ sys_call_table:
 	.quad sys_mkdir
 	.quad sys_rmdir
 	.quad sys_osf_utimes
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 140 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 140 */
 	.quad sys_getpeername
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getrlimit
 	.quad sys_setrlimit			/* 145 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_setsid
 	.quad sys_quotactl
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getsockname			/* 150 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 155 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 155 */
 	.quad sys_osf_sigaction
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdirentries
 	.quad sys_osf_statfs			/* 160 */
 	.quad sys_osf_fstatfs
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_getdomainname		/* 165 */
 	.quad sys_setdomainname
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 170 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 175 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 180 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 185 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 190 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 195 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 170 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 175 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 180 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 185 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 190 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 195 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	/* The OSF swapon has two extra arguments, but we ignore them.  */
 	.quad sys_swapon
 	.quad sys_msgctl			/* 200 */
@@ -231,93 +231,93 @@ sys_call_table:
 	.quad sys_shmctl			/* 210 */
 	.quad sys_shmdt
 	.quad sys_shmget
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 215 */
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 215 */
+	.quad sys_ni_syscall
 	.quad sys_msync
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 220 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 220 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_stat
 	.quad sys_osf_lstat			/* 225 */
 	.quad sys_osf_fstat
 	.quad sys_osf_statfs64
 	.quad sys_osf_fstatfs64
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 230 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 230 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_getpgid
 	.quad sys_getsid
 	.quad sys_sigaltstack			/* 235 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 240 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 240 */
 	.quad sys_osf_sysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_osf_proplist_syscall
-	.quad alpha_ni_syscall			/* 245 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 250 */
+	.quad sys_ni_syscall			/* 245 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 250 */
 	.quad sys_osf_usleep_thread
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 	.quad sys_sysfs
-	.quad alpha_ni_syscall			/* 255 */
+	.quad sys_ni_syscall			/* 255 */
 	.quad sys_osf_getsysinfo
 	.quad sys_osf_setsysinfo
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 260 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 265 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 270 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 275 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 280 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 285 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 290 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall			/* 295 */
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
-	.quad alpha_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 260 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 265 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 270 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 275 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 280 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 285 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 290 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall			/* 295 */
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
+	.quad sys_ni_syscall
 /* linux-specific system calls start at 300 */
 	.quad sys_bdflush			/* 300 */
 	.quad sys_sethae
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-08-11  0:04     ` Al Viro
  (?)
@ 2018-08-11  2:31     ` Richard Henderson
  2018-08-11  2:45         ` Al Viro
  -1 siblings, 1 reply; 26+ messages in thread
From: Richard Henderson @ 2018-08-11  2:31 UTC (permalink / raw)
  To: Al Viro, Firoz Khan
  Cc: linux-alpha, ink, mattst88, y2038, linux-kernel, linux-arch,
	arnd, deepa.kernel

On 08/10/2018 05:04 PM, Al Viro wrote:
> Once upon a time it used to have a C part that printed a warning
> about unimplemented OSF syscalls.  That's what it's been doing
> all over the OSF syscall range, while the native Linux syscall
> range uses sys_ni_syscall().
> 
> With those warnings about unimplemented OSF syscalls gone (circa 2.4),
> alpha_ni_syscall() has shrunk to that little bit of asm and the
> only reason it hasn't been replaced with sys_ni_syscall() everywhere
> is that extra twist needed in case of syscall #0.
> 
> Let's keep it only for syscall #0 and replace the rest with sys_ni_syscall.
> And use sys_ni_syscall for "number out range" in ptraced-call case, as
> we'd been doing for normal codepath since 2.1.86...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Acked-by: Richard Henderson <rth@twiddle.net>


> +++ b/arch/alpha/kernel/entry.S
> @@ -473,7 +473,7 @@ entSys:
>  	bne     $3, strace
>  	beq	$4, 1f
>  	ldq	$27, 0($5)
> -1:	jsr	$26, ($27), alpha_ni_syscall
> +1:	jsr	$26, ($27), sys_ni_syscall
>  	ldgp	$gp, 0($26)
>  	blt	$0, $syscall_error	/* the call failed */
>  	stq	$0, 0($sp)

Once upon a time I had a patch to make the hint
be sys_gettimeofday, as the most common syscall.
Dunno what happened to that.

But I must guess that an unimplemented syscall has got
to be the anti-hint of the ... long-ass-time-frame.


r~

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-08-11  2:31     ` Richard Henderson
@ 2018-08-11  2:45         ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11  2:45 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Firoz Khan, linux-alpha, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

On Fri, Aug 10, 2018 at 07:31:55PM -0700, Richard Henderson wrote:

> > +++ b/arch/alpha/kernel/entry.S
> > @@ -473,7 +473,7 @@ entSys:
> >  	bne     $3, strace
> >  	beq	$4, 1f
> >  	ldq	$27, 0($5)
> > -1:	jsr	$26, ($27), alpha_ni_syscall
> > +1:	jsr	$26, ($27), sys_ni_syscall
> >  	ldgp	$gp, 0($26)
> >  	blt	$0, $syscall_error	/* the call failed */
> >  	stq	$0, 0($sp)
> 
> Once upon a time I had a patch to make the hint
> be sys_gettimeofday, as the most common syscall.
> Dunno what happened to that.

Might as well... ptraced case has it, non-ptraced doesn't.

BTW, seeing that it's your code - why was unop used in
alpha_ni_syscall?  I don't remember the rules re pipeline
stalls; is it that some earlier variants prefer unop to
nop in such places?  It's not that microoptimizing that
one makes any difference, but just out of curiosity -
would something like
	lda     $0, -ENOSYS
	stq     $sp, 0($sp)	/* sp != 0 */
	ret
do just as well there?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
@ 2018-08-11  2:45         ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11  2:45 UTC (permalink / raw)
  To: Richard Henderson
  Cc: linux-arch, arnd, y2038, linux-kernel, ink, deepa.kernel,
	linux-alpha, Firoz Khan, mattst88

On Fri, Aug 10, 2018 at 07:31:55PM -0700, Richard Henderson wrote:

> > +++ b/arch/alpha/kernel/entry.S
> > @@ -473,7 +473,7 @@ entSys:
> >  	bne     $3, strace
> >  	beq	$4, 1f
> >  	ldq	$27, 0($5)
> > -1:	jsr	$26, ($27), alpha_ni_syscall
> > +1:	jsr	$26, ($27), sys_ni_syscall
> >  	ldgp	$gp, 0($26)
> >  	blt	$0, $syscall_error	/* the call failed */
> >  	stq	$0, 0($sp)
> 
> Once upon a time I had a patch to make the hint
> be sys_gettimeofday, as the most common syscall.
> Dunno what happened to that.

Might as well... ptraced case has it, non-ptraced doesn't.

BTW, seeing that it's your code - why was unop used in
alpha_ni_syscall?  I don't remember the rules re pipeline
stalls; is it that some earlier variants prefer unop to
nop in such places?  It's not that microoptimizing that
one makes any difference, but just out of curiosity -
would something like
	lda     $0, -ENOSYS
	stq     $sp, 0($sp)	/* sp != 0 */
	ret
do just as well there?
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-08-11  2:45         ` Al Viro
@ 2018-08-11  4:10           ` Richard Henderson
  -1 siblings, 0 replies; 26+ messages in thread
From: Richard Henderson @ 2018-08-11  4:10 UTC (permalink / raw)
  To: Al Viro
  Cc: Firoz Khan, linux-alpha, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

On 08/10/2018 07:45 PM, Al Viro wrote:
> BTW, seeing that it's your code - why was unop used in
> alpha_ni_syscall?  I don't remember the rules re pipeline
> stalls; is it that some earlier variants prefer unop to
> nop in such places?  It's not that microoptimizing that
> one makes any difference, but just out of curiosity -
> would something like
> 	lda     $0, -ENOSYS
> 	stq     $sp, 0($sp)	/* sp != 0 */
> 	ret
> do just as well there?

Oh that.  Well, unop is a "load" and pairs with everything
on all cpus, where nop is an integer and doesn't always
pair.  So I got into the habit of using unop for everything.

The extra nop was so that lda + unop // stq + ret paired up
in in two cycles as opposed to lda /stall/ stq // ret in
three cycles on ev4+ev5.  ev6 didn't care.  FWIW.


r~


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
@ 2018-08-11  4:10           ` Richard Henderson
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Henderson @ 2018-08-11  4:10 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-arch, arnd, y2038, linux-kernel, ink, deepa.kernel,
	linux-alpha, Firoz Khan, mattst88

On 08/10/2018 07:45 PM, Al Viro wrote:
> BTW, seeing that it's your code - why was unop used in
> alpha_ni_syscall?  I don't remember the rules re pipeline
> stalls; is it that some earlier variants prefer unop to
> nop in such places?  It's not that microoptimizing that
> one makes any difference, but just out of curiosity -
> would something like
> 	lda     $0, -ENOSYS
> 	stq     $sp, 0($sp)	/* sp != 0 */
> 	ret
> do just as well there?

Oh that.  Well, unop is a "load" and pairs with everything
on all cpus, where nop is an integer and doesn't always
pair.  So I got into the habit of using unop for everything.

The extra nop was so that lda + unop // stq + ret paired up
in in two cycles as opposed to lda /stall/ stq // ret in
three cycles on ev4+ev5.  ev6 didn't care.  FWIW.


r~

_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-08-11  4:10           ` Richard Henderson
  (?)
@ 2018-08-11 15:07           ` Al Viro
  2018-08-11 15:24             ` Richard Henderson
  -1 siblings, 1 reply; 26+ messages in thread
From: Al Viro @ 2018-08-11 15:07 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Firoz Khan, linux-alpha, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

On Fri, Aug 10, 2018 at 09:10:04PM -0700, Richard Henderson wrote:
> On 08/10/2018 07:45 PM, Al Viro wrote:
> > BTW, seeing that it's your code - why was unop used in
> > alpha_ni_syscall?  I don't remember the rules re pipeline
> > stalls; is it that some earlier variants prefer unop to
> > nop in such places?  It's not that microoptimizing that
> > one makes any difference, but just out of curiosity -
> > would something like
> > 	lda     $0, -ENOSYS
> > 	stq     $sp, 0($sp)	/* sp != 0 */
> > 	ret
> > do just as well there?
> 
> Oh that.  Well, unop is a "load" and pairs with everything
> on all cpus, where nop is an integer and doesn't always
> pair.  So I got into the habit of using unop for everything.
> 
> The extra nop was so that lda + unop // stq + ret paired up
> in in two cycles as opposed to lda /stall/ stq // ret in
> three cycles on ev4+ev5.  ev6 didn't care.  FWIW.

BTW, looking through old patches around entry.S, are you OK with this
one?  Same kind of macro as that for fork/vfork/clone glue...

diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index c64806a2daf5..828d641b4410 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -791,7 +791,7 @@ ret_from_kernel_thread:
 \f
 /*
  * Special system calls.  Most of these are special in that they either
- * have to play switch_stack games or in some way use the pt_regs struct.
+ * have to play switch_stack games.
  */
 
 .macro	fork_like name
@@ -812,35 +812,25 @@ fork_like fork
 fork_like vfork
 fork_like clone
 
+.macro	sigreturn_like name
 	.align	4
-	.globl	sys_sigreturn
-	.ent	sys_sigreturn
-sys_sigreturn:
+	.globl	sys_\name
+	.ent	sys_\name
+sys_\name:
 	.prologue 0
 	lda	$9, ret_from_straced
 	cmpult	$26, $9, $9
 	lda	$sp, -SWITCH_STACK_SIZE($sp)
-	jsr	$26, do_sigreturn
+	jsr	$26, do_\name
 	bne	$9, 1f
 	jsr	$26, syscall_trace_leave
 1:	br	$1, undo_switch_stack
 	br	ret_from_sys_call
-.end sys_sigreturn
+.end sys_\name
+.endm
 
-	.align	4
-	.globl	sys_rt_sigreturn
-	.ent	sys_rt_sigreturn
-sys_rt_sigreturn:
-	.prologue 0
-	lda	$9, ret_from_straced
-	cmpult	$26, $9, $9
-	lda	$sp, -SWITCH_STACK_SIZE($sp)
-	jsr	$26, do_rt_sigreturn
-	bne	$9, 1f
-	jsr	$26, syscall_trace_leave
-1:	br	$1, undo_switch_stack
-	br	ret_from_sys_call
-.end sys_rt_sigreturn
+sigreturn_like sigreturn
+sigreturn_like rt_sigreturn
 
 	.align	4
 	.globl	alpha_ni_syscall

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/6] alpha: Unify the not-implemented system call entry name
  2018-08-11 15:07           ` Al Viro
@ 2018-08-11 15:24             ` Richard Henderson
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Henderson @ 2018-08-11 15:24 UTC (permalink / raw)
  To: Al Viro
  Cc: Firoz Khan, linux-alpha, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

On 08/11/2018 08:07 AM, Al Viro wrote:
> BTW, looking through old patches around entry.S, are you OK with this
> one?  Same kind of macro as that for fork/vfork/clone glue...

LGTM.


r~

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
  2018-07-16 10:23 ` [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header Firoz Khan
@ 2018-08-11 19:28     ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11 19:28 UTC (permalink / raw)
  To: Firoz Khan
  Cc: linux-alpha, rth, ink, mattst88, y2038, linux-kernel, linux-arch,
	arnd, deepa.kernel

On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> It is correct to keep __IGNORE* entry in non uapi header
> asm/unistd.h while uapi/asm/unistd.h must hold information
> only useful for user space applications.

> diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> index e153ca6..3bb6ac1 100644
> --- a/arch/alpha/include/uapi/asm/unistd.h
> +++ b/arch/alpha/include/uapi/asm/unistd.h
> @@ -481,9 +481,4 @@
>  #define __NR_pwritev2			521
>  #define __NR_statx			522
>  
> -/* Alpha doesn't have protection keys. */
> -#define __IGNORE_pkey_mprotect
> -#define __IGNORE_pkey_alloc
> -#define __IGNORE_pkey_free
> -
>  #endif /* _UAPI_ALPHA_UNISTD_H */

Hmm...  There's also

#define __IGNORE_alarm
#define __IGNORE_creat
#define __IGNORE_getegid
#define __IGNORE_geteuid
#define __IGNORE_getgid
#define __IGNORE_getpid
#define __IGNORE_getppid
#define __IGNORE_getuid
#define __IGNORE_pause
#define __IGNORE_time
#define __IGNORE_utime
#define __IGNORE_umount2

in there...

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
@ 2018-08-11 19:28     ` Al Viro
  0 siblings, 0 replies; 26+ messages in thread
From: Al Viro @ 2018-08-11 19:28 UTC (permalink / raw)
  To: Firoz Khan
  Cc: linux-arch, arnd, y2038, linux-kernel, ink, deepa.kernel,
	linux-alpha, mattst88, rth

On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> It is correct to keep __IGNORE* entry in non uapi header
> asm/unistd.h while uapi/asm/unistd.h must hold information
> only useful for user space applications.

> diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> index e153ca6..3bb6ac1 100644
> --- a/arch/alpha/include/uapi/asm/unistd.h
> +++ b/arch/alpha/include/uapi/asm/unistd.h
> @@ -481,9 +481,4 @@
>  #define __NR_pwritev2			521
>  #define __NR_statx			522
>  
> -/* Alpha doesn't have protection keys. */
> -#define __IGNORE_pkey_mprotect
> -#define __IGNORE_pkey_alloc
> -#define __IGNORE_pkey_free
> -
>  #endif /* _UAPI_ALPHA_UNISTD_H */

Hmm...  There's also

#define __IGNORE_alarm
#define __IGNORE_creat
#define __IGNORE_getegid
#define __IGNORE_geteuid
#define __IGNORE_getgid
#define __IGNORE_getpid
#define __IGNORE_getppid
#define __IGNORE_getuid
#define __IGNORE_pause
#define __IGNORE_time
#define __IGNORE_utime
#define __IGNORE_umount2

in there...
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
  2018-08-11 19:28     ` Al Viro
@ 2018-08-11 20:59       ` Michael Cree
  -1 siblings, 0 replies; 26+ messages in thread
From: Michael Cree @ 2018-08-11 20:59 UTC (permalink / raw)
  To: Al Viro
  Cc: Firoz Khan, linux-alpha, rth, ink, mattst88, y2038, linux-kernel,
	linux-arch, arnd, deepa.kernel

On Sat, Aug 11, 2018 at 08:28:04PM +0100, Al Viro wrote:
> On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> > It is correct to keep __IGNORE* entry in non uapi header
> > asm/unistd.h while uapi/asm/unistd.h must hold information
> > only useful for user space applications.
> 
> > diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> > index e153ca6..3bb6ac1 100644
> > --- a/arch/alpha/include/uapi/asm/unistd.h
> > +++ b/arch/alpha/include/uapi/asm/unistd.h
> > @@ -481,9 +481,4 @@
> >  #define __NR_pwritev2			521
> >  #define __NR_statx			522
> >  
> > -/* Alpha doesn't have protection keys. */
> > -#define __IGNORE_pkey_mprotect
> > -#define __IGNORE_pkey_alloc
> > -#define __IGNORE_pkey_free
> > -
> >  #endif /* _UAPI_ALPHA_UNISTD_H */
> 
> Hmm...  There's also
> 
> #define __IGNORE_alarm
> #define __IGNORE_creat

Tell you what, I wouldn't mind if the following ones were actually
implemented as syscalls in the kernel on Alpha:

> #define __IGNORE_getegid
> #define __IGNORE_geteuid
> #define __IGNORE_getgid
> #define __IGNORE_getpid
> #define __IGNORE_getppid
> #define __IGNORE_getuid

There's a growing number of software packages that are deciding
to sideskip glibc and call these syscalls directly.  Supporting
OSF's C ABI incompliant getxpid, etc., in such packages is not
easy and rather intrusive.

Cheers,
Michael.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
@ 2018-08-11 20:59       ` Michael Cree
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Cree @ 2018-08-11 20:59 UTC (permalink / raw)
  To: Al Viro
  Cc: linux-arch, arnd, y2038, linux-kernel, ink, deepa.kernel,
	linux-alpha, Firoz Khan, mattst88, rth

On Sat, Aug 11, 2018 at 08:28:04PM +0100, Al Viro wrote:
> On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> > It is correct to keep __IGNORE* entry in non uapi header
> > asm/unistd.h while uapi/asm/unistd.h must hold information
> > only useful for user space applications.
> 
> > diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> > index e153ca6..3bb6ac1 100644
> > --- a/arch/alpha/include/uapi/asm/unistd.h
> > +++ b/arch/alpha/include/uapi/asm/unistd.h
> > @@ -481,9 +481,4 @@
> >  #define __NR_pwritev2			521
> >  #define __NR_statx			522
> >  
> > -/* Alpha doesn't have protection keys. */
> > -#define __IGNORE_pkey_mprotect
> > -#define __IGNORE_pkey_alloc
> > -#define __IGNORE_pkey_free
> > -
> >  #endif /* _UAPI_ALPHA_UNISTD_H */
> 
> Hmm...  There's also
> 
> #define __IGNORE_alarm
> #define __IGNORE_creat

Tell you what, I wouldn't mind if the following ones were actually
implemented as syscalls in the kernel on Alpha:

> #define __IGNORE_getegid
> #define __IGNORE_geteuid
> #define __IGNORE_getgid
> #define __IGNORE_getpid
> #define __IGNORE_getppid
> #define __IGNORE_getuid

There's a growing number of software packages that are deciding
to sideskip glibc and call these syscalls directly.  Supporting
OSF's C ABI incompliant getxpid, etc., in such packages is not
easy and rather intrusive.

Cheers,
Michael.
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
  2018-08-11 20:59       ` Michael Cree
@ 2018-08-11 22:27         ` Arnd Bergmann
  -1 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2018-08-11 22:27 UTC (permalink / raw)
  To: mcree, Al Viro, Firoz Khan, linux-alpha, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, y2038 Mailman List,
	Linux Kernel Mailing List, linux-arch, Deepa Dinamani

On Sat, Aug 11, 2018 at 10:59 PM Michael Cree <mcree@orcon.net.nz> wrote:
>
> On Sat, Aug 11, 2018 at 08:28:04PM +0100, Al Viro wrote:
> > On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> > > It is correct to keep __IGNORE* entry in non uapi header
> > > asm/unistd.h while uapi/asm/unistd.h must hold information
> > > only useful for user space applications.
> >
> > > diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> > > index e153ca6..3bb6ac1 100644
> > > --- a/arch/alpha/include/uapi/asm/unistd.h
> > > +++ b/arch/alpha/include/uapi/asm/unistd.h
> > > @@ -481,9 +481,4 @@
> > >  #define __NR_pwritev2                      521
> > >  #define __NR_statx                 522
> > >
> > > -/* Alpha doesn't have protection keys. */
> > > -#define __IGNORE_pkey_mprotect
> > > -#define __IGNORE_pkey_alloc
> > > -#define __IGNORE_pkey_free
> > > -
> > >  #endif /* _UAPI_ALPHA_UNISTD_H */
> >
> > Hmm...  There's also
> >
> > #define __IGNORE_alarm
> > #define __IGNORE_creat
>
> Tell you what, I wouldn't mind if the following ones were actually
> implemented as syscalls in the kernel on Alpha:
>
> > #define __IGNORE_getegid
> > #define __IGNORE_geteuid
> > #define __IGNORE_getgid
> > #define __IGNORE_getpid
> > #define __IGNORE_getppid
> > #define __IGNORE_getuid
>
> There's a growing number of software packages that are deciding
> to sideskip glibc and call these syscalls directly.  Supporting
> OSF's C ABI incompliant getxpid, etc., in such packages is not
> easy and rather intrusive.

That sounds like a good idea to me. It would also help simplify libc
implementations in the long run, as we will probably soon have a
new baseline kernel header version once the y2038 syscalls
are added, with glibc (and maybe others) requiring at leat that
new version as a build time dependency rather than requiring
linux-3.2+ for both headers and runtime.

In a number of years, the latest glibc might then use that same
version again for both the header version and the kernel runtime,
and at that point, it can drop the alpha specific wrapper.

For the other __IGNORE_ entries, I think we can just drop the ones
for alarm, creat, pause, time and utime, as they are already present
in scripts/checksyscalls.sh. __IGNORE_mount2 is still required here,
since alpha calls it __NR_mount rather than __NR_mount2.

    Arnd

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header
@ 2018-08-11 22:27         ` Arnd Bergmann
  0 siblings, 0 replies; 26+ messages in thread
From: Arnd Bergmann @ 2018-08-11 22:27 UTC (permalink / raw)
  To: mcree, Al Viro, Firoz Khan, linux-alpha, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, y2038 Mailman List,
	Linux Kernel Mailing List, linux-arch, Deepa Dinamani

On Sat, Aug 11, 2018 at 10:59 PM Michael Cree <mcree@orcon.net.nz> wrote:
>
> On Sat, Aug 11, 2018 at 08:28:04PM +0100, Al Viro wrote:
> > On Mon, Jul 16, 2018 at 03:53:53PM +0530, Firoz Khan wrote:
> > > It is correct to keep __IGNORE* entry in non uapi header
> > > asm/unistd.h while uapi/asm/unistd.h must hold information
> > > only useful for user space applications.
> >
> > > diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> > > index e153ca6..3bb6ac1 100644
> > > --- a/arch/alpha/include/uapi/asm/unistd.h
> > > +++ b/arch/alpha/include/uapi/asm/unistd.h
> > > @@ -481,9 +481,4 @@
> > >  #define __NR_pwritev2                      521
> > >  #define __NR_statx                 522
> > >
> > > -/* Alpha doesn't have protection keys. */
> > > -#define __IGNORE_pkey_mprotect
> > > -#define __IGNORE_pkey_alloc
> > > -#define __IGNORE_pkey_free
> > > -
> > >  #endif /* _UAPI_ALPHA_UNISTD_H */
> >
> > Hmm...  There's also
> >
> > #define __IGNORE_alarm
> > #define __IGNORE_creat
>
> Tell you what, I wouldn't mind if the following ones were actually
> implemented as syscalls in the kernel on Alpha:
>
> > #define __IGNORE_getegid
> > #define __IGNORE_geteuid
> > #define __IGNORE_getgid
> > #define __IGNORE_getpid
> > #define __IGNORE_getppid
> > #define __IGNORE_getuid
>
> There's a growing number of software packages that are deciding
> to sideskip glibc and call these syscalls directly.  Supporting
> OSF's C ABI incompliant getxpid, etc., in such packages is not
> easy and rather intrusive.

That sounds like a good idea to me. It would also help simplify libc
implementations in the long run, as we will probably soon have a
new baseline kernel header version once the y2038 syscalls
are added, with glibc (and maybe others) requiring at leat that
new version as a build time dependency rather than requiring
linux-3.2+ for both headers and runtime.

In a number of years, the latest glibc might then use that same
version again for both the header version and the kernel runtime,
and at that point, it can drop the alpha specific wrapper.

For the other __IGNORE_ entries, I think we can just drop the ones
for alarm, creat, pause, time and utime, as they are already present
in scripts/checksyscalls.sh. __IGNORE_mount2 is still required here,
since alpha calls it __NR_mount rather than __NR_mount2.

    Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-08-11 22:27 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 10:23 [PATCH 0/6] System call table generation support Firoz Khan
2018-07-16 10:23 ` [PATCH 1/6] alpha: Move __IGNORE* entries to non uapi header Firoz Khan
2018-08-11 19:28   ` Al Viro
2018-08-11 19:28     ` Al Viro
2018-08-11 20:59     ` Michael Cree
2018-08-11 20:59       ` Michael Cree
2018-08-11 22:27       ` Arnd Bergmann
2018-08-11 22:27         ` Arnd Bergmann
2018-07-16 10:23 ` [PATCH 2/6] alpha: Add CONFIG_OSF4_COMPAT for compat syscall support Firoz Khan
2018-07-16 10:23 ` [PATCH 3/6] alpha: Unify the not-implemented system call entry name Firoz Khan
2018-08-11  0:04   ` Al Viro
2018-08-11  0:04     ` Al Viro
2018-08-11  2:31     ` Richard Henderson
2018-08-11  2:45       ` Al Viro
2018-08-11  2:45         ` Al Viro
2018-08-11  4:10         ` Richard Henderson
2018-08-11  4:10           ` Richard Henderson
2018-08-11 15:07           ` Al Viro
2018-08-11 15:24             ` Richard Henderson
2018-07-16 10:23 ` [PATCH 4/6] alpha: Replace NR_SYSCALLS macro from asm/unistd.h Firoz Khan
2018-07-16 10:23 ` [PATCH 5/6] alpha: Add system call table generation support Firoz Khan
2018-07-16 10:23 ` [PATCH 6/6] alpha: uapi header and system call table file generation Firoz Khan
2018-07-16 16:23   ` kbuild test robot
2018-07-16 16:23     ` kbuild test robot
2018-07-16 16:23     ` kbuild test robot
2018-07-16 14:09 ` [PATCH 0/6] System call table generation support Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.