1 /* struct ucontext definition, RISC-V version.
2 Copyright (C) 1997-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
19 /* Don't rely on this, the interface is currently messed up and may need to
20 be broken to be fixed. */
21 #ifndef _SYS_UCONTEXT_H
22 #define _SYS_UCONTEXT_H 1
26 #include <bits/types/sigset_t.h>
27 #include <bits/types/stack_t.h>
29 typedef unsigned long int __riscv_mc_gp_state
[32];
44 typedef unsigned long int greg_t
;
46 /* Container for all general registers. */
47 typedef __riscv_mc_gp_state gregset_t
;
49 /* Container for floating-point state. */
50 typedef union __riscv_mc_fp_state fpregset_t
;
53 struct __riscv_mc_f_ext_state
59 struct __riscv_mc_d_ext_state
61 unsigned long long int __f
[32];
65 struct __riscv_mc_q_ext_state
67 unsigned long long int __f
[64] __attribute__ ((__aligned__ (16)));
69 /* Reserved for expansion of sigcontext structure. Currently zeroed
70 upon signal, and must be zero upon sigreturn. */
71 unsigned int __glibc_reserved
[3];
74 union __riscv_mc_fp_state
76 struct __riscv_mc_f_ext_state __f
;
77 struct __riscv_mc_d_ext_state __d
;
78 struct __riscv_mc_q_ext_state __q
;
81 typedef struct mcontext_t
83 __riscv_mc_gp_state __gregs
;
84 union __riscv_mc_fp_state __fpregs
;
87 /* Userlevel context. */
88 typedef struct ucontext_t
90 unsigned long int __uc_flags
;
91 struct ucontext_t
*uc_link
;
94 /* There's some padding here to allow sigset_t to be expanded in the
95 future. Though this is unlikely, other architectures put uc_sigmask
96 at the end of this structure and explicitly state it can be
97 expanded, so we didn't want to box ourselves in here. */
98 char __glibc_reserved
[1024 / 8 - sizeof (sigset_t
)];
99 /* We can't put uc_sigmask at the end of this structure because we need
100 to be able to expand sigcontext in the future. For example, the
101 vector ISA extension will almost certainly add ISA state. We want
102 to ensure all user-visible ISA state can be saved and restored via a
103 ucontext, so we're putting this at the end in order to allow for
104 infinite extensibility. Since we know this will be extended and we
105 assume sigset_t won't be extended an extreme amount, we're
106 prioritizing this. */
107 mcontext_t uc_mcontext
;
110 #endif /* sys/ucontext.h */