summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2017-06-19 10:59:40 +0200
committerStefan Liebler <stli@linux.vnet.ibm.com>2017-06-19 10:59:40 +0200
commit35810f5ccf735d8df0a783bc6ed5fbe455e64876 (patch)
treeac4dbf1066e2d624fe5bd52bce2c2ebda11fb951
parent52243b520e2d336431ea410ef3aa1f766642f1d2 (diff)
downloadglibc-35810f5ccf735d8df0a783bc6ed5fbe455e64876.tar.gz
glibc-35810f5ccf735d8df0a783bc6ed5fbe455e64876.tar.xz
glibc-35810f5ccf735d8df0a783bc6ed5fbe455e64876.zip
s390: optimize syscall function
Since kernel 2.6.0 all Linux version accept the system call number
in register 1 for svc 0. There is no need to have special handling
that uses EX for system calls < 256. This will simplify and speed
up that code.

A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster
by ~12%.

        * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Simplify
        code by always using SVC 0 instead of EX.
        * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S12
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S12
3 files changed, 12 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index f4ac921321..bf6c25aceb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-19  Christian Borntraeger  <borntraeger@de.ibm.com>
+
+	* sysdeps/unix/sysv/linux/s390/s390-32/syscall.S (syscall):
+	Simplify code by always using SVC 0 instead of EX.
+	* sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
+
 2017-06-16  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf/Versions (ld): Remove _dl_out_of_memory.
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
index 8506db1cc1..0fa08cd33c 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -49,19 +49,13 @@ ENTRY (syscall)
 	l      %r6,192(%r15)       /* fifth parameter  */
 	l      %r7,196(%r15)       /* sixth parameter  */
 
-	basr   %r8,0
-0:	cl     %r1,4f-0b(%r8)      /* svc number < 256? */
-	jl     2f
-1:	svc    0
-	j      3f
-2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
-3:	l      %r15,0(%r15)        /* load back chain */
+	svc    0
+	l      %r15,0(%r15)        /* load back chain.  */
 	cfi_adjust_cfa_offset (-96)
-	lm     %r6,15,24(%r15)     /* load registers */
+	lm     %r6,%r15,24(%r15)   /* load registers.  */
 
 	lhi    %r0,-4095
 	clr    %r2,%r0             /* check R2 for error */
 	jnl    SYSCALL_ERROR_LABEL
 	br     %r14                /* return to caller */
-4:	.long  256
 PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index 24c47cb75a..61e2485927 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -49,20 +49,14 @@ ENTRY (syscall)
 	lg     %r6,320(%r15)	   /* Fifth parameter.	*/
 	lg     %r7,328(%r15)	   /* Sixth parameter.	*/
 
-	basr   %r8,0
-0:	clg    %r1,4f-0b(%r8)      /* svc number < 256? */
-	jl     2f
-1:	svc    0
-	j      3f
-2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
-3:	lg     %r15,0(%r15)        /* load back chain */
+	svc    0
+	lg     %r15,0(%r15)        /* Load back chain.  */
 	cfi_adjust_cfa_offset (-160)
-	lmg	%r6,15,48(%r15)	   /* Load registers.  */
+	lmg    %r6,%r15,48(%r15)   /* Load registers.  */
 
 	lghi   %r0,-4095
 	clgr   %r2,%r0		   /* Check R2 for error.  */
 	jgnl   SYSCALL_ERROR_LABEL
 	br     %r14		   /* Return to caller.	 */
-4:	.quad  256
 PSEUDO_END (syscall)