1 /* Copyright (C) 1992, 1994, 1997 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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 /* Global register vars must come before any function defn. */
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");
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");
36 /* Jump to the position specified by ENV, causing the
37 setjmp call there to return VAL, or 1 if VAL is 0. */
39 __longjmp (__jmp_buf env, int val)
41 register long int retval asm ("$0");
43 /* Restore the integer registers. */
52 /* Restore the floating point registers. */
63 /* Set the return PC to that of setjmp's caller. */
66 /* Restore the FP and SP of setjmp's caller. */
70 /* Return VAL (or 1 if VAL is zero) to setjmp's caller.
72 We use an asm here rather than a normal C return statement
73 just in case the compiler wanted to do some stack frobnication
74 in the function epilogue. Since we have already restored
75 precisely the FP and SP the desired environment needs,
76 we must avoid the compiler doing anything with the stack. */
80 ("cmoveq %1, 1, %0\n\t" /* $0 = val ?: 1; */
81 "ret $31, (%2), 1" /* return $0 */
83 /* The "0" constraint should force VAL into $0. */
84 : "0" (val), "r" (retpc));
88 /* The loop is just to avoid `volatile function does return' warnings.
89 The instruction will only be executed once. */