[2/3] arm64: assign __NR_*_Linux_syscalls generated by the scripts

Message ID 1546530025-26014-3-git-send-email-firoz.khan@linaro.org
State New
Headers show
Series
  • arm64: system call table generation for asm-generic
Related show

Commit Message

Firoz Khan Jan. 3, 2019, 3:40 p.m.
Assign the generated values - __NR_C32_Linux_syscalls and
__NR_64_Linux_syscalls instead of __NR_compat_syscalls and
__NR_syscalls respectively. It is better than hard coding
it.

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

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>

---
 arch/arm64/include/asm/unistd.h | 10 ++++++----
 arch/arm64/kernel/sys.c         |  4 ++--
 arch/arm64/kernel/sys32.c       |  4 ++--
 arch/arm64/kernel/syscall.c     |  4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

-- 
1.9.1

Patch

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