]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/nios2/sys/ucontext.h
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / 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, see
16    <http://www.gnu.org/licenses/>.  */
17
18 #ifndef _SYS_UCONTEXT_H
19 #define _SYS_UCONTEXT_H 1
20
21 #include <features.h>
22 #include <signal.h>
23 /*
24  * Location of the users' stored registers relative to R0.
25  * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
26  */
27 #define REG_PSR (0)
28 #define REG_PC  (1)
29 #define REG_SPARE   (2)
30 #define REG_WVALID  (3)
31 #define REG_G1  (4)
32 #define REG_G2  (5)
33 #define REG_G3  (6)
34 #define REG_G4  (7)
35 #define REG_G5  (8)
36 #define REG_G6  (9)
37 #define REG_G7  (10)
38 #define REG_O0  (11)
39 #define REG_O1  (12)
40 #define REG_O2  (13)
41 #define REG_O3  (14)
42 #define REG_O4  (15)
43 #define REG_O5  (16)
44 #define REG_O6  (17)
45 #define REG_O7  (18)
46 #define REG_GLOBALS (19)
47
48 /*
49  * A gregset_t is defined as an array type for compatibility with the reference
50  * source. This is important due to differences in the way the C language
51  * treats arrays and structures as parameters.
52  *
53  * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
54  * but that the ABI defines it absolutely to be 21 (resp. 19).
55  */
56
57 #define NGREG   20
58 typedef int greg_t;
59
60 typedef greg_t  gregset_t[NGREG];
61
62 /*
63  * The following structures define how a register window can appear on the
64  * stack. This structure is available (when required) through the `gwins'
65  * field of an mcontext (nested within ucontext). NIOS_MAXWINDOW is the
66  * maximum number of outstanding register windows defined in the NIOS
67  * architecture (*not* implementation).
68  */
69 #define NIOS_MAXREGWINDOW       31      /* max windows in NIOS arch. */
70 struct  rwindow
71   {
72     greg_t rw_local[8];                 /* locals */
73     greg_t rw_in[8];                    /* ins */
74   };
75
76 #define rw_fp   rw_in[6]                /* frame pointer */
77 #define rw_rtn  rw_in[7]                /* return address */
78
79 typedef struct gwindows
80   {
81     int            wbcnt;
82     int           *spbuf[NIOS_MAXREGWINDOW];
83     struct rwindow wbuf[NIOS_MAXREGWINDOW];
84   } gwindows_t;
85
86 typedef struct
87   {
88     gregset_t   gregs;          /* general register set */
89     gwindows_t  *gwins;         /* POSSIBLE pointer to register windows */
90   } mcontext_t;
91
92
93 /* Userlevel context.  */
94 typedef struct ucontext
95   {
96     unsigned long   uc_flags;
97     struct ucontext *uc_link;
98     __sigset_t      uc_sigmask;
99     stack_t         uc_stack;
100     mcontext_t      uc_mcontext;
101   } ucontext_t;
102
103 #endif /* sys/ucontext.h */