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