From nobody Tue Jun 04 23:19:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv64R74frz5MvPF; Tue, 04 Jun 2024 23:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv64R6Pp5z4F8q; Tue, 4 Jun 2024 23:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717543175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r6nxv/Q+rXiKl3tjhsa5/26M/UfaLM31ASb3L7N88r8=; b=goH3FY03HE4pk7on7mrMooh3HnqhEhN8rIki74yvaB9e8dvx0yBpHBUALoL/mRRXTrRl7S P/+D4954K67gbGdVtKbdgyMRawS1/IFY7e4xTrUppb80cA6Gr+SIbu57PUeC2gTI6mNhDs vTK8LXcB1KPwSb/MqhAW//2d93nU+qpSpPoxhRtMqh+U2Cdi6vT3sE23IIu89jivoHPXrS uXGPTbpmFmhuOJNrs2DdViUTEFoDJvcVb3c/fCzdolVfJkGQpWn3KChUBHlqJFA9QQJDU6 SlU/v2veFESjA6A0ilHtNZldPnwpKqOWyXNu7TdORl/ROfZgF1cDraBP01ihTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717543175; a=rsa-sha256; cv=none; b=A6ADBvtlu+lQWQU1/ISMMlyEMdaXZJT4BhoQutgaWa7fGjRDMeAQw7k2EdXDmp12fEnPY1 HNT9LzD+cKZyUDw9qAIsr9Am63sJ9afT/hBMFlR0DeMILCXOvPHsmJSVz2cXWTT9UK18wc YK7cDFMOVbcFRO50yj/xkRx0cmfPDV8gBKt03SWUz5eDlT7cGX2JMCRknrJHscTuphCdFN 7aKdDS54mfcMFHFKOC8KjQ8jXV505V/0JhRGqTezwbIKPLxOWWRaBb7v8W5w9zVXNn4QZn 2O/dOYP0woqxClaCkkYJ0j1eID8IC0SEpqaPNlz2tdExoEZ//NE52/FyGiKsuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717543175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r6nxv/Q+rXiKl3tjhsa5/26M/UfaLM31ASb3L7N88r8=; b=A1NSuDoQaWZqDEMLjse8Zz2VSR1C1oSoRBlTiNAzDYX8Ccz/Jqug9PScp3AHWUchYiSSZl Ebct9eSwN8gHrEB0OFEJXOS2fZCFSD6uGobn6frg8yJSmWeECgVe/DcQEY0y+2uNGep6Z7 iCw1W585AX5o67MvRgUSmbxnhEptF+GdxAU/MWOAT1iojyrOK7hcXaBYHz0XfdQyRkjojm 0NaRsg+/4Wj7oxqd0K6tC6dx+dWZtXTJbsSWFrgHmfPKMbf+ld0pMg+mDUGUoxJ5wydfiA V91twYmx/NJoN6zDYJaLGDWLEWChhjRKjDcglixX7VKhByBpJ8qq1fAFkDm2+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv64R60vyzdxb; Tue, 4 Jun 2024 23:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NJZap096624; Tue, 4 Jun 2024 23:19:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NJZ8j096621; Tue, 4 Jun 2024 23:19:35 GMT (envelope-from git) Date: Tue, 4 Jun 2024 23:19:35 GMT Message-Id: <202406042319.454NJZ8j096621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 191bf63da255 - main - riscv: Move sigcode out of locore.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 191bf63da25589f9364f99390ff81432227bb475 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=191bf63da25589f9364f99390ff81432227bb475 commit 191bf63da25589f9364f99390ff81432227bb475 Author: Mitchell Horne AuthorDate: 2024-06-04 23:18:05 +0000 Commit: Mitchell Horne CommitDate: 2024-06-04 23:18:05 +0000 riscv: Move sigcode out of locore.S It really doesn't fit here anymore as locore is all about early startup code. Thus, move it to its own file. Reviewed by: br MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45320 --- sys/conf/files.riscv | 1 + sys/riscv/riscv/locore.S | 25 ---------------- sys/riscv/riscv/sigtramp.S | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 49c8ddd0c516..90e2826ce55d 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -58,6 +58,7 @@ riscv/riscv/pmap.c standard riscv/riscv/ptrace_machdep.c standard riscv/riscv/riscv_console.c optional rcons riscv/riscv/riscv_syscon.c optional syscon riscv_syscon fdt +riscv/riscv/sigtramp.S standard riscv/riscv/sbi.c standard riscv/riscv/sbi_ipi.c optional smp riscv/riscv/stack_machdep.c optional ddb | stack diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S index 25e9b4d6d7c4..5a7e15ba443b 100644 --- a/sys/riscv/riscv/locore.S +++ b/sys/riscv/riscv/locore.S @@ -34,7 +34,6 @@ #include "assym.inc" -#include #include #include #include @@ -290,30 +289,6 @@ initstack: .space (PAGE_SIZE * KSTACK_PAGES) initstack_end: -ENTRY(sigcode) - mv a0, sp - addi a0, a0, SF_UC - -1: - li t0, SYS_sigreturn - ecall - - /* sigreturn failed, exit */ - li t0, SYS_exit - ecall - - j 1b -END(sigcode) - /* This may be copied to the stack, keep it 16-byte aligned */ - .align 3 -esigcode: - - .data - .align 3 - .global szsigcode -szsigcode: - .quad esigcode - sigcode - .align 12 pagetable_l1: .space PAGE_SIZE diff --git a/sys/riscv/riscv/sigtramp.S b/sys/riscv/riscv/sigtramp.S new file mode 100644 index 000000000000..7e45d22fb2ef --- /dev/null +++ b/sys/riscv/riscv/sigtramp.S @@ -0,0 +1,71 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2015 Ruslan Bukin + * All rights reserved. + * + * Portions of this software were developed by SRI International and the + * University of Cambridge Computer Laboratory under DARPA/AFRL contract + * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Portions of this software were developed by the University of Cambridge + * Computer Laboratory as part of the CTSRD Project, with support from the + * UK Higher Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "assym.inc" + +#include + +#include + +/* + * This code is copied to the user's stack for returning from signal handlers + * (see sendsig() and sigreturn()). We have to compute the address of the + * sigcontext struct for the sigreturn call. + */ +ENTRY(sigcode) + mv a0, sp + addi a0, a0, SF_UC + +1: + li t0, SYS_sigreturn + ecall + + /* sigreturn failed, exit */ + li t0, SYS_exit + ecall + + j 1b +END(sigcode) + + /* This may be copied to the stack, keep it 16-byte aligned */ + .align 3 +esigcode: + + .data + .align 3 + .global szsigcode +szsigcode: + .quad esigcode - sigcode