]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/mips/sys/ucontext.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / mips / sys / ucontext.h
1 /* Copyright (C) 1998-2017 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 /* System V/mips ABI compliant context switching support. */
19
20 #ifndef _SYS_UCONTEXT_H
21 #define _SYS_UCONTEXT_H 1
22
23 #include <features.h>
24 #include <signal.h>
25
26 /* We need the signal context definitions even if they are not exposed
27 by <signal.h>. */
28 #include <bits/sigcontext.h>
29 #include <bits/sigstack.h>
30
31 #include <sgidefs.h>
32
33
34 /* Type for general register. */
35 #if _MIPS_SIM == _ABIO32
36 typedef __uint32_t greg_t;
37 #else
38 typedef __uint64_t greg_t;
39 #endif
40
41 /* Number of general registers. */
42 #define NGREG 36
43
44 /* Container for all general registers. */
45 typedef greg_t gregset_t[NGREG];
46
47 /* Number of each register is the `gregset_t' array. */
48 enum
49 {
50 CTX_R0 = 0,
51 #define CTX_R0 CTX_R0
52 CTX_AT = 1,
53 #define CTX_AT CTX_AT
54 CTX_V0 = 2,
55 #define CTX_V0 CTX_V0
56 CTX_V1 = 3,
57 #define CTX_V1 CTX_V1
58 CTX_A0 = 4,
59 #define CTX_A0 CTX_A0
60 CTX_A1 = 5,
61 #define CTX_A1 CTX_A1
62 CTX_A2 = 6,
63 #define CTX_A2 CTX_A2
64 CTX_A3 = 7,
65 #define CTX_A3 CTX_A3
66 CTX_T0 = 8,
67 #define CTX_T0 CTX_T0
68 CTX_T1 = 9,
69 #define CTX_T1 CTX_T1
70 CTX_T2 = 10,
71 #define CTX_T2 CTX_T2
72 CTX_T3 = 11,
73 #define CTX_T3 CTX_T3
74 CTX_T4 = 12,
75 #define CTX_T4 CTX_T4
76 CTX_T5 = 13,
77 #define CTX_T5 CTX_T5
78 CTX_T6 = 14,
79 #define CTX_T6 CTX_T6
80 CTX_T7 = 15,
81 #define CTX_T7 CTX_T7
82 CTX_S0 = 16,
83 #define CTX_S0 CTX_S0
84 CTX_S1 = 17,
85 #define CTX_S1 CTX_S1
86 CTX_S2 = 18,
87 #define CTX_S2 CTX_S2
88 CTX_S3 = 19,
89 #define CTX_S3 CTX_S3
90 CTX_S4 = 20,
91 #define CTX_S4 CTX_S4
92 CTX_S5 = 21,
93 #define CTX_S5 CTX_S5
94 CTX_S6 = 22,
95 #define CTX_S6 CTX_S6
96 CTX_S7 = 23,
97 #define CTX_S7 CTX_S7
98 CTX_T8 = 24,
99 #define CTX_T8 CTX_T8
100 CTX_T9 = 25,
101 #define CTX_T9 CTX_T9
102 CTX_K0 = 26,
103 #define CTX_K0 CTX_K0
104 CTX_K1 = 27,
105 #define CTX_K1 CTX_K1
106 CTX_GP = 28,
107 #define CTX_GP CTX_GP
108 CTX_SP = 29,
109 #define CTX_SP CTX_SP
110 CTX_S8 = 30,
111 #define CTX_S8 CTX_S8
112 CTX_RA = 31,
113 #define CTX_RA CTX_RA
114 CTX_MDLO = 32,
115 #define CTX_MDLO CTX_MDLO
116 CTX_MDHI = 33,
117 #define CTX_MDHI CTX_MDHI
118 CTX_CAUSE = 34,
119 #define CTX_CAUSE CTX_CAUSE
120 CTX_EPC = 35,
121 #define CTX_EPC CTX_EPC
122 };
123
124 /* Structure to describe FPU registers. */
125 typedef struct fpregset
126 {
127 union
128 {
129 #if _MIPS_SIM == _ABIO32
130 double fp_dregs[16];
131 float fp_fregs[32];
132 unsigned int fp_regs[32];
133 #else
134 double fp_dregs[32];
135 /* float fp_fregs[32]; */
136 __uint64_t fp_regs[32];
137 #endif
138 } fp_r;
139 unsigned int fp_csr;
140 unsigned int fp_pad;
141 } fpregset_t;
142
143 /* Context to describe whole processor state. */
144 typedef struct
145 {
146 gregset_t gpregs;
147 fpregset_t fpregs;
148 } mcontext_t;
149
150 /* Userlevel context. */
151 typedef struct ucontext
152 {
153 #if _MIPS_SIM == _ABIO32
154 unsigned long int uc_flags;
155 #else
156 __uint64_t uc_flags;
157 #endif
158 struct ucontext *uc_link;
159 __sigset_t uc_sigmask;
160 stack_t uc_stack;
161 mcontext_t uc_mcontext;
162 int uc_filler[48];
163 } ucontext_t;
164
165 #endif /* sys/ucontext.h */