diff mbox series

[RFC] parisc: Halve size of syscall table in 64-bit kernel

Message ID 20181010071600.GA20948@ls3530.fritz.box (mailing list archive)
State RFC, archived
Headers show
Series [RFC] parisc: Halve size of syscall table in 64-bit kernel | expand

Commit Message

Helge Deller Oct. 10, 2018, 7:16 a.m. UTC
This patch (on top of the syscall-table refracturing patch by Firoz
Khan) halves the requires size for the syscall table and thus saves
4*351*2 bytes = 2808 bytes (4 bytes per syscall * syscalls * 64&32-bit
entries).  Additional cost is one instruction more per syscall, which
I'm not sure is possible to avoid.

I'm still unsure if this patch is a good idea to apply.

Signed-off-by: Helge Deller <deller@gmx.de>
diff mbox series

Patch

diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 45cddeeb968f..825ce25f3793 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -215,20 +215,20 @@  linux_gateway_entry:
 	/* Note!  We cannot use the syscall table that is mapped
 	nearby since the gateway page is mapped execute-only. */
 
+	load32	sys_call_table, %r19
 #ifdef CONFIG_64BIT
-	ldil	L%sys_call_table, %r1
-	or,=	%r2,%r2,%r2
-	addil	L%(sys_call_table64-sys_call_table), %r1
-	ldo	R%sys_call_table(%r1), %r19
+	copy	%r20, %r1
 	or,=	%r2,%r2,%r2
-	ldo	R%sys_call_table64(%r1), %r19
+	ldo	__NR_Linux_syscalls(%r20), %r1
+	ldw,s	%r1(%r19), %r1
+	add	%r1, %r19, %r19
+	depdi	0, 31, 32, %r19 /* clip upper bits */
 #else
-	load32	sys_call_table, %r19
-#endif	
+	ldw,s	%r20(%r19), %r19
+#endif
+
 	comiclr,>>	__NR_Linux_syscalls, %r20, %r0
 	b,n	.Lsyscall_nosys
-	
-	LDREGX  %r20(%r19), %r19
 
 	/* If this is a sys_rt_sigreturn call, and the signal was received
 	 * when not in_syscall, then we want to return via syscall_exit_rfi,
@@ -350,22 +350,21 @@  tracesys_next:
 	/* Note!  We cannot use the syscall table that is mapped
 	nearby since the gateway page is mapped execute-only. */
 
+	load32	sys_call_table, %r19
 #ifdef CONFIG_64BIT
-	LDREG	TASK_PT_GR30(%r1), %r19		/* get users sp back */
-	extrd,u	%r19,63,1,%r2			/* W hidden in bottom bit */
+	LDREG	TASK_PT_GR30(%r1), %r1		/* get users sp back */
+	extrd,u	%r1,63,1,%r2			/* W hidden in bottom bit */
 
-	ldil	L%sys_call_table, %r1
-	or,=	%r2,%r2,%r2
-	addil	L%(sys_call_table64-sys_call_table), %r1
-	ldo	R%sys_call_table(%r1), %r19
+	copy	%r20, %r1
 	or,=	%r2,%r2,%r2
-	ldo	R%sys_call_table64(%r1), %r19
+	ldo	__NR_Linux_syscalls(%r20), %r1
+	ldw,s	%r1(%r19), %r1
+	add	%r1, %r19, %r19
+	depdi	0, 31, 32, %r19 /* clip upper bits */
 #else
-	load32	sys_call_table, %r19
+	ldw,s	%r20(%r19), %r19
 #endif
 
-	LDREGX  %r20(%r19), %r19
-
 	/* If this is a sys_rt_sigreturn call, and the signal was received
 	 * when not in_syscall, then we want to return via syscall_exit_rfi,
 	 * not syscall_exit.  Signal no. in r20, in_syscall in r25 (see
@@ -923,12 +922,14 @@  ENTRY(lws_table)
 END(lws_table)
 	/* End of lws table */
 
-#define __SYSCALL(nr, entry, nargs) ASM_ULONG_INSN entry
+
 
 ENTRY(sys_call_table)
 #if defined(CONFIG_64BIT)
+#define __SYSCALL(nr, entry, nargs) .word (entry - sys_call_table) /* 32-bit relative */
 #include <asm/syscall_table_c32.h>	/* compat syscalls */
 #else
+#define __SYSCALL(nr, entry, nargs) .word entry
 #include <asm/syscall_table_32.h>	/* 32-bit native syscalls */
 #endif
 END(sys_call_table)