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

powerpc: split compat syscall table out from native table

PowerPC uses a syscall table with native and compat calls
interleaved, which is a slightly simpler way to define two
matching tables.

As we move to having the tables generated, that advantage
is no longer important, but the interleaved table gets in
the way of using the same scripts as on the other archit-
ectures.

Split out a new compat_sys_call_table symbol that contains
all the compat calls, and leave the main table for the nat-
ive calls, to more closely match the method we use every-
where else.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Firoz Khan and committed by
Michael Ellerman
fbf508da a11b763d

+39 -13
+1 -2
arch/powerpc/include/asm/syscall.h
··· 18 18 #include <linux/thread_info.h> 19 19 20 20 /* ftrace syscalls requires exporting the sys_call_table */ 21 - #ifdef CONFIG_FTRACE_SYSCALLS 22 21 extern const unsigned long sys_call_table[]; 23 - #endif /* CONFIG_FTRACE_SYSCALLS */ 22 + extern const unsigned long compat_sys_call_table[]; 24 23 25 24 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 26 25 {
+5 -2
arch/powerpc/kernel/entry_64.S
··· 54 54 SYS_CALL_TABLE: 55 55 .tc sys_call_table[TC],sys_call_table 56 56 57 + COMPAT_SYS_CALL_TABLE: 58 + .tc compat_sys_call_table[TC],compat_sys_call_table 59 + 57 60 /* This value is used to mark exception frames on the stack. */ 58 61 exception_marker: 59 62 .tc ID_EXC_MARKER[TC],STACK_FRAME_REGS_MARKER ··· 181 178 ld r11,SYS_CALL_TABLE@toc(2) 182 179 andis. r10,r10,_TIF_32BIT@h 183 180 beq 15f 184 - addi r11,r11,8 /* use 32-bit syscall entries */ 181 + ld r11,COMPAT_SYS_CALL_TABLE@toc(2) 185 182 clrldi r3,r3,32 186 183 clrldi r4,r4,32 187 184 clrldi r5,r5,32 ··· 189 186 clrldi r7,r7,32 190 187 clrldi r8,r8,32 191 188 15: 192 - slwi r0,r0,4 189 + slwi r0,r0,3 193 190 194 191 barrier_nospec_asm 195 192 /*
+28 -7
arch/powerpc/kernel/systbl.S
··· 17 17 #include <asm/ppc_asm.h> 18 18 19 19 #ifdef CONFIG_PPC64 20 - #define SYSCALL(func) .8byte DOTSYM(sys_##func),DOTSYM(sys_##func) 21 - #define COMPAT_SYS(func) .8byte DOTSYM(sys_##func),DOTSYM(compat_sys_##func) 22 - #define PPC_SYS(func) .8byte DOTSYM(ppc_##func),DOTSYM(ppc_##func) 23 - #define OLDSYS(func) .8byte DOTSYM(sys_ni_syscall),DOTSYM(sys_ni_syscall) 24 - #define SYS32ONLY(func) .8byte DOTSYM(sys_ni_syscall),DOTSYM(compat_sys_##func) 25 - #define PPC64ONLY(func) .8byte DOTSYM(ppc_##func),DOTSYM(sys_ni_syscall) 26 - #define SYSX(f, f3264, f32) .8byte DOTSYM(f),DOTSYM(f3264) 20 + #define SYSCALL(func) .8byte DOTSYM(sys_##func) 21 + #define COMPAT_SYS(func) .8byte DOTSYM(sys_##func) 22 + #define PPC_SYS(func) .8byte DOTSYM(ppc_##func) 23 + #define OLDSYS(func) .8byte DOTSYM(sys_ni_syscall) 24 + #define SYS32ONLY(func) .8byte DOTSYM(sys_ni_syscall) 25 + #define PPC64ONLY(func) .8byte DOTSYM(ppc_##func) 26 + #define SYSX(f, f3264, f32) .8byte DOTSYM(f) 27 27 #else 28 28 #define SYSCALL(func) .long sys_##func 29 29 #define COMPAT_SYS(func) .long sys_##func ··· 46 46 47 47 .globl sys_call_table 48 48 sys_call_table: 49 + #include <asm/systbl.h> 49 50 51 + #undef SYSCALL 52 + #undef COMPAT_SYS 53 + #undef PPC_SYS 54 + #undef OLDSYS 55 + #undef SYS32ONLY 56 + #undef PPC64ONLY 57 + #undef SYSX 58 + 59 + #ifdef CONFIG_COMPAT 60 + #define SYSCALL(func) .8byte DOTSYM(sys_##func) 61 + #define COMPAT_SYS(func) .8byte DOTSYM(compat_sys_##func) 62 + #define PPC_SYS(func) .8byte DOTSYM(ppc_##func) 63 + #define OLDSYS(func) .8byte DOTSYM(sys_ni_syscall) 64 + #define SYS32ONLY(func) .8byte DOTSYM(compat_sys_##func) 65 + #define PPC64ONLY(func) .8byte DOTSYM(sys_ni_syscall) 66 + #define SYSX(f, f3264, f32) .8byte DOTSYM(f3264) 67 + 68 + .globl compat_sys_call_table 69 + compat_sys_call_table: 50 70 #define compat_sys_sigsuspend sys_sigsuspend 51 71 #include <asm/systbl.h> 72 + #endif
+5 -2
arch/powerpc/kernel/vdso.c
··· 671 671 { 672 672 unsigned int i; 673 673 extern unsigned long *sys_call_table; 674 + #ifdef CONFIG_PPC64 675 + extern unsigned long *compat_sys_call_table; 676 + #endif 674 677 extern unsigned long sys_ni_syscall; 675 678 676 679 677 680 for (i = 0; i < NR_syscalls; i++) { 678 681 #ifdef CONFIG_PPC64 679 - if (sys_call_table[i*2] != sys_ni_syscall) 682 + if (sys_call_table[i] != sys_ni_syscall) 680 683 vdso_data->syscall_map_64[i >> 5] |= 681 684 0x80000000UL >> (i & 0x1f); 682 - if (sys_call_table[i*2+1] != sys_ni_syscall) 685 + if (compat_sys_call_table[i] != sys_ni_syscall) 683 686 vdso_data->syscall_map_32[i >> 5] |= 684 687 0x80000000UL >> (i & 0x1f); 685 688 #else /* CONFIG_PPC64 */