* sysdeps/alpha/__longjmp.c (__longjmp): Remove obsolete __NORETURN ...
[glibc.git] / sysdeps / alpha / __longjmp.c
blobad0489894de681b6756f985b5f734a4cd9fda371
1 /* Copyright (C) 1992, 1994 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 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.
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.
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
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 /* Global register vars must come before any function defn. */
21 register long int
22 r9 asm ("$9"), r10 asm ("$10"), r11 asm ("$11"), r12 asm ("$12"),
23 r13 asm ("$13"), r14 asm ("$14");
25 register long int *fp asm ("$15"), *sp asm ("$30"), *retpc asm ("$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
33 #include <setjmp.h>
36 /* Jump to the position specified by ENV, causing the
37 setjmp call there to return VAL, or 1 if VAL is 0. */
38 void
39 __longjmp (const __jmp_buf env, int val)
41 /* Restore the integer registers. */
42 r9 = env[0].__9;
43 r10 = env[0].__10;
44 r11 = env[0].__11;
45 r12 = env[0].__12;
46 r13 = env[0].__13;
47 r14 = env[0].__14;
49 #if 1 /* XXX */
50 /* Restore the floating point registers. */
51 f2 = env[0].__f2;
52 f3 = env[0].__f3;
53 f4 = env[0].__f4;
54 f5 = env[0].__f5;
55 f6 = env[0].__f6;
56 f7 = env[0].__f7;
57 f8 = env[0].__f8;
58 f9 = env[0].__f9;
59 #endif
61 /* Set the return PC to that of setjmp's caller. */
62 retpc = env[0].__pc;
64 /* Restore the FP and SP of setjmp's caller. */
65 fp = env[0].__fp;
66 sp = env[0].__sp;
68 /* Return VAL (or 1 if VAL is zero) to setjmp's caller.
70 We use an asm here rather than a normal C return statement
71 just in case the compiler wanted to do some stack frobnication
72 in the function epilogue. Since we have already restored
73 precisely the FP and SP the desired environment needs,
74 we must avoid the compiler doing anything with the stack. */
76 while (1)
78 /* The loop is just to avoid `volatile function does return' warnings.
79 The instruction will only be executed once. */
81 register long int retval asm ("$0");
83 asm volatile
84 ("cmoveq %1, 1, %0\n\t" /* $0 = val ?: 1; */
85 "ret $31, (%2), 1" /* return $0 */
86 : "=r" (retval)
87 /* The "0" constraint should force VAL into $0. */
88 : "0" (val), "r" (retpc));