Back to index

glibc  2.9
ucontext.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2006 Free Software
00002    Foundation, Inc.  This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /* Don't rely on this, the interface is currently messed up and may need to
00020    be broken to be fixed.  */
00021 #ifndef _SYS_UCONTEXT_H
00022 #define _SYS_UCONTEXT_H     1
00023 
00024 #include <features.h>
00025 #include <sgidefs.h>
00026 #include <signal.h>
00027 
00028 /* We need the signal context definitions even if they are not used
00029    included in <signal.h>.  */
00030 #include <bits/sigcontext.h>
00031 
00032 /* Type for general register.  Even in o32 we assume 64-bit registers,
00033    like the kernel.  */
00034 __extension__ typedef unsigned long long int greg_t;
00035 
00036 /* Number of general registers.  */
00037 #define NGREG 32
00038 #define NFPREG       32
00039 
00040 /* Container for all general registers.  */
00041 typedef greg_t gregset_t[NGREG];
00042 
00043 /* Container for all FPU registers.  */
00044 typedef struct fpregset {
00045        union {
00046               double fp_dregs[NFPREG];
00047               struct {
00048                      float         _fp_fregs;
00049                      unsigned int  _fp_pad;
00050               } fp_fregs[NFPREG];
00051        } fp_r;
00052 } fpregset_t;
00053 
00054 
00055 /* Context to describe whole processor state.  */
00056 #if _MIPS_SIM == _ABIO32
00057 /* Earlier versions of glibc for mips had an entirely different
00058    definition of mcontext_t, that didn't even resemble the
00059    corresponding kernel data structure.  Since all legitimate uses of
00060    ucontext_t in glibc mustn't have accessed anything beyond
00061    uc_mcontext and, even then, taking a pointer to it, casting it to
00062    sigcontext_t, and accessing it as such, which is what it has always
00063    been, this can still be rectified.  Fortunately, makecontext,
00064    [gs]etcontext et all have never been implemented.  */
00065 typedef struct
00066   {
00067     unsigned int regmask;
00068     unsigned int status;
00069     greg_t pc;
00070     gregset_t gregs;
00071     fpregset_t fpregs;
00072     unsigned int fp_owned;
00073     unsigned int fpc_csr;
00074     unsigned int fpc_eir;
00075     unsigned int used_math;
00076     unsigned int dsp;
00077     greg_t mdhi;
00078     greg_t mdlo;
00079     unsigned long hi1;
00080     unsigned long lo1;
00081     unsigned long hi2;
00082     unsigned long lo2;
00083     unsigned long hi3;
00084     unsigned long lo3;
00085   } mcontext_t;
00086 #else
00087 typedef struct
00088   {
00089     gregset_t gregs;
00090     fpregset_t fpregs;
00091     greg_t mdhi;
00092     greg_t hi1;
00093     greg_t hi2;
00094     greg_t hi3;
00095     greg_t mdlo;
00096     greg_t lo1;
00097     greg_t lo2;
00098     greg_t lo3;
00099     greg_t pc;
00100     unsigned int fpc_csr;
00101     unsigned int used_math;
00102     unsigned int dsp;
00103     unsigned int reserved;
00104   } mcontext_t;
00105 #endif
00106 
00107 /* Userlevel context.  */
00108 typedef struct ucontext
00109   {
00110     unsigned long int uc_flags;
00111     struct ucontext *uc_link;
00112     stack_t uc_stack;
00113     mcontext_t uc_mcontext;
00114     __sigset_t uc_sigmask;
00115   } ucontext_t;
00116 
00117 #endif /* sys/ucontext.h */