From 05c65dd1e572b489bbd85488c2897af76a143a01 Mon Sep 17 00:00:00 2001 From: Vincent Chen Date: Mon, 13 Sep 2021 09:41:17 +0800 Subject: [PATCH 4/8] RISC-V: Extend MINSIGSTKSZ and SIGSTKSZ to backup RVV registers 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. Signed-off-by: max.ma --- 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 0000000000..c18512f083 --- /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 */ -- 2.33.1