| 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 | |
| 20 | #ifndef TARGET_ARCH_SIGNAL_H |
| 21 | #define TARGET_ARCH_SIGNAL_H |
| 22 | |
| 23 | #include "cpu.h" |
| 24 | |
| 25 | |
| 26 | #define TARGET_INSN_SIZE 4 /* riscv instruction size */ |
| 27 | |
| 28 | /* Size of the signal trampoline code placed on the stack. */ |
| 29 | #define TARGET_SZSIGCODE ((abi_ulong)(7 * TARGET_INSN_SIZE)) |
| 30 | |
| 31 | /* Compare with riscv/include/_limits.h */ |
| 32 | #define TARGET_MINSIGSTKSZ (1024 * 4) |
| 33 | #define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) |
| 34 | |
| 35 | struct target_gpregs { |
| 36 | uint64_t gp_ra; |
| 37 | uint64_t gp_sp; |
| 38 | uint64_t gp_gp; |
| 39 | uint64_t gp_tp; |
| 40 | uint64_t gp_t[7]; |
| 41 | uint64_t gp_s[12]; |
| 42 | uint64_t gp_a[8]; |
| 43 | uint64_t gp_sepc; |
| 44 | uint64_t gp_sstatus; |
| 45 | }; |
| 46 | |
| 47 | struct target_fpregs { |
| 48 | uint64_t fp_x[32][2]; |
| 49 | uint64_t fp_fcsr; |
| 50 | uint32_t fp_flags; |
| 51 | uint32_t pad; |
| 52 | }; |
| 53 | |
| 54 | typedef struct target_mcontext { |
| 55 | struct target_gpregs mc_gpregs; |
| 56 | struct target_fpregs mc_fpregs; |
| 57 | uint32_t mc_flags; |
| 58 | #define TARGET_MC_FP_VALID 0x01 |
| 59 | uint32_t mc_pad; |
| 60 | uint64_t mc_spare[8]; |
| 61 | } target_mcontext_t; |
| 62 | |
| 63 | #define TARGET_MCONTEXT_SIZE 864 |
| 64 | #define TARGET_UCONTEXT_SIZE 936 |
| 65 | |
| 66 | #include "target_os_ucontext.h" |
| 67 | |
| 68 | struct target_sigframe { |
| 69 | target_ucontext_t sf_uc; /* = *sf_uncontext */ |
| 70 | target_siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case)*/ |
| 71 | }; |
| 72 | |
| 73 | #define TARGET_SIGSTACK_ALIGN 16 |
| 74 | |
| 75 | #endif /* TARGET_ARCH_SIGNAL_H */ |