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.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FROM,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 16501 invoked from network); 3 Sep 2020 11:25:12 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2020 11:25:12 -0000 Received: (qmail 19522 invoked by uid 550); 3 Sep 2020 11:24:15 -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 18120 invoked from network); 3 Sep 2020 11:24:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=cwVk/Gg7/1ZHN 13TVwk8xJuh8Ho6yLIEsARxWhb8ju0=; b=YLyg4ncIvDfPx17ednnkxO//g/5FX s16j9u17fQtyjdTT6UlcNSUGInDxXhBVT64bkTCam2BJkRQ8T3P+z9TSvffJVG2X joDIfG3GrqjVgUtQZwX9dCuidqoxBdmIPUTV9AjN1NH9JxftfnoFLexGV0JrHaIf tajMlJyhv1YUCV6UBb6Jf4KJHGKEx/qL/4ruDIZqQGEcFfSp1GZtupYOsQSQqmS7 AbgFK6dqog7ocP86l0lrNByArbn3u4drTFZ2Pw+qeQpnr3jO86oi16mkDx7cc9Md 1nMq0ibA3MaT3ugVIdaeOL6nqnVEZmFyCEVY1RdLraM9LcKjKk7cP9xbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=cwVk/Gg7/1ZHN13TVwk8xJuh8Ho6yLIEsARxWhb8ju0=; b=tMo2uLDD p2p0GK9X2yphxC/UMAYuihJa3KjCUWbn6S8gCRU7Oe74HCloVv+JfbQNqksGGtQe DwGGJaFAdNhZl+xW0/rMGe9DyD332mMdedH7RVo0Yqg6f50l5KaebZzHXsjSqnQc Ww96yeIlVAYk5gbE7N+cT4B/5WckdtnMkYqXdHAFrtaPG+ZRAYimr7j2+Pza0USR 2JAgLVeaz5xDZpUyANg1A3xquKLrmY8ErzGaoCVRd/KOjjp/7eFIJaMXzu/UTo42 RSrHkeqrqk0UIshl73GviY68YtS75y4/JpeVDkIO14OeJnknEeeaBK3bw9Dhnnov BZo8qiyUyurKbg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeguddggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufhtvghfrghnucfqkdftvggrrhcuoehsohhrvggrrhesfhgr shhtmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeefueevheevgfettdffgedvff duledutdeufffgtddtueffueejudelleduheevheenucffohhmrghinheplhhonhhgjhhm phdrshgspdhsvghtjhhmphdrshgspdhrvghsthhorhgvrdhssgdpshhighhsvghtjhhmph drshgsnecukfhppedvtdelrdeirdduheegrdefgeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehsohhrvggrrhesfhgrshhtmhgrihhlrdgtoh hm X-ME-Proxy: From: Stefan O'Rear To: musl@lists.openwall.com Cc: Stefan O'Rear Date: Thu, 3 Sep 2020 07:23:08 -0400 Message-Id: <20200903112309.102601-14-sorear@fastmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200903112309.102601-1-sorear@fastmail.com> References: <20200903112309.102601-1-sorear@fastmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH 13/14] riscv32: Add jmp_buf and sigreturn Largely copied from riscv64 but required recalculation of offsets. --- src/setjmp/riscv32/longjmp.S | 42 ++++++++++++++++++++++++++++++++++ src/setjmp/riscv32/setjmp.S | 41 +++++++++++++++++++++++++++++++++ src/signal/riscv32/restore.s | 8 +++++++ src/signal/riscv32/sigsetjmp.s | 23 +++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 src/setjmp/riscv32/longjmp.S create mode 100644 src/setjmp/riscv32/setjmp.S create mode 100644 src/signal/riscv32/restore.s create mode 100644 src/signal/riscv32/sigsetjmp.s diff --git a/src/setjmp/riscv32/longjmp.S b/src/setjmp/riscv32/longjmp.S new file mode 100644 index 00000000..f9cb3318 --- /dev/null +++ b/src/setjmp/riscv32/longjmp.S @@ -0,0 +1,42 @@ +.global __longjmp +.global _longjmp +.global longjmp +.type __longjmp, %function +.type _longjmp, %function +.type longjmp, %function +__longjmp: +_longjmp: +longjmp: + lw s0, 0(a0) + lw s1, 4(a0) + lw s2, 8(a0) + lw s3, 12(a0) + lw s4, 16(a0) + lw s5, 20(a0) + lw s6, 24(a0) + lw s7, 28(a0) + lw s8, 32(a0) + lw s9, 36(a0) + lw s10, 40(a0) + lw s11, 44(a0) + lw sp, 48(a0) + lw ra, 52(a0) + +#ifndef __riscv_float_abi_soft + fld fs0, 56(a0) + fld fs1, 64(a0) + fld fs2, 72(a0) + fld fs3, 80(a0) + fld fs4, 88(a0) + fld fs5, 96(a0) + fld fs6, 104(a0) + fld fs7, 112(a0) + fld fs8, 120(a0) + fld fs9, 128(a0) + fld fs10, 136(a0) + fld fs11, 144(a0) +#endif + + seqz a0, a1 + add a0, a0, a1 + ret diff --git a/src/setjmp/riscv32/setjmp.S b/src/setjmp/riscv32/setjmp.S new file mode 100644 index 00000000..8a75cf55 --- /dev/null +++ b/src/setjmp/riscv32/setjmp.S @@ -0,0 +1,41 @@ +.global __setjmp +.global _setjmp +.global setjmp +.type __setjmp, %function +.type _setjmp, %function +.type setjmp, %function +__setjmp: +_setjmp: +setjmp: + sw s0, 0(a0) + sw s1, 4(a0) + sw s2, 8(a0) + sw s3, 12(a0) + sw s4, 16(a0) + sw s5, 20(a0) + sw s6, 24(a0) + sw s7, 28(a0) + sw s8, 32(a0) + sw s9, 36(a0) + sw s10, 40(a0) + sw s11, 44(a0) + sw sp, 48(a0) + sw ra, 52(a0) + +#ifndef __riscv_float_abi_soft + fsd fs0, 56(a0) + fsd fs1, 64(a0) + fsd fs2, 72(a0) + fsd fs3, 80(a0) + fsd fs4, 88(a0) + fsd fs5, 96(a0) + fsd fs6, 104(a0) + fsd fs7, 112(a0) + fsd fs8, 120(a0) + fsd fs9, 128(a0) + fsd fs10, 136(a0) + fsd fs11, 144(a0) +#endif + + li a0, 0 + ret diff --git a/src/signal/riscv32/restore.s b/src/signal/riscv32/restore.s new file mode 100644 index 00000000..40012c75 --- /dev/null +++ b/src/signal/riscv32/restore.s @@ -0,0 +1,8 @@ +.global __restore +.type __restore, %function +__restore: +.global __restore_rt +.type __restore_rt, %function +__restore_rt: + li a7, 139 # SYS_rt_sigreturn + ecall diff --git a/src/signal/riscv32/sigsetjmp.s b/src/signal/riscv32/sigsetjmp.s new file mode 100644 index 00000000..c1caeab1 --- /dev/null +++ b/src/signal/riscv32/sigsetjmp.s @@ -0,0 +1,23 @@ +.global sigsetjmp +.global __sigsetjmp +.type sigsetjmp, %function +.type __sigsetjmp, %function +sigsetjmp: +__sigsetjmp: + bnez a1, 1f + tail setjmp +1: + + sw ra, 152(a0) + sw s0, 164(a0) + mv s0, a0 + + call setjmp + + mv a1, a0 + mv a0, s0 + lw s0, 164(a0) + lw ra, 152(a0) + +.hidden __sigsetjmp_tail + tail __sigsetjmp_tail -- 2.25.4