From patchwork Tue Oct 22 08:00:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1181106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-106170-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="wxaTtTo4"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 46y5Xp6NSPz9sPl for ; Tue, 22 Oct 2019 19:00:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=e1//dXIbX7wXvXS5y1SHC1To/zHwkh2 C0tACofBQuzqzcF8sxRliy63GLuJHqDrlUbUoKxgbaFNtB1SCVKMBy61RSAcxbr7 PNhgZ9A8P+iFOupekSbZijrTOAL6BB+Z9qeI5Lg2arEr+D5yAw1iaus3T5s/2i9L CJJHxmOtBjGI= 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:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=u3829SbveT5twyZF/305DFUrlo0=; b=wxaTt To4IfOtu4+C6mU3+OmbdUCeoSFIJJiQrKOy8bKUoXPtOaj6YjBT5fX/alAPjVHXj Vr/87QY5yM6JhLILxTYUAb2eVS8tvYWLS+OMPFxgKTmGML/FGEkzXy8ds3Y4ZOjM sBmuZtAQnxkG2aEVFedtNGX8WT4VLsv1pApPLg= Received: (qmail 52489 invoked by alias); 22 Oct 2019 08:00:34 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 52452 invoked by uid 89); 22 Oct 2019 08:00:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=Fifth, Buy, buy, fifth X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] S390: Remove not needed stack frame in syscall function. Date: Tue, 22 Oct 2019 10:00:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 x-cbid: 19102208-0016-0000-0000-000002BB542A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19102208-0017-0000-0000-0000331C8D10 Message-Id: <0e66f775-9669-ff29-e605-195b79382b3e@linux.ibm.com> Hi, 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. Bye, Stefan commit 1349ca6793627f62d0fe96d5e0891e2e0166ba90 Author: Stefan Liebler Date: Thu Oct 17 13:49:03 2019 +0200 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. diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S index 69561d0b76..7ed36c0714 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..442f9e4878 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. */