From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A95DE1F4C0 for ; Tue, 22 Oct 2019 11:38:02 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:date :mime-version:in-reply-to:content-type:content-transfer-encoding :message-id; q=dns; s=default; b=ddYyFCTN3lxeM/m0VYRCF3it96kS9y1 TB97bYRYuVuPn66bhF4YERfRDdcBeBl7txf8MLhYhX+m6ynMDyqpI9R1bsl0M4fC qKRhQhAGWyprvZ2T7AgABLYuJhVNR2owWrYE39ME40+vMPwLUkuYzqkw7UgsDTyU /n98eLqfJWfk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:date :mime-version:in-reply-to:content-type:content-transfer-encoding :message-id; s=default; bh=B4aXbAUJ7Xpb0819s559KtzT0Mg=; b=IoikM U0/UYguMH0WdXwNundk3RxMUGRzZPRaITXOieNXKIaezJEcNw+k5C0PS6miCCblG 8Qap/ajV34jM/ASmkacN87lHk7pmPW0JQFGeyF7y0jJxphzIpnX+0ryP0l4+2vnk rIQeX7k/ghPR5Y3zgrW43+YDcsoj5Tk2ZWF0xM= Received: (qmail 8860 invoked by alias); 22 Oct 2019 11:38:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 8852 invoked by uid 89); 22 Oct 2019 11:37:59 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx0a-001b2d01.pphosted.com Subject: Re: [PATCH] S390: Remove not needed stack frame in syscall function. To: Florian Weimer Cc: GNU C Library References: <0e66f775-9669-ff29-e605-195b79382b3e@linux.ibm.com> <87o8y9krf9.fsf@oldenburg2.str.redhat.com> From: Stefan Liebler Date: Tue, 22 Oct 2019 13:37:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <87o8y9krf9.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit x-cbid: 19102211-0008-0000-0000-000003257207 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19102211-0009-0000-0000-00004A449D78 Message-Id: <0ca333b6-3faf-df73-bb24-d03aa155dfb9@linux.ibm.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