(_JMPBUF_UNWINDS): Added.
[glibc.git] / sysdeps / alpha / bits / setjmp.h
blobaf0b5ae577550598a2398b3594096dde830c1fe0
1 /* Define the machine-dependent type `jmp_buf'. Alpha version.
2 Copyright (C) 1992, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _SETJMP_H
21 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
22 #endif
24 /* The previous bits/setjmp.h had __jmp_buf defined as a structure.
25 We use an array of 'long int' instead, to make writing the
26 assembler easier. Naturally, user code should not depend on
27 either representation. */
30 * Integer registers:
31 * $0 is the return value (va);
32 * $1-$8, $22-$25, $28 are call-used (t0-t7, t8-t11, at);
33 * $9-$14 we save here (s0-s5);
34 * $15 is the FP and we save it here (fp or s6);
35 * $16-$21 are input arguments (call-used) (a0-a5);
36 * $26 is the return PC and we save it here (ra);
37 * $27 is the procedure value (i.e., the address of __setjmp) (pv or t12);
38 * $29 is the global pointer, which the caller will reconstruct
39 * from the return address restored in $26 (gp);
40 * $30 is the stack pointer and we save it here (sp);
41 * $31 is always zero (zero).
43 * Floating-point registers:
44 * $f0 is the floating return value;
45 * $f1, $f10-$f15, $f22-$f30 are call-used;
46 * $f2-$f9 we save here;
47 * $f16-$21 are input args (call-used);
48 * $f31 is always zero.
50 * Note that even on Alpha hardware that does not have an FPU (there
51 * isn't such a thing currently) it is required to implement the FP
52 * registers.
55 #if defined __USE_MISC || defined __ASSEMBLY__
56 # define JB_S0 0
57 # define JB_S1 1
58 # define JB_S2 2
59 # define JB_S3 3
60 # define JB_S4 4
61 # define JB_S5 5
62 # define JB_PC 6
63 # define JB_FP 7
64 # define JB_SP 8
65 # define JB_F2 9
66 # define JB_F3 10
67 # define JB_F4 11
68 # define JB_F5 12
69 # define JB_F6 13
70 # define JB_F7 14
71 # define JB_F8 15
72 # define JB_F9 16
73 #endif
75 #ifndef __ASSEMBLY__
76 typedef long int __jmp_buf[17];
78 /* Test if longjmp to JMPBUF would unwind the frame containing a local
79 variable at ADDRESS. */
80 #define _JMPBUF_UNWINDS(_jmpbuf, _address) \
81 ({ register void *_sp __asm__("$30"); void *_addr = (_address); \
82 _sp <= _addr && _addr < (void *)((_jmpbuf)[JB_SP]); })
83 #endif