]>
Commit | Line | Data |
---|---|---|
d614a753 | 1 | /* Copyright (C) 1998-2020 Free Software Foundation, Inc. |
d5efd131 MF |
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 | |
75efb018 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
d5efd131 MF |
17 | |
18 | #ifndef _SYS_UCONTEXT_H | |
19 | #define _SYS_UCONTEXT_H 1 | |
20 | ||
21 | #include <features.h> | |
d5efd131 | 22 | |
cfed8ece | 23 | #include <bits/types/sigset_t.h> |
0bcec532 | 24 | #include <bits/types/stack_t.h> |
c66b29f9 | 25 | |
d5efd131 | 26 | |
4fa9b3bf JM |
27 | #ifdef __USE_MISC |
28 | # define __ctx(fld) fld | |
29 | #else | |
30 | # define __ctx(fld) __ ## fld | |
31 | #endif | |
32 | ||
d5efd131 MF |
33 | /* |
34 | * These are here mostly for backwards compatibility with older Unices. | |
4fa9b3bf | 35 | * IA-64 Linux does not distinguish between "mcontext_t" and |
d5efd131 MF |
36 | * "ucontext_t" as all the necessary info is inside the former. |
37 | */ | |
38 | ||
4fa9b3bf JM |
39 | struct __ia64_fpreg_mcontext |
40 | { | |
41 | union | |
42 | { | |
43 | unsigned long __ctx(bits)[2]; | |
44 | } __ctx(u); | |
45 | } __attribute__ ((__aligned__ (16))); | |
46 | ||
47 | typedef struct | |
48 | { | |
49 | unsigned long int __ctx(sc_flags); | |
50 | unsigned long int __ctx(sc_nat); | |
51 | stack_t __ctx(sc_stack); | |
52 | unsigned long int __ctx(sc_ip); | |
53 | unsigned long int __ctx(sc_cfm); | |
54 | unsigned long int __ctx(sc_um); | |
55 | unsigned long int __ctx(sc_ar_rsc); | |
56 | unsigned long int __ctx(sc_ar_bsp); | |
57 | unsigned long int __ctx(sc_ar_rnat); | |
58 | unsigned long int __ctx(sc_ar_ccv); | |
59 | unsigned long int __ctx(sc_ar_unat); | |
60 | unsigned long int __ctx(sc_ar_fpsr); | |
61 | unsigned long int __ctx(sc_ar_pfs); | |
62 | unsigned long int __ctx(sc_ar_lc); | |
63 | unsigned long int __ctx(sc_pr); | |
64 | unsigned long int __ctx(sc_br)[8]; | |
65 | unsigned long int __ctx(sc_gr)[32]; | |
66 | struct __ia64_fpreg_mcontext __ctx(sc_fr)[128]; | |
67 | unsigned long int __ctx(sc_rbs_base); | |
68 | unsigned long int __ctx(sc_loadrs); | |
69 | unsigned long int __ctx(sc_ar25); | |
70 | unsigned long int __ctx(sc_ar26); | |
71 | unsigned long int __ctx(sc_rsvd)[12]; | |
72 | unsigned long int __ctx(sc_mask); | |
73 | } mcontext_t; | |
d5efd131 | 74 | |
91e5f2e4 | 75 | #if __GNUC_PREREQ (3, 5) |
d5efd131 | 76 | # define _SC_GR0_OFFSET \ |
4fa9b3bf | 77 | __builtin_offsetof (mcontext_t, __ctx(sc_gr)[0]) |
d5efd131 MF |
78 | #elif defined __GNUC__ |
79 | # define _SC_GR0_OFFSET \ | |
4fa9b3bf | 80 | (((char *) &((mcontext_t *) 0)->__ctx(sc_gr)[0]) - (char *) 0) |
d5efd131 MF |
81 | #else |
82 | # define _SC_GR0_OFFSET 0xc8 /* pray that this is correct... */ | |
83 | #endif | |
84 | ||
25128773 | 85 | typedef struct ucontext_t |
d5efd131 MF |
86 | { |
87 | union | |
88 | { | |
89 | mcontext_t _mc; | |
90 | struct | |
91 | { | |
92 | unsigned long _pad[_SC_GR0_OFFSET/8]; | |
25128773 | 93 | struct ucontext_t *_link; /* this should overlay sc_gr[0] */ |
d5efd131 MF |
94 | } |
95 | _uc; | |
96 | } | |
97 | _u; | |
98 | } | |
99 | ucontext_t; | |
100 | ||
101 | #define uc_mcontext _u._mc | |
4fa9b3bf JM |
102 | #define uc_sigmask _u._mc.__ctx(sc_mask) |
103 | #define uc_stack _u._mc.__ctx(sc_stack) | |
d5efd131 MF |
104 | #define uc_link _u._uc._link |
105 | ||
106 | #endif /* sys/ucontext.h */ |