OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / sh / setjmp.S
1 /* setjmp for SH3.
2    Copyright (C) 1999, 2000 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 <features.h>
20 #include <jmpbuf-offsets.h>
21
22         .text
23
24 /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
25    We cannot do it in C because it must be a tail-call, so frame-unwinding
26    in setjmp doesn't clobber the state restored by longjmp.  */
27
28         .align 4
29         .type   _setjmp,@function
30         .globl  _setjmp;
31 _setjmp:
32         bra     __sigsetjmp_intern
33          mov    #0, r1
34         .size _setjmp,.-_setjmp;
35
36 /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
37    We cannot do it in C because it must be a tail-call, so frame-unwinding
38    in setjmp doesn't clobber the state restored by longjmp.  */
39
40         .align 4
41         .type   setjmp,@function
42         .globl  setjmp;
43 setjmp: 
44         bra     __sigsetjmp_intern
45          mov    #1, r1
46         .size setjmp,.-setjmp;
47         
48         .align 4
49         .type   __sigsetjmp,@function
50         .globl  __sigsetjmp;
51 __sigsetjmp:
52         mov     r0, r1
53         nop             /* align this guy */
54 __sigsetjmp_intern:
55         /* Save registers */
56 #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
57         add     #(JB_SIZE), r4
58         fmov.s  fr15, @-r4
59         fmov.s  fr14, @-r4
60         fmov.s  fr13, @-r4
61         fmov.s  fr12, @-r4
62         sts.l   fpscr, @-r4
63 #else
64         add     #(JB_SIZE-(5*4)), r4 /* this code doesn't do FP yet */
65 #endif          
66         stc.l   gbr, @-r4
67         sts.l   pr, @-r4
68         mov.l   r15, @-r4
69         mov.l   r14, @-r4
70         mov.l   r13, @-r4
71         mov.l   r12, @-r4
72         mov.l   r11, @-r4
73         mov.l   r10, @-r4
74         mov.l   r9, @-r4
75         mov.l   r8, @-r4
76
77 #ifdef __HAVE_SHARED__
78         mov.l   .LG, r2
79         mova    .LG, r0
80         add     r0, r2
81         /* Make a tail call to __sigjmp_save; it takes the same args.  */
82         mov.l   .L1, r0
83         mov.l   @(r0,r2),r0
84         jmp     @r0
85          mov     r1, r0
86         .align  2
87 .LG:    .long   _GLOBAL_OFFSET_TABLE_
88 .L1:    .long   __sigjmp_save@GOT
89 #else
90         /* Make a tail call to __sigjmp_save; it takes the same args.  */
91         mov.l   .L1, r0
92         braf    r0
93          mov     r1, r0
94 .jmp_loc:               
95         .align  2
96 .L1:    .long   __sigjmp_save - .jmp_loc
97 #endif  
98
99         .size __sigsetjmp,.-__sigsetjmp;