Rev 4874 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | |
2 | |||
3 | |||
4921 | Serge | 4 | /* |
5 | * All callee preserved registers: |
||
6 | * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 |
||
7 | */ |
||
8 | #define _JBLEN 23 |
||
9 | #endif |
||
10 | |||
4349 | Serge | 11 | |
4921 | Serge | 12 | #define _JBLEN 22 |
13 | #define _JBTYPE long long |
||
14 | #endif |
||
15 | |||
16 | |||
17 | #define _JBLEN 24 |
||
18 | #endif |
||
19 | |||
20 | |||
21 | /* |
||
22 | * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). |
||
23 | * All else recovered by under/over(flow) handling. |
||
24 | */ |
||
25 | #define _JBLEN 13 |
||
26 | #endif |
||
27 | |||
28 | |||
29 | #define _JBLEN 40 |
||
30 | #endif |
||
31 | |||
32 | |||
33 | /* All callee preserved registers: r4-r10,fp, sp, lr,r15, r32-r39 */ |
||
34 | #define _JBTYPE long long |
||
35 | #define _JBLEN 10 |
||
36 | #endif |
||
37 | |||
38 | |||
39 | |||
40 | |||
41 | /* |
||
42 | * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, |
||
43 | * fp2-fp7 for 68881. |
||
44 | * All else recovered by under/over(flow) handling. |
||
45 | */ |
||
46 | #define _JBLEN 34 |
||
47 | #endif |
||
48 | |||
49 | |||
50 | /* |
||
51 | * D, X, Y are not saved. |
||
52 | * Only take into account the pseudo soft registers (max 32). |
||
53 | */ |
||
54 | #define _JBLEN 32 |
||
55 | #endif |
||
56 | |||
57 | |||
58 | /* Only 17 words are currently needed. |
||
59 | Preserve one word slot if we need to expand. |
||
60 | Check newlib/libc/machine/nds32/setjmp.S for more information. */ |
||
61 | #define _JBLEN 18 |
||
62 | #endif |
||
63 | |||
64 | |||
65 | /* 16 regs + pc */ |
||
66 | #define _JBLEN 20 |
||
67 | #endif |
||
68 | |||
69 | |||
70 | /* |
||
71 | * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). |
||
72 | * All else recovered by under/over(flow) handling. |
||
73 | */ |
||
74 | #define _JBLEN 9 |
||
75 | #endif |
||
76 | |||
77 | |||
78 | # if defined(__CYGWIN__) && !defined (_JBLEN) |
||
79 | # define _JBLEN (13 * 4) |
||
80 | # elif defined(__unix__) || defined(__rtems__) |
||
81 | # define _JBLEN 9 |
||
82 | # else |
||
83 | # include "setjmp-dj.h" |
||
84 | # endif |
||
85 | #endif |
||
86 | |||
87 | |||
88 | # ifdef __CYGWIN__ |
||
89 | # define _JBTYPE long |
||
90 | # define _JBLEN 32 |
||
91 | # else |
||
92 | # define _JBTYPE long long |
||
93 | # define _JBLEN 8 |
||
94 | # endif |
||
95 | #endif |
||
96 | |||
97 | |||
98 | #define _JBLEN 35 |
||
99 | #endif |
||
100 | |||
101 | |||
102 | /* Only 8 words are currently needed. 10 gives us some slop if we need |
||
103 | to expand. */ |
||
104 | #define _JBLEN 10 |
||
105 | #endif |
||
106 | |||
107 | |||
108 | # if defined(__mips64) || (__mips_fpr == 64) |
||
109 | # define _JBTYPE long long |
||
110 | # endif |
||
111 | # ifdef __mips_soft_float |
||
112 | # define _JBLEN 11 |
||
113 | # else |
||
114 | # define _JBLEN 23 |
||
115 | # endif |
||
116 | #endif |
||
117 | |||
118 | |||
119 | #define _JBLEN 21 |
||
120 | #endif |
||
121 | |||
122 | |||
123 | #define _JBLEN 5 |
||
124 | #define _JBTYPE int |
||
125 | #endif |
||
126 | |||
127 | |||
128 | /* same as H8/300 but registers are twice as big */ |
||
129 | #define _JBLEN 5 |
||
130 | #define _JBTYPE long |
||
131 | #endif |
||
132 | |||
133 | |||
134 | /* same as H8/300 but registers are twice as big */ |
||
135 | #define _JBLEN 5 |
||
136 | #define _JBTYPE long |
||
137 | #endif |
||
138 | |||
139 | |||
140 | #define _JBLEN 4 |
||
141 | #endif |
||
142 | |||
143 | |||
144 | #if __SH5__ |
||
145 | #define _JBLEN 50 |
||
146 | #define _JBTYPE long long |
||
147 | #else |
||
148 | #define _JBLEN 20 |
||
149 | #endif /* __SH5__ */ |
||
150 | #endif |
||
151 | |||
152 | |||
153 | #define _JBLEN 28 |
||
154 | #endif |
||
155 | |||
156 | |||
157 | #ifdef __ALTIVEC__ |
||
158 | #define _JBLEN 64 |
||
159 | #else |
||
160 | #define _JBLEN 32 |
||
161 | #endif |
||
162 | #define _JBTYPE double |
||
163 | #endif |
||
164 | |||
165 | |||
166 | #define _JBLEN 20 |
||
167 | #define _JBTYPE unsigned int |
||
168 | #endif |
||
169 | |||
170 | |||
171 | /* %r30, %r2-%r18, %r27, pad, %fr12-%fr15. |
||
172 | Note space exists for the FP registers, but they are not |
||
173 | saved. */ |
||
174 | #define _JBLEN 28 |
||
175 | #endif |
||
176 | |||
177 | |||
178 | #ifdef __AM33_2__ |
||
179 | #define _JBLEN 26 |
||
180 | #else |
||
181 | /* A guess */ |
||
182 | #define _JBLEN 10 |
||
183 | #endif |
||
184 | #endif |
||
185 | |||
186 | |||
187 | /* I think our setjmp is saving 15 regs at the moment. Gives us one word |
||
188 | slop if we need to expand. */ |
||
189 | #define _JBLEN 16 |
||
190 | #endif |
||
191 | |||
192 | |||
193 | #define _JBLEN 10 |
||
194 | #endif |
||
195 | #if defined(_C3x) |
||
196 | #define _JBLEN 9 |
||
197 | #endif |
||
198 | |||
199 | |||
200 | #define _JBLEN 13 |
||
201 | #endif |
||
202 | |||
203 | |||
204 | #define _JBLEN 13 |
||
205 | #endif |
||
206 | |||
207 | |||
208 | #define _JBLEN 8 |
||
209 | #endif |
||
210 | |||
211 | |||
212 | #define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2) |
||
213 | #define _JBTYPE double |
||
214 | #endif |
||
215 | |||
216 | |||
217 | #define _JBLEN (68/2) /* room for 68 32-bit regs */ |
||
218 | #define _JBTYPE double |
||
219 | #endif |
||
220 | |||
221 | |||
222 | #define _JBLEN 16 |
||
223 | #endif |
||
224 | |||
225 | |||
226 | #define _JBLEN 9 |
||
227 | #endif |
||
228 | |||
229 | |||
230 | /* r6, r7, r8, r9, r10, r11, r12 (r12L, r12H), |
||
231 | * r13 (r13L, r13H), ra(raL, raH), sp(spL, spH) */ |
||
232 | #define _JBLEN 14 |
||
233 | #define _JBTYPE unsigned short |
||
234 | #endif |
||
235 | |||
236 | |||
237 | #define _JBLEN 10 |
||
238 | #endif |
||
239 | |||
240 | |||
241 | #define _JBLEN 32 |
||
242 | #endif |
||
243 | |||
244 | |||
245 | #define _JBLEN 16 |
||
246 | #endif |
||
247 | |||
248 | |||
249 | /* Using a layout compatible with GCC's built-in. */ |
||
250 | #define _JBLEN 5 |
||
251 | #define _JBTYPE unsigned long |
||
252 | #endif |
||
253 | |||
254 | |||
255 | #define _JBLEN 16 |
||
256 | #endif |
||
257 | |||
258 | |||
259 | #define _JBLEN 50 |
||
260 | #define _JBTYPE __vector signed int |
||
261 | #endif |
||
262 | |||
263 | |||
264 | /* 4 GPRs plus SP plus PC. */ |
||
265 | #define _JBLEN 8 |
||
266 | #endif |
||
267 | |||
268 | |||
269 | /* 16 GPRs, pc, hi, lo */ |
||
270 | #define _JBLEN 19 |
||
271 | #endif |
||
272 | |||
273 | |||
274 | #define _JBLEN 18 |
||
275 | #endif |
||
276 | |||
277 | |||
278 | #define _JBLEN 19 |
||
279 | #endif |
||
280 | |||
281 | |||
282 | #if defined(__r8c_cpu__) || defined(__m16c_cpu__) |
||
283 | #define _JBLEN (22/2) |
||
284 | #else |
||
285 | #define _JBLEN (34/2) |
||
286 | #endif |
||
287 | #define _JBTYPE unsigned short |
||
288 | #endif /* __m32c__ */ |
||
289 | |||
290 | |||
291 | #define _JBLEN 9 |
||
292 | |||
293 | |||
294 | #define _JBTYPE unsigned long |
||
295 | #else |
||
296 | #define _JBTYPE unsigned short |
||
297 | #endif |
||
298 | #endif |
||
299 | |||
300 | |||
301 | /* Three banks of registers, SP, CS, ES, PC */ |
||
302 | #define _JBLEN (8*3+8) |
||
303 | #define _JBTYPE unsigned char |
||
304 | #endif |
||
305 | |||
306 | |||
307 | * There are two versions of setjmp()/longjmp(): |
||
308 | * 1) Compiler (gcc) built-in versions. |
||
309 | * 2) Function-call versions. |
||
310 | * |
||
311 | * The built-in versions are used most of the time. When used, gcc replaces |
||
312 | * calls to setjmp()/longjmp() with inline assembly code. The built-in |
||
313 | * versions save/restore a variable number of registers. |
||
314 | |||
315 | |||
316 | * It only needs to be 12 for the function-call versions |
||
317 | * but this data structure is used by both versions. |
||
318 | */ |
||
319 | #ifdef __NIOS2__ |
||
320 | #define _JBLEN 40 |
||
321 | #define _JBTYPE unsigned long |
||
322 | #endif |
||
323 | |||
324 | |||
325 | #define _JBLEN 0x44 |
||
326 | #endif |
||
327 | |||
328 | |||
329 | #ifdef _JBTYPE |
||
330 | typedef _JBTYPE jmp_buf[_JBLEN]; |
||
331 | #else |
||
332 | typedef int jmp_buf[_JBLEN]; |
||
333 | #endif |
||
334 | #endif |
||
335 | |||
336 | |||
4349 | Serge | 337 | |
338 | |||
4921 | Serge | 339 | #include |
340 | |||
4349 | Serge | 341 | |
4921 | Serge | 342 | extern "C" { |
343 | #endif |
||
344 | |||
345 | |||
346 | #ifdef _JBTYPE |
||
347 | typedef _JBTYPE sigjmp_buf[_JBLEN+1+((sizeof (_JBTYPE) + sizeof (sigset_t) - 1) |
||
348 | /sizeof (_JBTYPE))]; |
||
349 | #else |
||
350 | typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))]; |
||
351 | #endif |
||
352 | |||
353 | |||
354 | #define _SIGMASK (_JBLEN+1) |
||
355 | |||
356 | |||
357 | # define _CYGWIN_WORKING_SIGSETJMP |
||
358 | #endif |
||
359 | |||
360 | |||
361 | #define __SIGMASK_FUNC pthread_sigmask |
||
362 | #else |
||
363 | #define __SIGMASK_FUNC sigprocmask |
||
364 | #endif |
||
365 | |||
366 | |||
367 | |||
368 | |||
369 | __extension__ \ |
||
370 | ({ \ |
||
371 | sigjmp_buf *_sjbuf = &(env); \ |
||
372 | ((*_sjbuf)[_SAVEMASK] = savemask,\ |
||
373 | __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\ |
||
374 | setjmp (*_sjbuf)); \ |
||
375 | }) |
||
376 | |||
377 | |||
378 | __extension__ \ |
||
379 | ({ \ |
||
380 | sigjmp_buf *_sjbuf = &(env); \ |
||
381 | ((((*_sjbuf)[_SAVEMASK]) ? \ |
||
382 | __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\ |
||
383 | : 0), \ |
||
384 | longjmp (*_sjbuf, val)); \ |
||
385 | }) |
||
386 | |||
387 | |||
388 | |||
389 | |||
390 | __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\ |
||
391 | setjmp (env)) |
||
392 | |||
393 | |||
394 | __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ |
||
395 | longjmp (env, val)) |
||
396 | |||
397 | |||
398 | |||
399 | |||
400 | are equivalent to sigsetjmp/siglongjmp when not saving the signal mask. |
||
401 | New applications should use sigsetjmp/siglongjmp instead. */ |
||
402 | #ifdef __CYGWIN__ |
||
403 | extern void _longjmp(jmp_buf, int); |
||
404 | extern int _setjmp(jmp_buf); |
||
405 | #else |
||
406 | #define _setjmp(env) sigsetjmp ((env), 0) |
||
407 | #define _longjmp(env, val) siglongjmp ((env), (val)) |
||
408 | #endif |
||
409 | |||
410 | |||
411 | } |
||
412 | #endif |
||
413 | #endif /* __CYGWIN__ or __rtems__ */ |
||
414 |