From nobody Mon Sep 02 08:50:38 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 4Wy2XH3YHFz5MnlW; Mon, 02 Sep 2024 08:50:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wy2XH0KDYz424P; Mon, 2 Sep 2024 08:50:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725267039; 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=6HSaR5Ag5KQ05MxtTGyGmZmELXvIqfeF376/5Y7Tubk=; b=OAjsPNaTgNx0sMqD3ZWbKiuwEQVNlwEcxVc3FQhbjj6W0CKz3y+QhbDQowmrPtuOLIHDWp ip2vOpJd0wY8gKWK6M1yH4CF+H9cRopJ4osfibnfsUxhnJu7wfdqly2/sXlWy6IHJBPy2y lGMVctE+XKj47637uspfiWT8qeiYxB510A+8qWs1Ose9pTL8hduB0+ae9h7LZPKwJ/R6Yg Z8dk7rCNmb3N5BCOXoS01ADby7zFnpohw0AYuxlt+qRvhYRYzbFipZZ0IrZItZc5gqfhzr QrV6AV1Ntu9CwLqBy6/TLLoO2APVmzKROg3BdK+7AZhscVpNuwyW4hca9RfArQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725267039; a=rsa-sha256; cv=none; b=vlbC6vHeuARI5lOe8ftjL0XA4jcnvIxbLqxFeebBOtdfD0ShlIh25Lr/WH3eIFBTHbDAj0 aLwE3ymdjnYgOI4eSaKOZlVTBUoVUvbHznE6Jvf/MqUD3C5PHKoCcj+IknH8IHTDSkMspR A5Qghhuaa/GLILc9oRtuDPtXyzScr4LBFQcqDL5uxBk/77CLRXnBDWSG3b9eUv4rmfjWp/ vooflLWt4nzzpIbL5jA4Ju5CaHPG0gsuCBEsiqXOVP4a+7mXkuURzQB/82OGz+T3S3aaod f0dYGZRxSL3IejlyoH0yH37JblxltDAbgNSK8HsyhUEZvbm1ZGFkoljdDzhnIQ== 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=1725267039; 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=6HSaR5Ag5KQ05MxtTGyGmZmELXvIqfeF376/5Y7Tubk=; b=vbaToSH09vv9FqO40m2PnmWT07cCnXs4pFNQCsu9+2K2S/rKLcGKGG7AGFmn1Qh8LQVnuK 8dCWSLt/LGZgqxqoO8Df7qwq91iqp6IVTlUS9EXWPXg4Cync8rlUUNLbrhyrBg91KsYcdt fG3V+wlml39t/ZQ1OGfH1bwYMCaS1UK4FFffmBI01j4qkNXIXqIRrWl0m9EzOXf391IMZE sUUedP+lCsDnDQdaLGlZIq3bQl/pnA5H6WYV4ExSxPz5u+8LUGrNIFDmzJwFcHlR13wYZr kf4nhGKTYrIr95x6HHJy0bmX5xuBe/dHUOwiqjM+nROifj5VChXKjmYXl2LwQg== 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 4Wy2XG716Lz1590; Mon, 2 Sep 2024 08:50:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4828ocdx006953; Mon, 2 Sep 2024 08:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4828ocVY006950; Mon, 2 Sep 2024 08:50:38 GMT (envelope-from git) Date: Mon, 2 Sep 2024 08:50:38 GMT Message-Id: <202409020850.4828ocVY006950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: fd443b71fa2e - stable/14 - 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: fd443b71fa2eda2a125856acb446dd3cc72e053c Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=fd443b71fa2eda2a125856acb446dd3cc72e053c commit fd443b71fa2eda2a125856acb446dd3cc72e053c Author: Andrew Turner AuthorDate: 2024-02-28 16:09:17 +0000 Commit: Andrew Turner CommitDate: 2024-09-02 08:44:29 +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 (cherry picked from commit fd6b1cc34e4175c1e223f42540debb74cfe3c3e6) --- 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); +}