unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.ibm.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] S390: Remove not needed stack frame in syscall function.
Date: Tue, 22 Oct 2019 13:37:50 +0200	[thread overview]
Message-ID: <0ca333b6-3faf-df73-bb24-d03aa155dfb9@linux.ibm.com> (raw)
In-Reply-To: <87o8y9krf9.fsf@oldenburg2.str.redhat.com>

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


  reply	other threads:[~2019-10-22 11:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  8:00 [PATCH] S390: Remove not needed stack frame in syscall function Stefan Liebler
2019-10-22 10:25 ` Florian Weimer
2019-10-22 11:37   ` Stefan Liebler [this message]
2019-10-22 11:44     ` Florian Weimer
2019-10-23 12:53       ` Stefan Liebler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ca333b6-3faf-df73-bb24-d03aa155dfb9@linux.ibm.com \
    --to=stli@linux.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).