1 /* struct ucontext definition.
2    Copyright (C) 2022 Free Software Foundation, Inc.
3 
4    This file is part of the GNU C Library.
5 
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10 
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library.  If not, see
18    <https://www.gnu.org/licenses/>.  */
19 
20 /* Don't rely on this, the interface is currently messed up and may need to
21    be broken to be fixed.  */
22 #ifndef _SYS_UCONTEXT_H
23 #define _SYS_UCONTEXT_H 1
24 
25 #include <features.h>
26 
27 #include <bits/types/sigset_t.h>
28 #include <bits/types/stack_t.h>
29 
30 #ifdef __USE_MISC
31 #define LARCH_NGREG 32
32 
33 #define LARCH_REG_RA 1
34 #define LARCH_REG_SP 3
35 #define LARCH_REG_S0 23
36 #define LARCH_REG_S1 24
37 #define LARCH_REG_A0 4
38 #define LARCH_REG_S2 25
39 #define LARCH_REG_NARGS 8
40 
41 typedef unsigned long int greg_t;
42 /* Container for all general registers.  */
43 typedef greg_t gregset_t[32];
44 #endif
45 
46 typedef struct mcontext_t
47 {
48   unsigned long long __pc;
49   unsigned long long __gregs[32];
50   unsigned int __flags;
51   unsigned long long __extcontext[0] __attribute__((__aligned__(16)));
52 } mcontext_t;
53 
54 /* Userlevel context.  */
55 typedef struct ucontext_t
56 {
57   unsigned long int __uc_flags;
58   struct ucontext_t *uc_link;
59   stack_t uc_stack;
60   sigset_t uc_sigmask;
61   mcontext_t uc_mcontext;
62 } ucontext_t;
63 
64 #endif /* sys/ucontext.h */
65