1 /* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc.
2 Derived from @(#)_setjmp.s 5.7 (Berkeley) 6/27/88,
3 Copyright (c) 1980 Regents of the University of California.
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. */
23 #error This file uses GNU C extensions; you must compile with GCC.
27 #define REI 02 /* Vax `rei' opcode. */
29 /* Jump to the position specified by ENV, causing the
30 setjmp call there to return VAL, or 1 if VAL is 0. */
37 register long int *fp
asm("fp");
39 unsigned long int flags
;
42 __libc_fatal("longjmp: Invalid ENV argument.\n");
47 asm volatile("loop:");
49 flags
= *(long int *) (6 + (char *) fp
);
50 regsave
= (long int *) (20 + (char *) fp
);
52 /* R0 was saved by the caller.
53 Store VAL where it will be restored from. */
56 /* R1 was saved by the caller.
57 Store ENV where it will be restored from. */
60 /* Was the FP saved in the last call the same one in ENV? */
61 asm volatile("cmpl %0, 12(fp);"
62 /* Yes, return to it. */
64 /* The FP in ENV is less than the one saved in the last call.
65 This means we have already returned from the function that
66 called `setjmp' with ENV! */
67 "blssu latejump;" : /* No outputs. */ : "g" (env
.__fp
));
69 /* We are more than one level below the state in ENV.
70 Return to where we will pop another stack frame. */
71 asm volatile("movl $loop, 16(fp);"
74 asm volatile("done:");
76 char return_insn
asm("*16(fp)");
77 if (return_insn
== REI
)
78 /* We're returning with an `rei' instruction.
79 Do a return with PSL-PC pop. */
80 asm volatile("movab 0f, 16(fp)");
82 /* Do a standard return. */
83 asm volatile("movab 1f, 16(fp)");
89 asm volatile("0:" /* `rei' return. */
90 /* Compensate for PSL-PC push. */
92 "1:" /* Standard return. */
93 /* Return to saved PC. */
94 "jmp %1" : /* No outputs. */ :
95 "g" (8), "g" (env
.__pc
));
97 /* Jump here when the FP saved in ENV points
98 to a function that has already returned. */
99 asm volatile("latejump:");
100 __libc_fatal("longjmp: Attempt to jump to a function that has returned.\n");