From patchwork Mon Sep 13 01:41:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Chen X-Patchwork-Id: 44932 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A6BA3858034 for ; Mon, 13 Sep 2021 01:43:48 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 38F433857C7E for ; Mon, 13 Sep 2021 01:41:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 38F433857C7E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-x62a.google.com with SMTP id d17so4763281plr.12 for ; Sun, 12 Sep 2021 18:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H4V4pCGgigVbif7j1GPDfO5UHx8Ok1qmfBYd1ZgFyaM=; b=cHj1sSV6ERq+0hGmGfEpRyc1fiRFC+bfugaG0xhlAq0kIoBjrqZsZHBpEDHDaAx4JA VAASzKi3J8DwMS/D/vhHT8/4Sz4ksuM5Y7H5t+7Wk2z5kHnKKGwpHOg7g7gvJHoyglM2 XpMfzZh/mIVDMUBIRcoRmFBuZQHiDIQaVhPGTqCv5UzP+bzrtf+i/6iq6qTj8BQ0VPjH XeE3sibaUiXHDx2cMoFF4CcnAUID5l/Ogg8FqkaEc7lteYJZWMAMXJlEqonCvPTb+/W2 D0olaYSrxCEFFXavDsv7AZ4/kRDtuRq+CDhYto4DVqQJoAQKMMoVLvaF48vn6uwuVdDr khCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H4V4pCGgigVbif7j1GPDfO5UHx8Ok1qmfBYd1ZgFyaM=; b=QTrXVkPr1WEIQslGcmgNPejNpJ1OahPnR4fgJOKAu/aqHNP3loB8/2FLIXr6yvZ69c RthnN2LYsPOqEsQU4n5v0gD9c46YColLiTuQZlbSGCXH34zkErLC6WAiAdq9sL7WiYPQ cLrCjooH87UIIBGewMoS+Cdyhjh/yJarfu3iGEPEjheQj1lsaENWFuzb4hc9Uv3u++oL 2OhEWZnp1rDYLtXPWUitotYefCcoMNsz3TWcZsZJgAG7Lnhq0DjUQbcVu4PI5ZsctUK0 4EGtUZq3ReHn7zXttpvo+fFL2zq+dAkcEhwV54eOU7+MKYPfMXwu49i8iJB13eg+ivqR hbaA== X-Gm-Message-State: AOAM5328emygNNGEA1PSL2wLjrjl7hYjDemwPBXDn55mOSgo4zPV0cNE EJSILgEKuuMEzV/a43QqjRioobjIM4ghfA== X-Google-Smtp-Source: ABdhPJxnR8t69xU/JkzUb0qoQgyJVNiR0VsOUBv5ialeW0it3CxyFVa6iTioJrR1qgYLoyRDot91Tg== X-Received: by 2002:a17:90b:1c0f:: with SMTP id oc15mr8138756pjb.1.1631497304133; Sun, 12 Sep 2021 18:41:44 -0700 (PDT) Received: from localhost.localdomain (36-227-141-62.dynamic-ip.hinet.net. [36.227.141.62]) by smtp.gmail.com with ESMTPSA id i10sm5052173pfk.87.2021.09.12.18.41.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Sep 2021 18:41:43 -0700 (PDT) From: Vincent Chen To: libc-alpha@sourceware.org, palmer@dabbelt.com Subject: [RFC patch 4/5] RISC-V: Extend MINSIGSTKSZ and SIGSTKSZ to backup RVV registers Date: Mon, 13 Sep 2021 09:41:17 +0800 Message-Id: <1631497278-29829-5-git-send-email-vincent.chen@sifive.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1631497278-29829-1-git-send-email-vincent.chen@sifive.com> References: <1631497278-29829-1-git-send-email-vincent.chen@sifive.com> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@sifive.com, Vincent Chen Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" As using RVV extension, the original MINSIGSTKSZ is not enough to back up all RVV registers for the normal case. Therefore, the MINSIGSTKSZ is expanded to about 5K and the SIGSTKSZ is expanded to about 16K. This space is enough for the case that the VLENB of a vector register is 128 bytes. For the case that VLENB > 128 bytes, users can use sysconf (_SC_MINSIGSTKSZ) and sysconf (_SC_SIGSTKSZ) to get the appropriate signal stack size. --- sysdeps/unix/sysv/linux/riscv/bits/sigstack.h | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigstack.h diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h new file mode 100644 index 0000000..c18512f --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h @@ -0,0 +1,32 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_SIGSTACK_H +#define _BITS_SIGSTACK_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never include this file directly. Use instead" +#endif + +/* Minimum stack size (5k+256 bytes) for a signal handler. */ +#define MINSIGSTKSZ 5376 + +/* System default stack size. */ +#define SIGSTKSZ 16384 + +#endif /* bits/sigstack.h */