1 /* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Derived from @(#)_setjmp.s 5.7 (Berkeley) 6/27/88,
4 Copyright (c) 1980 Regents of the University of California.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 #error This file uses GNU C extensions; you must compile with GCC.
29 #define REI 02 /* Vax `rei' opcode. */
31 /* Jump to the position specified by ENV, causing the
32 setjmp call there to return VAL, or 1 if VAL is 0. */
39 register long int *fp asm("fp");
41 unsigned long int flags;
44 __libc_fatal("longjmp: Invalid ENV argument.\n");
49 asm volatile("loop:");
51 flags = *(long int *) (6 + (char *) fp);
52 regsave = (long int *) (20 + (char *) fp);
54 /* R0 was saved by the caller.
55 Store VAL where it will be restored from. */
58 /* R1 was saved by the caller.
59 Store ENV where it will be restored from. */
62 /* Was the FP saved in the last call the same one in ENV? */
63 asm volatile("cmpl %0, 12(fp);"
64 /* Yes, return to it. */
66 /* The FP in ENV is less than the one saved in the last call.
67 This means we have already returned from the function that
68 called `setjmp' with ENV! */
69 "blssu latejump;" : /* No outputs. */ : "g" (env.__fp));
71 /* We are more than one level below the state in ENV.
72 Return to where we will pop another stack frame. */
73 asm volatile("movl $loop, 16(fp);"
76 asm volatile("done:");
78 char return_insn asm("*16(fp)");
79 if (return_insn == REI)
80 /* We're returning with an `rei' instruction.
81 Do a return with PSL-PC pop. */
82 asm volatile("movab 0f, 16(fp)");
84 /* Do a standard return. */
85 asm volatile("movab 1f, 16(fp)");
91 asm volatile("0:" /* `rei' return. */
92 /* Compensate for PSL-PC push. */
94 "1:" /* Standard return. */
95 /* Return to saved PC. */
96 "jmp %1" : /* No outputs. */ :
97 "g" (8), "g" (env.__pc));
99 /* Jump here when the FP saved in ENV points
100 to a function that has already returned. */
101 asm volatile("latejump:");
102 __libc_fatal("longjmp: Attempt to jump to a function that has returned.\n");