about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.ibm.com>2019-10-23 14:51:53 +0200
committerStefan Liebler <stli@linux.ibm.com>2019-10-23 14:51:53 +0200
commit76aaa13d5d654a2ba0d59cd328b3f5425809aa7e (patch)
treeb5b75d556ff8b14586dc818dd2e3dfa21c317460
parent7db1fe38de21831d53ceab9ae83493d8d1aec601 (diff)
downloadglibc-76aaa13d5d654a2ba0d59cd328b3f5425809aa7e.tar.gz
glibc-76aaa13d5d654a2ba0d59cd328b3f5425809aa7e.tar.xz
glibc-76aaa13d5d654a2ba0d59cd328b3f5425809aa7e.zip
S390: Remove not needed stack frame in syscall function.
As an svc invocation does not clobber any user space registers
despite of the return value r2 and it does not need a special
stack frame. This patch gets rid of the extra frame.
We just have to save and restore r6 and r7 as those are
preserved across function calls.
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S26
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S26
2 files changed, 8 insertions, 44 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
index 69561d0b76..06280992ab 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -22,37 +22,19 @@
    more information about the value -4095 used below.*/
 
 ENTRY (syscall)
-	/* Save registers and setup stack.  */
-	stm     %r6,%r15,24(%r15)  /* save registers */
-	cfi_offset (%r15, -36)
-	cfi_offset (%r14, -40)
-	cfi_offset (%r13, -44)
-	cfi_offset (%r12, -48)
-	cfi_offset (%r11, -52)
-	cfi_offset (%r10, -56)
-	cfi_offset (%r9, -60)
-	cfi_offset (%r8, -64)
+	stm    %r6,%r7,24(%r15)    /* save registers */
 	cfi_offset (%r7, -68)
 	cfi_offset (%r6, -72)
-	lr      %r1,%r15
-	l       %r0,4(0,%r15)      /* load eos */
-	ahi     %r15,-96           /* buy stack space */
-	cfi_adjust_cfa_offset (96)
-	st      %r1,0(0,%r15)      /* store back chain */
-	st      %r0,4(0,%r15)      /* store eos */
 
 	lr     %r1,%r2             /* move syscall number */
 	lr     %r2,%r3             /* first parameter  */
 	lr     %r3,%r4             /* second parameter */
 	lr     %r4,%r5             /* third parameter  */
 	lr     %r5,%r6             /* fourth parameter */
-	l      %r6,192(%r15)       /* fifth parameter  */
-	l      %r7,196(%r15)       /* sixth parameter  */
-
+	lm     %r6,%r7,96(%r15)    /* fifth / sixth parameter  */
 	svc    0
-	l      %r15,0(%r15)        /* load back chain.  */
-	cfi_adjust_cfa_offset (-96)
-	lm     %r6,%r15,24(%r15)   /* load registers.  */
+
+	lm     %r6,%r7,24(%r15)    /* load registers.  */
 
 	lhi    %r0,-4095
 	clr    %r2,%r0             /* check R2 for error */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index bbe4d79848..bcffab6f4e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -22,37 +22,19 @@
    more information about the value -4095 used below.*/
 
 ENTRY (syscall)
-	/* Save registers and setup stack.  */
-	stmg	%r6,%r15,48(%r15)  /* Save registers.  */
-	cfi_offset (%r15,-40)
-	cfi_offset (%r14,-48)
-	cfi_offset (%r13,-56)
-	cfi_offset (%r12,-64)
-	cfi_offset (%r11,-72)
-	cfi_offset (%r10,-80)
-	cfi_offset (%r9,-88)
-	cfi_offset (%r8,-96)
+	stmg   %r6,%r7,48(%r15)    /* Save registers.  */
 	cfi_offset (%r7,-104)
 	cfi_offset (%r6,-112)
-	lgr	%r1,%r15
-	lg	%r0,8(%r15)	   /* Load eos.	 */
-	aghi	%r15,-160	   /* Buy stack space.	*/
-	cfi_adjust_cfa_offset (160)
-	stg	%r1,0(%r15)	   /* Store back chain.	 */
-	stg	%r0,8(%r15)	   /* Store eos.  */
 
 	lgr    %r1,%r2		   /* Move syscall number.  */
 	lgr    %r2,%r3		   /* First parameter.	*/
 	lgr    %r3,%r4		   /* Second parameter.	 */
 	lgr    %r4,%r5		   /* Third parameter.	*/
 	lgr    %r5,%r6		   /* Fourth parameter.	 */
-	lg     %r6,320(%r15)	   /* Fifth parameter.	*/
-	lg     %r7,328(%r15)	   /* Sixth parameter.	*/
-
+	lmg    %r6,%r7,160(%r15)   /* Fifth / Sixth parameter.	*/
 	svc    0
-	lg     %r15,0(%r15)        /* Load back chain.  */
-	cfi_adjust_cfa_offset (-160)
-	lmg    %r6,%r15,48(%r15)   /* Load registers.  */
+
+	lmg    %r6,%r7,48(%r15)    /* Load registers.  */
 
 	lghi   %r0,-4095
 	clgr   %r2,%r0		   /* Check R2 for error.  */