]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/m68k/__longjmp.c
Updated from ../=mpn/gmp-1.910
[thirdparty/glibc.git] / sysdeps / m68k / __longjmp.c
CommitLineData
ba5bfe42 1/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
a6353123
RM
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
a6353123
RM
19#include <setjmp.h>
20#include <stdlib.h>
21
22/* Jump to the position specified by ENV, causing the
23 setjmp call there to return VAL, or 1 if VAL is 0. */
a6353123 24void
6b319336 25__longjmp (__jmp_buf env, int val)
a6353123
RM
26{
27 /* This restores the FP and SP that setjmp's caller had,
28 and puts the return address into A0 and VAL into D0. */
29
30#if defined(__HAVE_68881__) || defined(__HAVE_FPU__)
31 /* Restore the floating-point registers. */
32 asm volatile("fmovem%.x %0, fp0-fp7" :
33 /* No outputs. */ : "g" (env[0].__fpregs[0]) :
34 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7");
35#endif
36
37 /* Put VAL in D0. */
38 asm volatile("move%.l %0, d0" : /* No outputs. */ :
39 "g" (val == 0 ? 1 : val) : "d0");
40
41 asm volatile(/* Restore the data and address registers. */
42 "movem%.l %0, d1-d7/a0-a7\n"
43 /* Return to setjmp's caller. */
e982f638
RM
44#ifdef __motorola__
45 "jmp (a0)"
46#else
47 "jmp a0@"
48#endif
49 : /* No outputs. */ : "g" (env[0].__dregs[0])
a6353123
RM
50 /* We don't bother with the clobbers,
51 because this code always jumps out anyway. */
52 );
53
54 /* This call avoids `volatile function does return' warnings. */
55 abort ();
56}