OSDN Git Service

1805b4eac157720520152b8e27555765d52aaa68
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / nios2 / sys / ucontext.h
1 /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
18
19 #ifndef _SYS_UCONTEXT_H
20 #define _SYS_UCONTEXT_H 1
21
22 #include <features.h>
23 #include <signal.h>
24 /*
25  * Location of the users' stored registers relative to R0.
26  * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
27  */
28 #define REG_PSR (0)
29 #define REG_PC  (1)
30 #define REG_SPARE   (2)
31 #define REG_WVALID  (3)
32 #define REG_G1  (4)
33 #define REG_G2  (5)
34 #define REG_G3  (6)
35 #define REG_G4  (7)
36 #define REG_G5  (8)
37 #define REG_G6  (9)
38 #define REG_G7  (10)
39 #define REG_O0  (11)
40 #define REG_O1  (12)
41 #define REG_O2  (13)
42 #define REG_O3  (14)
43 #define REG_O4  (15)
44 #define REG_O5  (16)
45 #define REG_O6  (17)
46 #define REG_O7  (18)
47 #define REG_GLOBALS (19)
48
49 /*
50  * A gregset_t is defined as an array type for compatibility with the reference
51  * source. This is important due to differences in the way the C language
52  * treats arrays and structures as parameters.
53  *
54  * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
55  * but that the ABI defines it absolutely to be 21 (resp. 19).
56  */
57
58 #define NGREG   20
59 typedef int greg_t;
60
61 typedef greg_t  gregset_t[NGREG];
62
63 /*
64  * The following structures define how a register window can appear on the
65  * stack. This structure is available (when required) through the `gwins'
66  * field of an mcontext (nested within ucontext). NIOS_MAXWINDOW is the
67  * maximum number of outstanding register windows defined in the NIOS
68  * architecture (*not* implementation).
69  */
70 #define NIOS_MAXREGWINDOW       31      /* max windows in NIOS arch. */
71 struct  rwindow
72   {
73     greg_t rw_local[8];                 /* locals */
74     greg_t rw_in[8];                    /* ins */
75   };
76
77 #define rw_fp   rw_in[6]                /* frame pointer */
78 #define rw_rtn  rw_in[7]                /* return address */
79
80 typedef struct gwindows
81   {
82     int            wbcnt;
83     int           *spbuf[NIOS_MAXREGWINDOW];
84     struct rwindow wbuf[NIOS_MAXREGWINDOW];
85   } gwindows_t;
86
87 typedef struct
88   {
89     gregset_t   gregs;          /* general register set */
90     gwindows_t  *gwins;         /* POSSIBLE pointer to register windows */
91   } mcontext_t;
92
93
94 /* Userlevel context.  */
95 typedef struct ucontext
96   {
97     unsigned long   uc_flags;
98     struct ucontext *uc_link;
99     __sigset_t      uc_sigmask;
100     stack_t         uc_stack;
101     mcontext_t      uc_mcontext;
102   } ucontext_t;
103
104 #endif /* sys/ucontext.h */