initial commit
[glibc.git] / sysdeps / unix / sysv / linux / s390 / sys / ucontext.h
1 /* Copyright (C) 2000-2022 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 <https://www.gnu.org/licenses/>. */
17
18 #ifndef _SYS_UCONTEXT_H
19 #define _SYS_UCONTEXT_H 1
20
21 #include <features.h>
22
23 #include <bits/types/sigset_t.h>
24 #include <bits/types/stack_t.h>
25
26
27 #ifdef __USE_MISC
28 # define __ctx(fld) fld
29 #else
30 # define __ctx(fld) __ ## fld
31 #endif
32
33 /* Type for a program status word. */
34 typedef struct
35 {
36 unsigned long __ctx(mask);
37 unsigned long __ctx(addr);
38 } __attribute__ ((__aligned__(8))) __psw_t;
39
40 /* Type for a general-purpose register. */
41 typedef unsigned long greg_t;
42
43 /* And the whole bunch of them. We should have used `struct s390_regs',
44 but to avoid name space pollution and since the tradition says that
45 the register set is an array, we make gregset_t a simple array
46 that has the same size as s390_regs. This is needed for the
47 elf_prstatus structure. */
48 #if __WORDSIZE == 64
49 # define __NGREG 27
50 #else
51 # define __NGREG 36
52 #endif
53 #ifdef __USE_MISC
54 # define NGREG __NGREG
55 #endif
56 /* Must match kernels psw_t alignment. */
57 typedef greg_t gregset_t[__NGREG] __attribute__ ((__aligned__(8)));
58
59 typedef union
60 {
61 double __ctx(d);
62 float __ctx(f);
63 } fpreg_t;
64
65 /* Register set for the floating-point registers. */
66 typedef struct
67 {
68 unsigned int __ctx(fpc);
69 fpreg_t __ctx(fprs)[16];
70 } fpregset_t;
71
72 /* Context to describe whole processor state. */
73 typedef struct
74 {
75 __psw_t __ctx(psw);
76 unsigned long __ctx(gregs)[16];
77 unsigned int __ctx(aregs)[16];
78 fpregset_t __ctx(fpregs);
79 } mcontext_t;
80
81 /* Userlevel context. */
82 typedef struct ucontext_t
83 {
84 unsigned long int __ctx(uc_flags);
85 struct ucontext_t *uc_link;
86 stack_t uc_stack;
87 mcontext_t uc_mcontext;
88 sigset_t uc_sigmask;
89 } ucontext_t;
90
91 #undef __ctx
92
93
94 #endif /* sys/ucontext.h */