Skip to content

Commit be85643

Browse files
Firoz Khanpaulburton
authored andcommitted
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
1 parent 6d92c26 commit be85643

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎arch/mips/include/uapi/asm/unistd.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@
392392
#define __NR_io_pgetevents (__NR_Linux + 368)
393393

394394
#ifdef __KERNEL__
395-
#define __NR_syscalls 368
395+
#define __NR_syscalls 369
396396
#endif
397397

398398
#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
399399

400400
#define __NR_O32_Linux 4000
401-
#define __NR_O32_Linux_syscalls 368
401+
#define __NR_O32_Linux_syscalls 369
402402

403403
#if _MIPS_SIM == _MIPS_SIM_ABI64
404404

@@ -737,13 +737,13 @@
737737
#define __NR_io_pgetevents (__NR_Linux + 328)
738738

739739
#ifdef __KERNEL__
740-
#define __NR_syscalls 328
740+
#define __NR_syscalls 329
741741
#endif
742742

743743
#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
744744

745745
#define __NR_64_Linux 5000
746-
#define __NR_64_Linux_syscalls 328
746+
#define __NR_64_Linux_syscalls 329
747747

748748
#if _MIPS_SIM == _MIPS_SIM_NABI32
749749

@@ -1086,12 +1086,12 @@
10861086
#define __NR_io_pgetevents (__NR_Linux + 332)
10871087

10881088
#ifdef __KERNEL__
1089-
#define __NR_syscalls 332
1089+
#define __NR_syscalls 333
10901090
#endif
10911091

10921092
#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
10931093

10941094
#define __NR_N32_Linux 6000
1095-
#define __NR_N32_Linux_syscalls 332
1095+
#define __NR_N32_Linux_syscalls 333
10961096

10971097
#endif /* _UAPI_ASM_UNISTD_H */

‎arch/mips/kernel/ftrace.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,13 @@ unsigned long __init arch_syscall_addr(int nr)
410410
unsigned long __init arch_syscall_addr(int nr)
411411
{
412412
#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)
414414
return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
415415
#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)
417417
return (unsigned long)sys_call_table[nr - __NR_64_Linux];
418418
#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)
420420
return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
421421
#endif
422422

‎arch/mips/kernel/scall32-o32.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ loads_done:
8686
bnez t0, syscall_trace_entry # -> yes
8787
syscall_common:
8888
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
9090
beqz t0, illegal_syscall
9191

9292
sll t0, v0, 2
@@ -182,7 +182,7 @@ illegal_syscall:
182182

183183
LEAF(sys_syscall)
184184
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
186186
beqz t0, einval # do not recurse
187187
sll t1, t0, 2
188188
beqz v0, einval

‎arch/mips/kernel/scall64-n32.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
3333
#endif
3434

3535
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
3737

3838
#ifndef CONFIG_MIPS32_O32
3939
ld t1, PT_EPC(sp) # skip syscall on return
@@ -87,7 +87,7 @@ n32_syscall_trace_entry:
8787
ld a5, PT_R9(sp)
8888

8989
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
9191
beqz t0, not_n32_scall
9292

9393
j syscall_common

‎arch/mips/kernel/scall64-n64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
5454

5555
syscall_common:
5656
dsubu t2, v0, __NR_64_Linux
57-
sltiu t0, t2, __NR_64_Linux_syscalls + 1
57+
sltiu t0, t2, __NR_64_Linux_syscalls
5858
beqz t0, illegal_syscall
5959

6060
dsll t0, t2, 3 # offset into table

‎arch/mips/kernel/scall64-o32.S‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ NESTED(handle_sys, PT_SIZE, sp)
3434
ld t1, PT_EPC(sp) # skip syscall on return
3535

3636
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
3838
daddiu t1, 4 # skip to next instruction
3939
sd t1, PT_EPC(sp)
4040
beqz t0, not_o32_scall
@@ -144,7 +144,7 @@ trace_a_syscall:
144144
ld a7, PT_R11(sp) # For indirect syscalls
145145

146146
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
148148
beqz t0, not_o32_scall
149149

150150
j syscall_common
@@ -193,7 +193,7 @@ not_o32_scall:
193193

194194
LEAF(sys32_syscall)
195195
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
197197
beqz t0, einval # do not recurse
198198
dsll t1, t0, 3
199199
beqz v0, einval

0 commit comments

Comments
 (0)