1/* setjmp for CRIS.
2   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3   This file is part of the GNU C Library.
4
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.
9
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.
14
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   see <http://www.gnu.org/licenses/>.  */
18
19#include "sysdep.h"
20
21        .syntax no_register_prefix
22
23ENTRY (__sigsetjmp)
24.Local__sigsetjmp:
25
26#ifdef __arch_v32
27
28	moveq 1,r9
29	move.d r10,r12
30	addq 14*4,r12
31	movem r9,[r10]
32	lapc 0f,r13
33	move.d sp,[r12+]
34	move.d r13,[r12+]
35	move srp,[r12+]
36
37#else
38
39        moveq 1,r9
40        movem sp,[r10+1*4]
41#ifdef __PIC__
42        move.d pc,r9
43        addq 0f-.,r9
44#else
45        move.d 0f,r9
46#endif
47        move.d r9,[r10]
48        move srp,[r10+16*4]
49
50#endif
51
52/* Saving and restoring CCR is meaningless, so we don't do it.  */
53
54/* Saving registers would complicate  the implementation, but we
55   can get away with not setting up R0 here since we know that
56   __sigjmp_save is a local symbol; it doesn't have a PLT (which
57   would have required GOT in R0 at the time of the jump).  */
58        PLTJUMP (__sigjmp_save)
590: /* This is where longjmp returns.  (Don't use "ret" - it's a macro.  */
60        Ret
61        move.d r9,r10
62END (__sigsetjmp)
63
64/* Binary compatibility entry points.  Having these in separate files
65   is not meaningful and just adds library overhead.  */
66
67ENTRY (__setjmp)
68        ba .Local__sigsetjmp
69        moveq 0,r11
70END (__setjmp)
71
72ENTRY (_setjmp)
73        ba .Local__sigsetjmp
74        moveq 0,r11
75END (_setjmp)
76
77ENTRY (setjmp)
78        ba .Local__sigsetjmp
79        moveq 1,r11
80END (setjmp)
81