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.
This commit is contained in:
Stefan Liebler 2019-10-23 14:51:53 +02:00
parent 7db1fe38de
commit 76aaa13d5d
2 changed files with 8 additions and 44 deletions

View File

@ -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 */

View File

@ -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. */