This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] S390: Remove not needed stack frame in syscall function.
On 10/22/19 12:25 PM, Florian Weimer wrote:
* Stefan Liebler:
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.
Looks okay to me. Would it be possible to save r6 and r7 in
caller-saved registers not clobbered by the system call? That might
provide another small benefit.
Thanks,
Florian
The syscall itself just clobbers the return value in r2. But for its
parameters we have to clobber r6 and r7.
According to the ABI, r0-r5 and r14 are volatile.
We need r1 for the syscall number for "svc 0", r2-r7 as parameters for
svc and r14 is the return-address.
Thus we could use r0 for saving/restoring r6.
For r7 we have the option to either use the register save area on the
stack-frame prepared by the caller or one of the volatile fprs. But the
instructions for transferring gpr <-> fpr are not available with all
architecture level sets. Thus we would need something like #ifdef /
#else to provide alternative implementations.
Therefore I think just storing/restoring both registers at once with one
stmg/lmg instruction is okay.
Thanks,
Stefan