Update.
[platform/upstream/glibc.git] / sysdeps / alpha / setjmp_aux.c
1 /* Copyright (C) 1992, 1994, 1997 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 Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    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    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 /* Global register decls must come before any function defn.  */
20
21 register long int
22   r9 asm ("$9"), r10 asm ("$10"), r11 asm ("$11"), r12 asm ("$12"),
23   r13 asm ("$13"), r14 asm ("$14");
24
25 register long int *fp asm ("$15"), *sp asm ("$30"), *retpc asm ("$26");
26
27 #if 1                           /* XXX */
28 register double
29   f2 asm ("$f2"), f3 asm ("$f3"), f4 asm ("$f4"), f5 asm ("$f5"),
30   f6 asm ("$f6"), f7 asm ("$f7"), f8 asm ("$f8"), f9 asm ("$f9");
31 #endif
32
33
34 #include <setjmp.h>
35
36
37 /* Save the current program position in ENV and return 0.  */
38 int
39 __sigsetjmp_aux (sigjmp_buf env, int savemask, long int *sp, long int *fp)
40 {
41   /* Save the integer registers.  */
42   env[0].__jmpbuf[0].__9 = r9;
43   env[0].__jmpbuf[0].__10 = r10;
44   env[0].__jmpbuf[0].__11 = r11;
45   env[0].__jmpbuf[0].__12 = r12;
46   env[0].__jmpbuf[0].__13 = r13;
47   env[0].__jmpbuf[0].__14 = r14;
48
49 #if 1                           /* XXX */
50   /* Save the floating point registers.  */
51   env[0].__jmpbuf[0].__f2 = f2;
52   env[0].__jmpbuf[0].__f3 = f3;
53   env[0].__jmpbuf[0].__f4 = f4;
54   env[0].__jmpbuf[0].__f5 = f5;
55   env[0].__jmpbuf[0].__f6 = f6;
56   env[0].__jmpbuf[0].__f7 = f7;
57   env[0].__jmpbuf[0].__f8 = f8;
58   env[0].__jmpbuf[0].__f9 = f9;
59 #endif
60
61   /* Save the return address of our caller, where longjmp will jump to.  */
62   env[0].__jmpbuf[0].__pc = retpc;
63
64   /* Save the FP and SP of our caller.  The __sigsetjmp entry point
65      simply puts these in the argument registers for us to fetch.  */
66   env[0].__jmpbuf[0].__fp = fp;
67   env[0].__jmpbuf[0].__sp = sp;
68
69   /* Save the signal mask if requested.  */
70   __sigjmp_save (env, savemask);
71
72   retpc = env[0].__jmpbuf[0].__pc;      /* restore ra, ugly... */
73
74   /* Return to the original caller of __sigsetjmp.  */
75   return 0;
76 }