1 /* Copyright (C) 2011-2018 Free Software Foundation, Inc. 2 3 The GNU C Library is free software; you can redistribute it and/or 4 modify it under the terms of the GNU Lesser General Public 5 License as published by the Free Software Foundation; either 6 version 2.1 of the License, or (at your option) any later version. 7 8 The GNU C Library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public 14 License along with the GNU C Library. If not, see 15 <http://www.gnu.org/licenses/>. */ 16 17 #ifndef _SYS_UCONTEXT_H 18 #define _SYS_UCONTEXT_H 1 19 20 #include <features.h> 21 #include <signal.h> 22 #include <bits/sigcontext.h> 23 24 #ifdef __USE_MISC 25 # define __ctx(fld) fld 26 #else 27 # define __ctx(fld) __ ## fld 28 #endif 29 30 #ifdef __USE_MISC 31 /* Get register type and register names. */ 32 # include <arch/abi.h> 33 34 35 /* Type for general register. */ 36 typedef uint_reg_t greg_t; 37 38 /* Number of general registers. Must agree with <asm/ptrace.h>. */ 39 # define NGREG 64 40 41 /* Container for all general registers. */ 42 typedef greg_t gregset_t[NGREG]; 43 #endif 44 45 #ifdef __USE_GNU 46 /* Names for interesting registers in the `gregset_t' array. */ 47 enum 48 { 49 /* ... r0 through r51 are just 0 through 51 ... */ 50 REG_FP = TREG_FP, 51 # define REG_FP REG_FP 52 REG_TP = TREG_TP, 53 # define REG_TP REG_TP 54 REG_SP = TREG_SP, 55 # define REG_SP REG_SP 56 REG_LR = TREG_LR, 57 # define REG_LR REG_LR 58 }; 59 #endif 60 61 #define __need_int_reg_t 62 #include <arch/abi.h> 63 64 /* A machine context is exactly a sigcontext. */ 65 typedef struct 66 { 67 __extension__ union 68 { 69 __uint_reg_t __ctx(gregs)[56]; 70 __extension__ struct 71 { 72 __uint_reg_t __ctx(__gregs)[53]; 73 __uint_reg_t __ctx(tp); 74 __uint_reg_t __ctx(sp); 75 __uint_reg_t __ctx(lr); 76 }; 77 }; 78 __uint_reg_t __ctx(pc); 79 __uint_reg_t __ctx(ics); 80 __uint_reg_t __ctx(faultnum); 81 __uint_reg_t __glibc_reserved1[5]; 82 } mcontext_t; 83 84 /* Userlevel context. */ 85 typedef struct ucontext 86 { 87 unsigned long int __ctx(uc_flags); 88 struct ucontext *uc_link; 89 stack_t uc_stack; 90 mcontext_t uc_mcontext; 91 sigset_t uc_sigmask; 92 } ucontext_t; 93 94 #undef __ctx 95 96 #endif /* sys/ucontext.h */ 97