signal.h (2007B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2024 Ekaitz Zarraga <ekaitz@elenq.tech> 4 * 5 * This file is part of GNU Mes. 6 * 7 * GNU Mes is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or (at 10 * your option) any later version. 11 * 12 * GNU Mes is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 // Taken from musl libc (4a16ddf5) 22 23 #define REG_PC 0 24 #define REG_RA 1 25 #define REG_SP 2 26 #define REG_TP 4 27 #define REG_S0 8 28 #define REG_A0 10 29 30 typedef unsigned long __riscv_mc_gp_state[32]; 31 32 struct __riscv_mc_f_ext_state 33 { 34 unsigned int __f[32]; 35 unsigned int __fcsr; 36 }; 37 38 struct __riscv_mc_d_ext_state 39 { 40 unsigned long long __f[32]; 41 unsigned int __fcsr; 42 }; 43 44 struct __riscv_mc_q_ext_state 45 { 46 unsigned long long __f[64]; // __attribute__((aligned(16))) 47 unsigned int __fcsr; 48 unsigned int __reserved[3]; 49 }; 50 51 union __riscv_mc_fp_state 52 { 53 struct __riscv_mc_f_ext_state __f; 54 struct __riscv_mc_d_ext_state __d; 55 struct __riscv_mc_q_ext_state __q; 56 }; 57 58 typedef struct mcontext_t 59 { 60 __riscv_mc_gp_state __gregs; 61 union __riscv_mc_fp_state __fpregs; 62 } mcontext_t; 63 64 typedef unsigned long greg_t; 65 typedef unsigned long gregset_t[32]; 66 typedef union __riscv_mc_fp_state fpregset_t; 67 68 struct sigcontext 69 { 70 gregset_t gregs; 71 fpregset_t fpregs; 72 }; 73 74 struct sigaltstack 75 { 76 void *ss_sp; 77 int ss_flags; 78 size_t ss_size; 79 }; 80 81 typedef struct __ucontext 82 { 83 unsigned long uc_flags; 84 struct __ucontext *uc_link; 85 stack_t uc_stack; 86 sigset_t uc_sigmask; 87 mcontext_t uc_mcontext; 88 } ucontext_t; 89