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 <bits/types.h>
00024 #include <bits/sigset.h>
00025 
00026 
00027 /* Alternate, preferred interface.  */
00028 typedef struct sigaltstack
00029   {
00030     void *ss_sp;
00031     size_t ss_size;
00032     int ss_flags;
00033     int __pad[4];
00034   } stack_t;
00035 
00036 
00037 /* Forward declaration of AIX type.  */
00038 typedef struct label_t label_t;
00039 
00040 
00041 
00042 typedef unsigned int kvmhandle_t;
00043 typedef struct
00044   {
00045     unsigned long int __alloc;
00046     kvmhandle_t __srval[16];
00047   } adspace_t;
00048 
00049 
00050 
00051 #define _NGPRS 32
00052 #define _NFPRS 32
00053 
00054 struct __mstsafe
00055 {
00056   struct __mstsave *__prev;        /* Previous save area. */
00057   label_t *__kjmpbuf;                     /* Pointer to saved context.  */
00058   char *__stackfix;                /* Stack fix pointer.  */
00059   char __intpri;                   /* Interrupt priority.  */
00060   char __backt;                           /* Back-track flag.  */
00061   char __rsvd[2];                  /* Reserved.  */
00062   __pid_t __curid;                 /* Copy of curid.  */
00063 
00064   int __excp_type;                 /* Exception type for debugger.  */
00065   unsigned long int __iar;         /* Instruction address register.  */
00066   unsigned long int __msr;         /* Machine state register.  */
00067   unsigned long int __cr;          /* Condition register.  */
00068   unsigned long int __lr;          /* Link register.  */
00069   unsigned long int __ctr;         /* Count register.  */
00070   unsigned long int __xer;         /* Fixed point exception.  */
00071   unsigned long int __mq;          /* Multiply/quotient register.  */
00072   unsigned long int __tid;         /* TID register.  */
00073   unsigned long int __fpscr;              /* Floating point status reg.  */
00074   char __fpeu;                            /* Floating point ever used.  */
00075   char __fpinfo;                   /* Floating point status flags.  */
00076   char __pad[2];                   /* Pad to dword boundary.  */
00077                                         /* 1 implies state is in mstext */
00078   unsigned long int __except[5];   /* exception structure.  */
00079   char __pad1[4];                  /* Old bus field.  */
00080   unsigned long int __o_iar;              /* Old iar (for longjmp excpt).  */
00081   unsigned long int __o_toc;              /* Old toc (for longjmp excpt).  */
00082   unsigned long int __o_arg1;             /* Old arg1 (for longjmp excpt).  */
00083   unsigned long int __excbranch;   /* If not NULL, address to branch
00084                                       to on exception.  Used by
00085                                       assembler routines for low
00086                                       cost exception handling.  */
00087   unsigned long int __fpscrx;             /* Software extension to fpscr.  */
00088   unsigned long int __o_vaddr;            /* Saved vaddr for vmexception.  */
00089   unsigned long int __cachealign[7];      /* Reserved.  */
00090   adspace_t __as;                  /* Segment registers.  */
00091   unsigned long int __gpr[_NGPRS]; /* General purpose registers.  */
00092   double __fpr[_NFPRS];                   /* Floating point registers.  */
00093     };
00094 
00095 typedef struct mcontext_t
00096   {
00097     struct __mstsafe __jmp_context;
00098   } mcontext_t;
00099 
00100 
00101 typedef struct ucontext_t
00102   {
00103     int __sc_onstack;              /* Sigstack state to restore.  */
00104     __sigset_t uc_sigmask;  /* The set of signals that are blocked when
00105                                    this context is active.  */
00106     int __sc_uerror;        /* u_error to restore.  */
00107     mcontext_t uc_mcontext; /* Machine-specific image of saved context.  */
00108     struct ucontext_t *uc_link;    /* context resumed after this one returns */
00109     stack_t uc_stack;              /* stack used by context */
00110     int __pad[4];
00111   } ucontext_t;
00112 
00113 #endif /* sys/ucontext.h */