Back to index

glibc  2.9
ucontext.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1999, 2001 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/m68k 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 18
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   R_D0 = 0,
00040 #define R_D0  R_D0
00041   R_D1 = 1,
00042 #define R_D1  R_D1
00043   R_D2 = 2,
00044 #define R_D2  R_D2
00045   R_D3 = 3,
00046 #define R_D3  R_D3
00047   R_D4 = 4,
00048 #define R_D4  R_D4
00049   R_D5 = 5,
00050 #define R_D5  R_D5
00051   R_D6 = 6,
00052 #define R_D6  R_D6
00053   R_D7 = 7,
00054 #define R_D7  R_D7
00055   R_A0 = 8,
00056 #define R_A0  R_A0
00057   R_A1 = 9,
00058 #define R_A1  R_A1
00059   R_A2 = 10,
00060 #define R_A2  R_A2
00061   R_A3 = 11,
00062 #define R_A3  R_A3
00063   R_A4 = 12,
00064 #define R_A4  R_A4
00065   R_A5 = 13,
00066 #define R_A5  R_A5
00067   R_A6 = 14,
00068 #define R_A6  R_A6
00069   R_A7 = 15,
00070 #define R_A7  R_A7
00071   R_SP = 15,
00072 #define R_SP  R_SP
00073   R_PC = 16,
00074 #define R_PC  R_PC
00075   R_PS = 17
00076 #define R_PS  R_PS
00077 };
00078 
00079 /* Structure to describe FPU registers.  */
00080 typedef struct fpregset
00081 {
00082   int f_pcr;
00083   int f_psr;
00084   int f_fpiaddr;
00085 #ifdef __mcoldfire__
00086   int f_fpregs[8][2];
00087 #else
00088   int f_fpregs[8][3];
00089 #endif
00090 } fpregset_t;
00091 
00092 /* Context to describe whole processor state.  */
00093 typedef struct
00094 {
00095   int version;
00096   gregset_t gregs;
00097   fpregset_t fpregs;
00098 } mcontext_t;
00099 
00100 #define MCONTEXT_VERSION 2
00101 
00102 /* Userlevel context.  */
00103 typedef struct ucontext
00104 {
00105   unsigned long uc_flags;
00106   struct ucontext *uc_link;
00107   stack_t uc_stack;
00108   mcontext_t uc_mcontext;
00109   unsigned long uc_filler[80];
00110   __sigset_t uc_sigmask;
00111 } ucontext_t;
00112 
00113 #endif /* sys/ucontext.h */