Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: add +1 to __NR_syscalls in uapi header

All other architectures are hold a value for __NR_syscalls will
be equal to the last system call number +1.

But in mips architecture, __NR_syscalls hold the value equal to
total number of system exits in the architecture. One of the
patch in this patch series will genarate uapi header files.

In order to make the implementation common across all architect-
ures, add +1 to __NR_syscalls, which will be equal to the last
system call number +1.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: y2038@lists.linaro.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: arnd@arndb.de
Cc: deepa.kernel@gmail.com
Cc: marcin.juszkiewicz@linaro.org

authored by

Firoz Khan and committed by
Paul Burton
be856439 6d92c268

+17 -17
+6 -6
arch/mips/include/uapi/asm/unistd.h
··· 392 392 #define __NR_io_pgetevents (__NR_Linux + 368) 393 393 394 394 #ifdef __KERNEL__ 395 - #define __NR_syscalls 368 395 + #define __NR_syscalls 369 396 396 #endif 397 397 398 398 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 399 399 400 400 #define __NR_O32_Linux 4000 401 - #define __NR_O32_Linux_syscalls 368 401 + #define __NR_O32_Linux_syscalls 369 402 402 403 403 #if _MIPS_SIM == _MIPS_SIM_ABI64 404 404 ··· 737 737 #define __NR_io_pgetevents (__NR_Linux + 328) 738 738 739 739 #ifdef __KERNEL__ 740 - #define __NR_syscalls 328 740 + #define __NR_syscalls 329 741 741 #endif 742 742 743 743 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 744 744 745 745 #define __NR_64_Linux 5000 746 - #define __NR_64_Linux_syscalls 328 746 + #define __NR_64_Linux_syscalls 329 747 747 748 748 #if _MIPS_SIM == _MIPS_SIM_NABI32 749 749 ··· 1086 1086 #define __NR_io_pgetevents (__NR_Linux + 332) 1087 1087 1088 1088 #ifdef __KERNEL__ 1089 - #define __NR_syscalls 332 1089 + #define __NR_syscalls 333 1090 1090 #endif 1091 1091 1092 1092 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1093 1093 1094 1094 #define __NR_N32_Linux 6000 1095 - #define __NR_N32_Linux_syscalls 332 1095 + #define __NR_N32_Linux_syscalls 333 1096 1096 1097 1097 #endif /* _UAPI_ASM_UNISTD_H */
+3 -3
arch/mips/kernel/ftrace.c
··· 410 410 unsigned long __init arch_syscall_addr(int nr) 411 411 { 412 412 #ifdef CONFIG_MIPS32_N32 413 - if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) 413 + if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls) 414 414 return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux]; 415 415 #endif 416 - if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) 416 + if (nr >= __NR_64_Linux && nr < __NR_64_Linux + __NR_64_Linux_syscalls) 417 417 return (unsigned long)sys_call_table[nr - __NR_64_Linux]; 418 418 #ifdef CONFIG_MIPS32_O32 419 - if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) 419 + if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls) 420 420 return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; 421 421 #endif 422 422
+2 -2
arch/mips/kernel/scall32-o32.S
··· 86 86 bnez t0, syscall_trace_entry # -> yes 87 87 syscall_common: 88 88 subu v0, v0, __NR_O32_Linux # check syscall number 89 - sltiu t0, v0, __NR_O32_Linux_syscalls + 1 89 + sltiu t0, v0, __NR_O32_Linux_syscalls 90 90 beqz t0, illegal_syscall 91 91 92 92 sll t0, v0, 2 ··· 182 182 183 183 LEAF(sys_syscall) 184 184 subu t0, a0, __NR_O32_Linux # check syscall number 185 - sltiu v0, t0, __NR_O32_Linux_syscalls + 1 185 + sltiu v0, t0, __NR_O32_Linux_syscalls 186 186 beqz t0, einval # do not recurse 187 187 sll t1, t0, 2 188 188 beqz v0, einval
+2 -2
arch/mips/kernel/scall64-n32.S
··· 33 33 #endif 34 34 35 35 dsubu t0, v0, __NR_N32_Linux # check syscall number 36 - sltiu t0, t0, __NR_N32_Linux_syscalls + 1 36 + sltiu t0, t0, __NR_N32_Linux_syscalls 37 37 38 38 #ifndef CONFIG_MIPS32_O32 39 39 ld t1, PT_EPC(sp) # skip syscall on return ··· 87 87 ld a5, PT_R9(sp) 88 88 89 89 dsubu t2, v0, __NR_N32_Linux # check (new) syscall number 90 - sltiu t0, t2, __NR_N32_Linux_syscalls + 1 90 + sltiu t0, t2, __NR_N32_Linux_syscalls 91 91 beqz t0, not_n32_scall 92 92 93 93 j syscall_common
+1 -1
arch/mips/kernel/scall64-n64.S
··· 54 54 55 55 syscall_common: 56 56 dsubu t2, v0, __NR_64_Linux 57 - sltiu t0, t2, __NR_64_Linux_syscalls + 1 57 + sltiu t0, t2, __NR_64_Linux_syscalls 58 58 beqz t0, illegal_syscall 59 59 60 60 dsll t0, t2, 3 # offset into table
+3 -3
arch/mips/kernel/scall64-o32.S
··· 34 34 ld t1, PT_EPC(sp) # skip syscall on return 35 35 36 36 dsubu t0, v0, __NR_O32_Linux # check syscall number 37 - sltiu t0, t0, __NR_O32_Linux_syscalls + 1 37 + sltiu t0, t0, __NR_O32_Linux_syscalls 38 38 daddiu t1, 4 # skip to next instruction 39 39 sd t1, PT_EPC(sp) 40 40 beqz t0, not_o32_scall ··· 144 144 ld a7, PT_R11(sp) # For indirect syscalls 145 145 146 146 dsubu t0, v0, __NR_O32_Linux # check (new) syscall number 147 - sltiu t0, t0, __NR_O32_Linux_syscalls + 1 147 + sltiu t0, t0, __NR_O32_Linux_syscalls 148 148 beqz t0, not_o32_scall 149 149 150 150 j syscall_common ··· 193 193 194 194 LEAF(sys32_syscall) 195 195 subu t0, a0, __NR_O32_Linux # check syscall number 196 - sltiu v0, t0, __NR_O32_Linux_syscalls + 1 196 + sltiu v0, t0, __NR_O32_Linux_syscalls 197 197 beqz t0, einval # do not recurse 198 198 dsll t1, t0, 3 199 199 beqz v0, einval