0004-RISC-V-Extend-MINSIGSTKSZ-and-SIGSTKSZ-to-backup-RVV.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From 05c65dd1e572b489bbd85488c2897af76a143a01 Mon Sep 17 00:00:00 2001
  2. From: Vincent Chen <vincent.chen@sifive.com>
  3. Date: Mon, 13 Sep 2021 09:41:17 +0800
  4. Subject: [PATCH 4/8] RISC-V: Extend MINSIGSTKSZ and SIGSTKSZ to backup RVV
  5. registers
  6. As using RVV extension, the original MINSIGSTKSZ is not enough to
  7. back up all RVV registers for the normal case. Therefore, the MINSIGSTKSZ
  8. is expanded to about 5K and the SIGSTKSZ is expanded to about 16K. This
  9. space is enough for the case that the VLENB of a vector register is 128
  10. bytes. For the case that VLENB > 128 bytes, users can use
  11. sysconf (_SC_MINSIGSTKSZ) and sysconf (_SC_SIGSTKSZ) to get the
  12. appropriate signal stack size.
  13. Signed-off-by: max.ma <max.ma@starfivetech.com>
  14. ---
  15. sysdeps/unix/sysv/linux/riscv/bits/sigstack.h | 32 +++++++++++++++++++
  16. 1 file changed, 32 insertions(+)
  17. create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
  18. diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
  19. new file mode 100644
  20. index 0000000000..c18512f083
  21. --- /dev/null
  22. +++ b/sysdeps/unix/sysv/linux/riscv/bits/sigstack.h
  23. @@ -0,0 +1,32 @@
  24. +/* sigstack, sigaltstack definitions.
  25. + Copyright (C) 2021 Free Software Foundation, Inc.
  26. + This file is part of the GNU C Library.
  27. +
  28. + The GNU C Library is free software; you can redistribute it and/or
  29. + modify it under the terms of the GNU Lesser General Public
  30. + License as published by the Free Software Foundation; either
  31. + version 2.1 of the License, or (at your option) any later version.
  32. +
  33. + The GNU C Library is distributed in the hope that it will be useful,
  34. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  35. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  36. + Lesser General Public License for more details.
  37. +
  38. + You should have received a copy of the GNU Lesser General Public
  39. + License along with the GNU C Library; if not, see
  40. + <https://www.gnu.org/licenses/>. */
  41. +
  42. +#ifndef _BITS_SIGSTACK_H
  43. +#define _BITS_SIGSTACK_H 1
  44. +
  45. +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
  46. +# error "Never include this file directly. Use <signal.h> instead"
  47. +#endif
  48. +
  49. +/* Minimum stack size (5k+256 bytes) for a signal handler. */
  50. +#define MINSIGSTKSZ 5376
  51. +
  52. +/* System default stack size. */
  53. +#define SIGSTKSZ 16384
  54. +
  55. +#endif /* bits/sigstack.h */
  56. --
  57. 2.33.1