1 /* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2006 Free Software 2 Foundation, Inc. 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 <http://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 #include <sgidefs.h> 25 #include <signal.h> 26 27 /* We need the signal context definitions even if they are not used 28 included in <signal.h>. */ 29 #include <bits/sigcontext.h> 30 31 /* Type for general register. Even in o32 we assume 64-bit registers, 32 like the kernel. */ 33 __extension__ typedef unsigned long long int greg_t; 34 35 /* Number of general registers. */ 36 #define NGREG 32 37 #define NFPREG 32 38 39 /* Container for all general registers. */ 40 typedef greg_t gregset_t[NGREG]; 41 42 /* Container for all FPU registers. */ 43 typedef struct fpregset { 44 union { 45 double fp_dregs[NFPREG]; 46 struct { 47 float _fp_fregs; 48 unsigned int _fp_pad; 49 } fp_fregs[NFPREG]; 50 } fp_r; 51 } fpregset_t; 52 53 54 /* Context to describe whole processor state. */ 55 #if _MIPS_SIM == _ABIO32 56 /* Earlier versions of glibc for mips had an entirely different 57 definition of mcontext_t, that didn't even resemble the 58 corresponding kernel data structure. Since all legitimate uses of 59 ucontext_t in glibc mustn't have accessed anything beyond 60 uc_mcontext and, even then, taking a pointer to it, casting it to 61 sigcontext_t, and accessing it as such, which is what it has always 62 been, this can still be rectified. Fortunately, makecontext, 63 [gs]etcontext et all have never been implemented. */ 64 typedef struct 65 { 66 unsigned int regmask; 67 unsigned int status; 68 greg_t pc; 69 gregset_t gregs; 70 fpregset_t fpregs; 71 unsigned int fp_owned; 72 unsigned int fpc_csr; 73 unsigned int fpc_eir; 74 unsigned int used_math; 75 unsigned int dsp; 76 greg_t mdhi; 77 greg_t mdlo; 78 unsigned long hi1; 79 unsigned long lo1; 80 unsigned long hi2; 81 unsigned long lo2; 82 unsigned long hi3; 83 unsigned long lo3; 84 } mcontext_t; 85 #else 86 typedef struct 87 { 88 gregset_t gregs; 89 fpregset_t fpregs; 90 greg_t mdhi; 91 greg_t hi1; 92 greg_t hi2; 93 greg_t hi3; 94 greg_t mdlo; 95 greg_t lo1; 96 greg_t lo2; 97 greg_t lo3; 98 greg_t pc; 99 unsigned int fpc_csr; 100 unsigned int used_math; 101 unsigned int dsp; 102 unsigned int reserved; 103 } mcontext_t; 104 #endif 105 106 /* Userlevel context. */ 107 typedef struct ucontext 108 { 109 unsigned long int uc_flags; 110 struct ucontext *uc_link; 111 stack_t uc_stack; 112 mcontext_t uc_mcontext; 113 __sigset_t uc_sigmask; 114 } ucontext_t; 115 116 #endif /* sys/ucontext.h */ 117