Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* Copyright (C) 1991-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 | /* Copied from setjmp/setjmp.h, powerpc/bits/setjmp.h and modified |
19 | appropriately to keep backward compatible with setjmp without |
20 | AltiVec/VMX support. |
21 | |
22 | This file is not exported and the interfaces are private to libc. */ |
23 | |
24 | #ifndef __NOVMX_SETJMP_H |
25 | #define __NOVMX_SETJMP_H 1 |
26 | |
27 | #include <bits/wordsize.h> |
28 | |
29 | /* The following definitions are needed by ASM implementations of the old |
30 | (novmx) __longjmp/__setjmp functions. */ |
31 | |
32 | # define JB_GPR1 0 /* Also known as the stack pointer */ |
33 | # define JB_GPR2 1 |
34 | # define JB_LR 2 /* The address we will return to */ |
35 | # if __WORDSIZE == 64 |
36 | # define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18*2 words total. */ |
37 | # define JB_CR 21 /* Condition code registers. */ |
38 | # define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */ |
39 | # define JB_SIZE (40 * 8) |
40 | # else |
41 | # define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total. */ |
42 | # define JB_CR 21 /* Condition code registers. */ |
43 | # define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total. */ |
44 | # define JB_SIZE (58 * 4) |
45 | # endif |
46 | |
47 | #ifndef _ASM |
48 | /* The following definitions are needed by the novmx* implementations of |
49 | setjmp/longjmp/sigsetjmp/etc that wrapper __setjmp/__longjmp. */ |
50 | |
51 | # if __WORDSIZE == 64 |
52 | typedef long int __jmp_buf[40]; |
53 | # else |
54 | typedef long int __jmp_buf[58]; |
55 | # endif |
56 | |
57 | # include <bits/types/__sigset_t.h> |
58 | |
59 | /* Calling environment, plus possibly a saved signal mask. */ |
60 | typedef struct __novmx__jmp_buf_tag |
61 | { |
62 | /* NOTE: The machine-dependent definitions of `__sigsetjmp' |
63 | assume that a `jmp_buf' begins with a `__jmp_buf' and that |
64 | `__mask_was_saved' follows it. Do not move these members |
65 | or add others before it. */ |
66 | __jmp_buf __jmpbuf; /* Calling environment. */ |
67 | int __mask_was_saved; /* Saved the signal mask? */ |
68 | __sigset_t __saved_mask; /* Saved signal mask. */ |
69 | } __novmx__jmp_buf[1]; |
70 | |
71 | |
72 | /* Store the calling environment in ENV, also saving the signal mask. |
73 | Return 0. */ |
74 | extern int __novmxsetjmp (__novmx__jmp_buf __env); |
75 | |
76 | /* Store the calling environment in ENV, also saving the |
77 | signal mask if SAVEMASK is nonzero. Return 0. |
78 | This is the internal name for `sigsetjmp'. */ |
79 | extern int __novmx__sigsetjmp (struct __novmx__jmp_buf_tag __env[1], |
80 | int __savemask); |
81 | |
82 | /* Store the calling environment in ENV, not saving the signal mask. |
83 | Return 0. */ |
84 | extern int __novmx_setjmp (struct __novmx__jmp_buf_tag __env[1]); |
85 | |
86 | /* Jump to the environment saved in ENV, making the |
87 | `setjmp' call there return VAL, or 1 if VAL is 0. */ |
88 | extern void __novmxlongjmp (struct __novmx__jmp_buf_tag __env[1], int __val) |
89 | __attribute__ ((__noreturn__)); |
90 | |
91 | /* Same. Usually `_longjmp' is used with `_setjmp', which does not save |
92 | the signal mask. But it is how ENV was saved that determines whether |
93 | `longjmp' restores the mask; `_longjmp' is just an alias. */ |
94 | extern void __novmx_longjmp (struct __novmx__jmp_buf_tag __env[1], int __val) |
95 | __attribute__ ((__noreturn__)); |
96 | |
97 | /* Use the same type for `jmp_buf' and `sigjmp_buf'. |
98 | The `__mask_was_saved' flag determines whether |
99 | or not `longjmp' will restore the signal mask. */ |
100 | typedef struct __novmx__jmp_buf_tag __novmx__sigjmp_buf[1]; |
101 | |
102 | /* Jump to the environment saved in ENV, making the |
103 | sigsetjmp call there return VAL, or 1 if VAL is 0. |
104 | Restore the signal mask if that sigsetjmp call saved it. |
105 | This is just an alias `longjmp'. */ |
106 | extern void __novmxsiglongjmp (__novmx__sigjmp_buf __env, int __val) |
107 | __attribute__ ((__noreturn__)); |
108 | |
109 | /* Internal machine-dependent function to restore context sans signal mask. */ |
110 | extern void __novmx__longjmp (__jmp_buf __env, int __val) |
111 | __attribute__ ((__noreturn__)); |
112 | |
113 | /* Internal function to possibly save the current mask of blocked signals |
114 | in ENV, and always set the flag saying whether or not it was saved. |
115 | This is used by the machine-dependent definition of `__sigsetjmp'. |
116 | Always returns zero, for convenience. */ |
117 | extern int __novmx__sigjmp_save (__novmx__jmp_buf __env, int __savemask); |
118 | |
119 | extern void _longjmp_unwind (__novmx__jmp_buf env, int val); |
120 | |
121 | extern void __novmx__libc_siglongjmp (__novmx__sigjmp_buf env, int val) |
122 | __attribute__ ((noreturn)); |
123 | |
124 | extern void __novmx__libc_longjmp (__novmx__sigjmp_buf env, int val) |
125 | __attribute__ ((noreturn)); |
126 | |
127 | libc_hidden_proto (__novmx__libc_longjmp) |
128 | libc_hidden_proto (__novmx_setjmp) |
129 | libc_hidden_proto (__novmx__sigsetjmp) |
130 | #endif /* !_ASM */ |
131 | |
132 | #endif |
133 |
Warning: This file is not a C or C++ file. It does not have highlighting.