From nobody Thu Mar 21 10:13:44 2024 X-Original-To: dev-commits-src-all@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 4V0hBJ5zk7z5FkNb; Thu, 21 Mar 2024 10:13:44 +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 4V0hBJ3qzrz44sk; Thu, 21 Mar 2024 10:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711016024; 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=HU9xsPD5kYYKn0Dn3bNESVQxeD+au7b6KWf9BuaYSek=; b=tMaVEcnEDhqgo2ibpyacqYLkZreO9O3FFoLaM2dc8vF+nvt95gWYP43+QnnjDQfq/cD0Ii wenJOxmT82f0PsUFQ0FB5gGAoryMZGloCzi7LmXpdM7VnBpq8hnJboIWXp65WnFMRVM6tn 0HkcajPipMUljwp0zAHESKf3Uksq1cPhgdm4yFIfbV5DCbcOYZN8mBDBJs1bnRWT84q0Ae PHy2l7grogWyjOnfM+oBOsfbBO63dvbYLfWXGiVaGIWGLHtDsISWSWbgZxbw3+4J/LeUkh ZsZB5W0ezqwcPTuB/Ajy+RyPmmD0rHt9QUYU9uam9sh17Wy+buaNXXaqc8tqtQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711016024; a=rsa-sha256; cv=none; b=ZARPQPjx52c1o8TayWUzNPD0vfnV9RGOzC0kv40mDQbh6qJixAlyxTuJiIrUGqd4hKuGRS lzZAj6N+NnL6sDNRMupZ+h+wvfooGBCo6rTa/GUJ/mqZsz2sAh4xlxfa/eE0u6lzQ7uMQH pEGQuaNk0OMnF4D47tfCPQzGQM8u+Ph8szzWcLLIi9RQB4/s3HPquc46aj8Ryg/KUeZpLj db1L6bdPD2TVP/srVamuqJTyfyu72Q/GZLBPVwqf/0rP4kNIox9TM4FC+yUGvr4XPgWxDc jz8GFMCu5QArweLTFcJq0+Ckb3T9hFp/3wwS8cRshtNJxWBhlsxY8gVABDqsWg== 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=1711016024; 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=HU9xsPD5kYYKn0Dn3bNESVQxeD+au7b6KWf9BuaYSek=; b=OYCouYVwavTS463Ifrl/EeeUt1hwFvoXZlabthY64YE9R/636otyXjzvx1bP/rhoW3blWK weOGCGANxqqF94XvjvmlBdImauDzhwu4DHY+8o+aAq/CMMPaeUmA6B6l6p+3WlN9JtlUAh ve85P2Ud0DQvJrgOhvTcx1SlciKtd/C0OYTBLNYfl1jP3DLGu8HS957z85JQBrxMVEZxbc kAjwOFmnHYKYCKbiNAz96mWFKKFpJPWH/zkDj1dS89G/LsME08ZwFChonntO+oOyx994an coE8DrktbXujsapS4GnkVmxnSBHduQ6UJLKXCeUv5mzRdk/G6rPUg0HABX9d0A== 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 4V0hBJ3QSCzX3g; Thu, 21 Mar 2024 10:13:44 +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 42LADip0032260; Thu, 21 Mar 2024 10:13:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42LADi4w032257; Thu, 21 Mar 2024 10:13:44 GMT (envelope-from git) Date: Thu, 21 Mar 2024 10:13:44 GMT Message-Id: <202403211013.42LADi4w032257@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: fd6b1cc34e41 - main - libc/aarch64: Copy the trivial getcontextx List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd6b1cc34e4175c1e223f42540debb74cfe3c3e6 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=fd6b1cc34e4175c1e223f42540debb74cfe3c3e6 commit fd6b1cc34e4175c1e223f42540debb74cfe3c3e6 Author: Andrew Turner AuthorDate: 2024-02-28 16:09:17 +0000 Commit: Andrew Turner CommitDate: 2024-03-21 10:13:24 +0000 libc/aarch64: Copy the trivial getcontextx This will be used as the base of a non-trivial implementation. Reviewed by: kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44254 --- lib/libc/aarch64/gen/Makefile.inc | 4 +-- lib/libc/aarch64/gen/getcontextx.c | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc index 5e4fccf143e4..4f4fb3d199bf 100644 --- a/lib/libc/aarch64/gen/Makefile.inc +++ b/lib/libc/aarch64/gen/Makefile.inc @@ -6,10 +6,10 @@ SRCS+= _ctx_start.S \ flt_rounds.c \ fpgetmask.c \ fpsetmask.c \ + getcontextx.c \ infinity.c \ ldexp.c \ makecontext.c \ _setjmp.S \ setjmp.S \ - sigsetjmp.S \ - trivial-getcontextx.c + sigsetjmp.S diff --git a/lib/libc/aarch64/gen/getcontextx.c b/lib/libc/aarch64/gen/getcontextx.c new file mode 100644 index 000000000000..b9d4522d96ee --- /dev/null +++ b/lib/libc/aarch64/gen/getcontextx.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Konstantin Belousov + * All rights reserved. + * + * 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 ``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 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 +#include +#include +#include + +int +__getcontextx_size(void) +{ + + return (sizeof(ucontext_t)); +} + +int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int +__fillcontextx(char *ctx) +{ + ucontext_t *ucp; + + ucp = (ucontext_t *)ctx; + return (getcontext(ucp)); +} + +__weak_reference(__getcontextx, getcontextx); + +ucontext_t * +__getcontextx(void) +{ + char *ctx; + int error; + + ctx = malloc(__getcontextx_size()); + if (ctx == NULL) + return (NULL); + if (__fillcontextx(ctx) == -1) { + error = errno; + free(ctx); + errno = error; + return (NULL); + } + return ((ucontext_t *)ctx); +}