Back to index

glibc  2.9
ucontext.h
Go to the documentation of this file.
00001 /* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
00002    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _SYS_UCONTEXT_H
00021 #define _SYS_UCONTEXT_H     1
00022 /* Forward definition to avoid parse errors */
00023 struct ucontext;
00024 typedef struct ucontext ucontext_t;
00025 #include <features.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 a program status word.  */
00033 typedef struct
00034 {
00035   unsigned long mask;
00036   unsigned long addr;
00037 } __attribute__ ((aligned(8))) __psw_t;
00038 
00039 /* Type for a general-purpose register.  */
00040 typedef unsigned long greg_t;
00041 
00042 /* And the whole bunch of them.  We should have used `struct s390_regs',
00043    but to avoid name space pollution and since the tradition says that
00044    the register set is an array, we make gregset_t a simple array
00045    that has the same size as s390_regs.  This is needed for the
00046    elf_prstatus structure.  */
00047 #if __WORDSIZE == 64
00048 # define NGREG 27
00049 #else
00050 # define NGREG 36
00051 #endif
00052 /* Must match kernels psw_t alignment.  */
00053 typedef greg_t gregset_t[NGREG] __attribute__ ((aligned(8)));
00054 
00055 typedef union
00056   {
00057     double  d;
00058     float   f;
00059   } fpreg_t;
00060 
00061 /* Register set for the floating-point registers.  */
00062 typedef struct
00063   {
00064     unsigned int fpc;
00065     fpreg_t fprs[16];
00066   } fpregset_t;
00067 
00068 /* Context to describe whole processor state.  */
00069 typedef struct
00070   {
00071     __psw_t psw;
00072     unsigned long gregs[16];
00073     unsigned int aregs[16];
00074     fpregset_t fpregs;
00075   } mcontext_t;
00076 
00077 /* Userlevel context.  */
00078 struct ucontext
00079   {
00080     unsigned long int uc_flags;
00081     struct ucontext *uc_link;
00082     stack_t uc_stack;
00083     mcontext_t uc_mcontext;
00084     __sigset_t uc_sigmask;
00085   };
00086 
00087 
00088 #endif /* sys/ucontext.h */