]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/m68k/__longjmp.c
Fix type of second argument.
[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. */
69c85398
RM
32 asm volatile("fmovem%.x %0, %/fp0-%/fp7" :
33 /* No outputs. */ : "g" (env[0].__fpregs[0]));
a6353123
RM
34#endif
35
36 /* Put VAL in D0. */
69c85398 37 asm volatile("move%.l %0, %/d0" : /* No outputs. */ :
a6353123
RM
38 "g" (val == 0 ? 1 : val) : "d0");
39
40 asm volatile(/* Restore the data and address registers. */
69c85398 41 "movem%.l %0, %/d1-%/d7/%/a0-%/a7\n"
a6353123 42 /* Return to setjmp's caller. */
e982f638 43#ifdef __motorola__
69c85398 44 "jmp (%/a0)"
e982f638 45#else
69c85398 46 "jmp %/a0@"
e982f638
RM
47#endif
48 : /* No outputs. */ : "g" (env[0].__dregs[0])
a6353123
RM
49 /* We don't bother with the clobbers,
50 because this code always jumps out anyway. */
51 );
52
53 /* This call avoids `volatile function does return' warnings. */
54 abort ();
55}