1 /* Copyright (C) 1998-2023 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
18 /* System V/mips ABI compliant context switching support. */
20 #ifndef _SYS_UCONTEXT_H
21 #define _SYS_UCONTEXT_H 1
25 #include <bits/types.h>
26 #include <bits/types/sigset_t.h>
27 #include <bits/types/stack_t.h>
32 /* Type for general register. */
33 #if _MIPS_SIM == _ABIO32
34 typedef __uint32_t greg_t
;
36 typedef __uint64_t greg_t
;
39 /* Number of general registers. */
42 # define NGREG __NGREG
45 /* Container for all general registers. */
46 typedef greg_t gregset_t
[__NGREG
];
49 /* Number of each register is the `gregset_t' array. */
53 # define CTX_R0 CTX_R0
55 # define CTX_AT CTX_AT
57 # define CTX_V0 CTX_V0
59 # define CTX_V1 CTX_V1
61 # define CTX_A0 CTX_A0
63 # define CTX_A1 CTX_A1
65 # define CTX_A2 CTX_A2
67 # define CTX_A3 CTX_A3
69 # define CTX_T0 CTX_T0
71 # define CTX_T1 CTX_T1
73 # define CTX_T2 CTX_T2
75 # define CTX_T3 CTX_T3
77 # define CTX_T4 CTX_T4
79 # define CTX_T5 CTX_T5
81 # define CTX_T6 CTX_T6
83 # define CTX_T7 CTX_T7
85 # define CTX_S0 CTX_S0
87 # define CTX_S1 CTX_S1
89 # define CTX_S2 CTX_S2
91 # define CTX_S3 CTX_S3
93 # define CTX_S4 CTX_S4
95 # define CTX_S5 CTX_S5
97 # define CTX_S6 CTX_S6
99 # define CTX_S7 CTX_S7
101 # define CTX_T8 CTX_T8
103 # define CTX_T9 CTX_T9
105 # define CTX_K0 CTX_K0
107 # define CTX_K1 CTX_K1
109 # define CTX_GP CTX_GP
111 # define CTX_SP CTX_SP
113 # define CTX_S8 CTX_S8
115 # define CTX_RA CTX_RA
117 # define CTX_MDLO CTX_MDLO
119 # define CTX_MDHI CTX_MDHI
121 # define CTX_CAUSE CTX_CAUSE
123 # define CTX_EPC CTX_EPC
128 # define __ctx(fld) fld
130 # define __ctx(fld) __ ## fld
133 /* Structure to describe FPU registers. */
138 #if _MIPS_SIM == _ABIO32
139 double __ctx(fp_dregs
)[16];
140 float __ctx(fp_fregs
)[32];
141 unsigned int __ctx(fp_regs
)[32];
143 double __ctx(fp_dregs
)[32];
144 /* float __ctx(fp_fregs)[32]; */
145 __uint64_t
__ctx(fp_regs
)[32];
148 unsigned int __ctx(fp_csr
);
149 unsigned int __ctx(fp_pad
);
152 /* Context to describe whole processor state. */
155 gregset_t
__ctx(gpregs
);
156 fpregset_t
__ctx(fpregs
);
159 /* Userlevel context. */
160 typedef struct ucontext_t
162 #if _MIPS_SIM == _ABIO32
163 unsigned long int __ctx(uc_flags
);
165 __uint64_t
__ctx(uc_flags
);
167 struct ucontext_t
*uc_link
;
170 mcontext_t uc_mcontext
;
171 int __glibc_reserved1
[48];
176 #endif /* sys/ucontext.h */