4fb7c90fd52a5249a624167d97304e3c579a9cb2
[platform/upstream/glibc.git] / sysdeps / unix / sysv / linux / sparc / bits / setjmp.h
1 /* Copyright (C) 1997, 1999, 2000, 2003, 2005, 2006
2    Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
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.
9
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.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _BITS_SETJMP_H
21 #define _BITS_SETJMP_H  1
22
23 #if !defined _SETJMP_H && !defined _PTHREAD_H
24 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
25 #endif
26
27 #include <bits/wordsize.h>
28
29 #if __WORDSIZE == 64
30
31 #ifndef _ASM
32 typedef struct __sparc64_jmp_buf
33   {
34     struct __sparc64_jmp_buf    *uc_link;
35     unsigned long               uc_flags;
36     unsigned long               uc_sigmask;
37     struct __sparc64_jmp_buf_mcontext
38       {
39         unsigned long           mc_gregs[19];
40         unsigned long           mc_fp;
41         unsigned long           mc_i7;
42         struct __sparc64_jmp_buf_fpu
43           {
44             union
45               {
46                 unsigned int    sregs[32];
47                 unsigned long   dregs[32];
48                 long double     qregs[16];
49               }                 mcfpu_fpregs;
50             unsigned long       mcfpu_fprs;
51             unsigned long       mcfpu_gsr;
52             void                *mcfpu_fq;
53             unsigned char       mcfpu_qcnt;
54             unsigned char       mcfpu_qentsz;
55             unsigned char       mcfpu_enab;
56           }                     mc_fpregs;
57       }                         uc_mcontext;
58   } __jmp_buf[1];
59 #endif
60
61 /* Test if longjmp to JMPBUF would unwind the frame
62    containing a local variable at ADDRESS.  */
63 #define _JMPBUF_UNWINDS(jmpbuf, address, demangle)                      \
64   ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp + 2047)
65
66 #else
67
68 #if defined __USE_MISC || defined _ASM
69 # define JB_SP  0
70 # define JB_FP  1
71 # define JB_PC  2
72 #endif
73
74 #ifndef _ASM
75 typedef int __jmp_buf[3];
76 #endif
77
78 /* Test if longjmp to JMPBUF would unwind the frame
79    containing a local variable at ADDRESS.  */
80 #define _JMPBUF_UNWINDS(jmpbuf, address, demangle)      \
81   ((int) (address) < demangle ((jmpbuf)[JB_SP]))
82
83 #endif
84
85 #endif  /* bits/setjmp.h */