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