1 /* Copyright (C) 1997-2021 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library. If not, see 16 <https://www.gnu.org/licenses/>. */ 17 18 /* Don't rely on this, the interface is currently messed up and may need to 19 be broken to be fixed. */ 20 #ifndef _SYS_UCONTEXT_H 21 #define _SYS_UCONTEXT_H 1 22 23 #include <features.h> 24 25 #include <bits/types/sigset_t.h> 26 #include <bits/types/stack_t.h> 27 28 29 #ifdef __USE_MISC 30 # define __ctx(fld) fld 31 #else 32 # define __ctx(fld) __ ## fld 33 #endif 34 35 #ifdef __USE_MISC 36 /* Type for general register. */ 37 typedef unsigned long int greg_t; 38 39 /* Number of general registers. */ 40 # define NGREG 80 41 # define NFPREG 32 42 43 /* Container for all general registers. */ 44 typedef struct gregset 45 { 46 greg_t g_regs[32]; 47 greg_t sr_regs[8]; 48 greg_t cr_regs[24]; 49 greg_t g_pad[16]; 50 } gregset_t; 51 52 /* Container for all FPU registers. */ 53 typedef struct 54 { 55 double fp_dregs[32]; 56 } fpregset_t; 57 #endif 58 59 /* Context to describe whole processor state. */ 60 typedef struct 61 { 62 unsigned long int __ctx(sc_flags); 63 unsigned long int __ctx(sc_gr)[32]; 64 unsigned long long int __ctx(sc_fr)[32]; 65 unsigned long int __ctx(sc_iasq)[2]; 66 unsigned long int __ctx(sc_iaoq)[2]; 67 unsigned long int __ctx(sc_sar); 68 } mcontext_t; 69 70 /* Userlevel context. */ 71 typedef struct ucontext_t 72 { 73 unsigned long int __ctx(uc_flags); 74 struct ucontext_t *uc_link; 75 stack_t uc_stack; 76 mcontext_t uc_mcontext; 77 sigset_t uc_sigmask; 78 } ucontext_t; 79 80 #undef __ctx 81 82 #endif /* sys/ucontext.h */ 83