Back to index

glibc  2.9
ucontext.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997,99,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 /* System V/i386 ABI compliant context switching support.  */
00020 
00021 #ifndef _SYS_UCONTEXT_H
00022 #define _SYS_UCONTEXT_H     1
00023 
00024 #include <features.h>
00025 #include <signal.h>
00026 
00027 /* Type for general register.  */
00028 typedef int greg_t;
00029 
00030 /* Number of general registers.  */
00031 #define NGREG 19
00032 
00033 /* Container for all general registers.  */
00034 typedef greg_t gregset_t[NGREG];
00035 
00036 /* Number of each register is the `gregset_t' array.  */
00037 enum
00038 {
00039   REG_GS = 0,
00040 #define REG_GS       REG_GS
00041   REG_FS,
00042 #define REG_FS       REG_FS
00043   REG_ES,
00044 #define REG_ES       REG_ES
00045   REG_DS,
00046 #define REG_DS       REG_DS
00047   REG_EDI,
00048 #define REG_EDI      REG_EDI
00049   REG_ESI,
00050 #define REG_ESI      REG_ESI
00051   REG_EBP,
00052 #define REG_EBP      REG_EBP
00053   REG_ESP,
00054 #define REG_ESP      REG_ESP
00055   REG_EBX,
00056 #define REG_EBX      REG_EBX
00057   REG_EDX,
00058 #define REG_EDX      REG_EDX
00059   REG_ECX,
00060 #define REG_ECX      REG_ECX
00061   REG_EAX,
00062 #define REG_EAX      REG_EAX
00063   REG_TRAPNO,
00064 #define REG_TRAPNO   REG_TRAPNO
00065   REG_ERR,
00066 #define REG_ERR      REG_ERR
00067   REG_EIP,
00068 #define REG_EIP      REG_EIP
00069   REG_CS,
00070 #define REG_CS       REG_CS
00071   REG_EFL,
00072 #define REG_EFL      REG_EFL
00073   REG_UESP,
00074 #define REG_UESP     REG_UESP
00075   REG_SS
00076 #define REG_SS       REG_SS
00077 };
00078 
00079 /* Structure to describe FPU registers.  */
00080 typedef struct fpregset
00081   {
00082     union
00083       {
00084        struct fpchip_state
00085          {
00086            int state[27];
00087            int status;
00088          } fpchip_state;
00089 
00090        struct fp_emul_space
00091          {
00092            char fp_emul[246];
00093            char fp_epad[2];
00094          } fp_emul_space;
00095 
00096        int f_fpregs[62];
00097       } fp_reg_set;
00098 
00099     long int f_wregs[33];
00100   } fpregset_t;
00101 
00102 /* Context to describe whole processor state.  */
00103 typedef struct
00104   {
00105     gregset_t gregs;
00106     fpregset_t fpregs;
00107   } mcontext_t;
00108 
00109 /* Userlevel context.  */
00110 typedef struct ucontext
00111   {
00112     unsigned long int uc_flags;
00113     struct ucontext *uc_link;
00114     __sigset_t uc_sigmask;
00115     stack_t uc_stack;
00116     mcontext_t uc_mcontext;
00117     long int uc_filler[5];
00118   } ucontext_t;
00119 
00120 #endif /* sys/ucontext.h */