]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/nios/setjmp.S
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / nios / setjmp.S
1 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    see <http://www.gnu.org/licenses/>.  */
17
18 #include <jmpbuf-offsets.h>
19 #include "NM_Macros.S"
20
21 ;----------------------------------------
22 ;         Name: __sigsetjmp
23 ;  Description: Save the current context so
24 ;               a nr_longjmp works later.
25 ;        Input: %o0: jmp_buf: (ptr to) array to store context in
26 ;       Output: %o0 = 0 the first time we're called, or
27 ;               whatever longjmp returns later
28 ; Side Effects: Uses %g0
29 ;    CWP Depth: 0
30 ;
31
32         .align  2
33         .global _setjmp
34         
35 _setjmp:
36         br      __sigsetjmp
37          movi   %o1,0           ; (Delay slot) Set signal mask to zero
38
39         .align  2
40         .global setjmp
41         
42 setjmp:
43         MOVIP   %o1,1           ; Set signal mask to 1 to save mask
44
45         .align  2
46         .global __sigsetjmp
47
48 __sigsetjmp:
49         pfx     jmpbuf_callersret ; present return address
50         st      [%o0],%i7       
51         pfx     jmpbuf_jmpret   ; where the longjmp will later execute from
52         st      [%o0],%o7       
53         pfx     jmpbuf_sp       ; Save stack pointer
54         st      [%o0],%o6
55         pfx     jmpbuf_l0       ; Save local register l0
56         st      [%o0],%l0
57         pfx     jmpbuf_l1       ; Save local register l1
58         st      [%o0],%l1
59         pfx     jmpbuf_l2       ; Save local register l2
60         st      [%o0],%l2
61         pfx     jmpbuf_l3       ; Save local register l3
62         st      [%o0],%l3
63         pfx     jmpbuf_l4       ; Save local register l4
64         st      [%o0],%l4
65         pfx     jmpbuf_l5       ; Save local register l5
66         st      [%o0],%l5
67         pfx     jmpbuf_l6       ; Save local register l6
68         st      [%o0],%l6
69         pfx     jmpbuf_l7       ; Save local register l7
70         st      [%o0],%l7
71         pfx     jmpbuf_i0       ; Save input register i0
72         st      [%o0],%i0
73         pfx     jmpbuf_i1       ; Save input register i1
74         st      [%o0],%i1
75         pfx     jmpbuf_i2       ; Save input register i2
76         st      [%o0],%i2
77         pfx     jmpbuf_i3       ; Save input register i3
78         st      [%o0],%i3
79         pfx     jmpbuf_i4       ; Save input register i4
80         st      [%o0],%i4
81         pfx     jmpbuf_i5       ; Save input register i5
82         st      [%o0],%i5
83         pfx     %hi(__sigjmp_save@h)      ; Load up %g0 with address
84         movi    %g0,%lo(__sigjmp_save@h)
85         pfx     %xhi(__sigjmp_save@h)
86         movhi   %g0,%xlo(__sigjmp_save@h)
87         jmp     %g0
88          nop                    ; (delay slot)
89
90
91
92
93
94
95
96
97
98