target_arch_signal.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * RISC-V signal definitions
  3. *
  4. * Copyright (c) 2019 Mark Corbin
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef TARGET_ARCH_SIGNAL_H
  20. #define TARGET_ARCH_SIGNAL_H
  21. #include "cpu.h"
  22. #define TARGET_INSN_SIZE 4 /* riscv instruction size */
  23. /* Size of the signal trampoline code placed on the stack. */
  24. #define TARGET_SZSIGCODE ((abi_ulong)(7 * TARGET_INSN_SIZE))
  25. /* Compare with riscv/include/_limits.h */
  26. #define TARGET_MINSIGSTKSZ (1024 * 4)
  27. #define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768)
  28. struct target_gpregs {
  29. uint64_t gp_ra;
  30. uint64_t gp_sp;
  31. uint64_t gp_gp;
  32. uint64_t gp_tp;
  33. uint64_t gp_t[7];
  34. uint64_t gp_s[12];
  35. uint64_t gp_a[8];
  36. uint64_t gp_sepc;
  37. uint64_t gp_sstatus;
  38. };
  39. struct target_fpregs {
  40. uint64_t fp_x[32][2];
  41. uint64_t fp_fcsr;
  42. uint32_t fp_flags;
  43. uint32_t pad;
  44. };
  45. typedef struct target_mcontext {
  46. struct target_gpregs mc_gpregs;
  47. struct target_fpregs mc_fpregs;
  48. uint32_t mc_flags;
  49. #define TARGET_MC_FP_VALID 0x01
  50. uint32_t mc_pad;
  51. uint64_t mc_spare[8];
  52. } target_mcontext_t;
  53. #define TARGET_MCONTEXT_SIZE 864
  54. #define TARGET_UCONTEXT_SIZE 936
  55. #include "target_os_ucontext.h"
  56. struct target_sigframe {
  57. target_ucontext_t sf_uc; /* = *sf_uncontext */
  58. target_siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case)*/
  59. };
  60. #define TARGET_SIGSTACK_ALIGN 16
  61. #endif /* TARGET_ARCH_SIGNAL_H */