Back to index

glibc  2.9
ucontext.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
00002    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 #ifndef _SYS_UCONTEXT_H
00020 #define _SYS_UCONTEXT_H     1
00021 
00022 #include <features.h>
00023 #include <signal.h>
00024 
00025 /* We need the signal context definitions even if they are not used
00026    included in <signal.h>.  */
00027 #include <bits/sigcontext.h>
00028 
00029 
00030 /* Type for general register.  */
00031 typedef int greg_t;
00032 
00033 /* Number of general registers.  */
00034 #define NGREG 19
00035 
00036 /* Container for all general registers.  */
00037 typedef greg_t gregset_t[NGREG];
00038 
00039 #ifdef __USE_GNU
00040 /* Number of each register is the `gregset_t' array.  */
00041 enum
00042 {
00043   REG_GS = 0,
00044 # define REG_GS             REG_GS
00045   REG_FS,
00046 # define REG_FS             REG_FS
00047   REG_ES,
00048 # define REG_ES             REG_ES
00049   REG_DS,
00050 # define REG_DS             REG_DS
00051   REG_EDI,
00052 # define REG_EDI     REG_EDI
00053   REG_ESI,
00054 # define REG_ESI     REG_ESI
00055   REG_EBP,
00056 # define REG_EBP     REG_EBP
00057   REG_ESP,
00058 # define REG_ESP     REG_ESP
00059   REG_EBX,
00060 # define REG_EBX     REG_EBX
00061   REG_EDX,
00062 # define REG_EDX     REG_EDX
00063   REG_ECX,
00064 # define REG_ECX     REG_ECX
00065   REG_EAX,
00066 # define REG_EAX     REG_EAX
00067   REG_TRAPNO,
00068 # define REG_TRAPNO  REG_TRAPNO
00069   REG_ERR,
00070 # define REG_ERR     REG_ERR
00071   REG_EIP,
00072 # define REG_EIP     REG_EIP
00073   REG_CS,
00074 # define REG_CS             REG_CS
00075   REG_EFL,
00076 # define REG_EFL     REG_EFL
00077   REG_UESP,
00078 # define REG_UESP    REG_UESP
00079   REG_SS
00080 # define REG_SS      REG_SS
00081 };
00082 #endif
00083 
00084 /* Definitions taken from the kernel headers.  */
00085 struct _libc_fpreg
00086 {
00087   unsigned short int significand[4];
00088   unsigned short int exponent;
00089 };
00090 
00091 struct _libc_fpstate
00092 {
00093   unsigned long int cw;
00094   unsigned long int sw;
00095   unsigned long int tag;
00096   unsigned long int ipoff;
00097   unsigned long int cssel;
00098   unsigned long int dataoff;
00099   unsigned long int datasel;
00100   struct _libc_fpreg _st[8];
00101   unsigned long int status;
00102 };
00103 
00104 /* Structure to describe FPU registers.  */
00105 typedef struct _libc_fpstate *fpregset_t;
00106 
00107 /* Context to describe whole processor state.  */
00108 typedef struct
00109   {
00110     gregset_t gregs;
00111     /* Due to Linux's history we have to use a pointer here.  The SysV/i386
00112        ABI requires a struct with the values.  */
00113     fpregset_t fpregs;
00114     unsigned long int oldmask;
00115     unsigned long int cr2;
00116   } mcontext_t;
00117 
00118 /* Userlevel context.  */
00119 typedef struct ucontext
00120   {
00121     unsigned long int uc_flags;
00122     struct ucontext *uc_link;
00123     stack_t uc_stack;
00124     mcontext_t uc_mcontext;
00125     __sigset_t uc_sigmask;
00126     struct _libc_fpstate __fpregs_mem;
00127   } ucontext_t;
00128 
00129 #endif /* sys/ucontext.h */