source: trunk/libs/newlib/src/newlib/libc/machine/spu/setjmp.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 4.1 KB
Line 
1/*
2(C) Copyright IBM Corp. 2005, 2006
3
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9    * Redistributions of source code must retain the above copyright notice,
10this list of conditions and the following disclaimer.
11    * Redistributions in binary form must reproduce the above copyright
12notice, this list of conditions and the following disclaimer in the
13documentation and/or other materials provided with the distribution.
14    * Neither the name of IBM nor the names of its contributors may be
15used to endorse or promote products derived from this software without
16specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
29
30Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
31*/
32
33/*
34        int setjmp( jmp_buf env );
35*/
36        .text
37        .align  2
38        .global setjmp
39        .type   setjmp, @function
40setjmp:
41        stqd    $80, 2*16($3)
42        stqd    $81, 3*16($3)
43        stqd    $82, 4*16($3)
44        stqd    $83, 5*16($3)
45        stqd    $84, 6*16($3)
46        stqd    $85, 7*16($3)
47        stqd    $86, 8*16($3)
48        stqd    $87, 9*16($3)
49        stqd    $88, 10*16($3)
50        stqd    $89, 11*16($3)
51        stqd    $90, 12*16($3)
52        stqd    $91, 13*16($3)
53        stqd    $92, 14*16($3)
54        stqd    $93, 15*16($3)
55        stqd    $94, 16*16($3)
56        stqd    $95, 17*16($3)
57        stqd    $96, 18*16($3)
58        stqd    $97, 19*16($3)
59        stqd    $98, 20*16($3)
60        stqd    $99, 21*16($3)
61        stqd    $100, 22*16($3)
62        stqd    $101, 23*16($3)
63        stqd    $102, 24*16($3)
64        stqd    $103, 25*16($3)
65        stqd    $104, 26*16($3)
66        stqd    $105, 27*16($3)
67        stqd    $106, 28*16($3)
68        stqd    $107, 29*16($3)
69        stqd    $108, 30*16($3)
70        stqd    $109, 31*16($3)
71        stqd    $110, 32*16($3)
72        stqd    $111, 33*16($3)
73        stqd    $112, 34*16($3)
74        stqd    $113, 35*16($3)
75        stqd    $114, 36*16($3)
76        stqd    $115, 37*16($3)
77        stqd    $116, 38*16($3)
78        stqd    $117, 39*16($3)
79        stqd    $118, 40*16($3)
80        stqd    $119, 41*16($3)
81
82        hbr     setjmp_ret, $0
83        lnop                    # pipe1 bubble added for instruction fetch
84
85        stqd    $120, 42*16($3)
86        stqd    $121, 43*16($3)
87        stqd    $122, 44*16($3)
88        stqd    $123, 45*16($3)
89        stqd    $124, 46*16($3)
90        stqd    $125, 47*16($3)
91        stqd    $126, 48*16($3)
92        stqd    $127, 49*16($3)
93       
94        stqd    $0, 0*16($3)
95        stqd    $1, 1*16($3)
96
97        il      $3, 0
98
99setjmp_ret:
100        bi      $0
101        .size   setjmp, .-setjmp
102
103/*
104        int longjmp( jmp_buf env, int val );
105*/
106        .text
107        .align  2
108        .global longjmp
109        .type   longjmp, @function
110longjmp:
111        lr      $127, $1
112
113        lqd     $0, 0*16($3)
114        lqd     $1, 1*16($3)
115
116        sf      $126, $127, $1
117        rotqbyi $126, $126, 12
118        fsmbi   $127, 0x0F00
119        and     $126, $126, $127
120        a       $1, $1, $126
121
122        # restore all the non-volatile registers
123
124        lqd     $80, 2*16($3)
125        lqd     $81, 3*16($3)
126        lqd     $82, 4*16($3)
127        lqd     $83, 5*16($3)
128        lqd     $84, 6*16($3)
129        lqd     $85, 7*16($3)
130        lqd     $86, 8*16($3)
131        lqd     $87, 9*16($3)
132        lqd     $88, 10*16($3)
133        lqd     $89, 11*16($3)
134        lqd     $90, 12*16($3)
135        lqd     $91, 13*16($3)
136        lqd     $92, 14*16($3)
137        lqd     $93, 15*16($3)
138        lqd     $94, 16*16($3)
139        lqd     $95, 17*16($3)
140        lqd     $96, 18*16($3)
141        lqd     $97, 19*16($3)
142        lqd     $98, 20*16($3)
143        lqd     $99, 21*16($3)
144        lqd     $100, 22*16($3)
145        lqd     $101, 23*16($3)
146        lqd     $102, 24*16($3)
147        lqd     $103, 25*16($3)
148        lqd     $104, 26*16($3)
149        lqd     $105, 27*16($3)
150        lqd     $106, 28*16($3)
151        lqd     $107, 29*16($3)
152        lqd     $108, 30*16($3)
153        lqd     $109, 31*16($3)
154
155        hbr     longjmp_ret, $0
156
157        lqd     $110, 32*16($3)
158        lqd     $111, 33*16($3)
159        lqd     $112, 34*16($3)
160        lqd     $113, 35*16($3)
161        lqd     $114, 36*16($3)
162        lqd     $115, 37*16($3)
163        lqd     $116, 38*16($3)
164        lqd     $117, 39*16($3)
165        lqd     $118, 40*16($3)
166        lqd     $119, 41*16($3)
167        lqd     $120, 42*16($3)
168        lqd     $121, 43*16($3)
169        lqd     $122, 44*16($3)
170        lqd     $123, 45*16($3)
171        lqd     $124, 46*16($3)
172        lqd     $125, 47*16($3)
173
174        ceqi    $5, $4, 0
175        lqd     $126, 48*16($3)
176        lqd     $127, 49*16($3)
177
178        sf      $3, $5, $4
179
180longjmp_ret:
181        bi      $0
182        .size   longjmp, .-longjmp
183
Note: See TracBrowser for help on using the repository browser.