From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24101 invoked from network); 12 Aug 2020 22:13:29 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 12 Aug 2020 22:13:29 -0000 Received: (qmail 24397 invoked by uid 550); 12 Aug 2020 22:13:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 24379 invoked from network); 12 Aug 2020 22:13:22 -0000 Date: Thu, 13 Aug 2020 00:13:11 +0200 From: Szabolcs Nagy To: Alexander Monakov , musl@lists.openwall.com Message-ID: <20200812221311.GF879655@port70.net> Mail-Followup-To: Alexander Monakov , musl@lists.openwall.com References: <20200811181116.8433-1-amonakov@ispras.ru> <20200811184527.GM3265@brightrain.aerifal.cx> <20200812214405.GE879655@port70.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="61jdw2sOBCFtR2d/" Content-Disposition: inline In-Reply-To: <20200812214405.GE879655@port70.net> Subject: Re: [musl] [PATCH 1/3] setjmp: fix x86-64 longjmp argument adjustment --61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Szabolcs Nagy [2020-08-12 23:44:05 +0200]: > diff --git a/src/setjmp/aarch64/longjmp.s b/src/setjmp/aarch64/longjmp.s > index 7c4655fa..b22042a2 100644 > --- a/src/setjmp/aarch64/longjmp.s > +++ b/src/setjmp/aarch64/longjmp.s > @@ -18,7 +18,6 @@ longjmp: > ldp d12, d13, [x0,#144] > ldp d14, d15, [x0,#160] > > - mov x0, x1 > - cbnz x1, 1f > - mov x0, #1 > + cmp w1, 0 > + csinc w0, w1, wzr, ne > 1: br x30 v2 because the 1: label is no longer used --61jdw2sOBCFtR2d/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-aarch64-fix-setjmp-return-value.patch" >From 5a842cde8974b6927fd7199e713f89852fc467cd Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 12 Aug 2020 21:00:26 +0000 Subject: [PATCH v2] aarch64: fix setjmp return value longjmp should set the return value of setjmp, but 64bit registers were used for the 0 check while the type is int. use the code that gcc generates for return val ? val : 1; --- src/setjmp/aarch64/longjmp.s | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/setjmp/aarch64/longjmp.s b/src/setjmp/aarch64/longjmp.s index 7c4655fa..0af9c50e 100644 --- a/src/setjmp/aarch64/longjmp.s +++ b/src/setjmp/aarch64/longjmp.s @@ -18,7 +18,6 @@ longjmp: ldp d12, d13, [x0,#144] ldp d14, d15, [x0,#160] - mov x0, x1 - cbnz x1, 1f - mov x0, #1 -1: br x30 + cmp w1, 0 + csinc w0, w1, wzr, ne + br x30 -- 2.28.0 --61jdw2sOBCFtR2d/--