1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/* setjmp for SH-5.
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define _SETJMP_H
#define _ASM
#include <bits/setjmp.h>
#define INTEGER(reg,offset) st.q r2, offset*8, reg
#define DOUBLE(reg,offset) fst.d r2, offset*8, reg
.file "setjmp.S"
.section .text64,"xa"
.align 2
.global __sigsetjmp
.type __sigsetjmp,@function
__sigsetjmp:
/*
* extern int __sigsetjmp(jmp_buf env, int savemask);
*
* r2 == env
* r3 == savemask
* r4 == temporary
*/
/* callee-save registers R10-R16 */
INTEGER(r10, __SETJMP_INT(0))
INTEGER(r11, __SETJMP_INT(1))
INTEGER(r12, __SETJMP_INT(2))
INTEGER(r13, __SETJMP_INT(3))
INTEGER(r14, __SETJMP_INT(4))
INTEGER(r15, __SETJMP_INT(5))
INTEGER(r16, __SETJMP_INT(6))
/* callee-save registers R28-R35 */
INTEGER(r28, __SETJMP_INT(7))
INTEGER(r29, __SETJMP_INT(8))
INTEGER(r30, __SETJMP_INT(9))
INTEGER(r31, __SETJMP_INT(10))
INTEGER(r32, __SETJMP_INT(11))
INTEGER(r33, __SETJMP_INT(12))
INTEGER(r34, __SETJMP_INT(13))
INTEGER(r35, __SETJMP_INT(14))
/* callee-save registers R44-R59 */
INTEGER(r44, __SETJMP_INT(15))
INTEGER(r45, __SETJMP_INT(16))
INTEGER(r46, __SETJMP_INT(17))
INTEGER(r47, __SETJMP_INT(18))
INTEGER(r48, __SETJMP_INT(19))
INTEGER(r49, __SETJMP_INT(20))
INTEGER(r50, __SETJMP_INT(21))
INTEGER(r51, __SETJMP_INT(22))
INTEGER(r52, __SETJMP_INT(23))
INTEGER(r53, __SETJMP_INT(24))
INTEGER(r54, __SETJMP_INT(25))
INTEGER(r55, __SETJMP_INT(26))
INTEGER(r56, __SETJMP_INT(27))
INTEGER(r57, __SETJMP_INT(28))
INTEGER(r58, __SETJMP_INT(29))
INTEGER(r59, __SETJMP_INT(30))
#if __SETJMP_NUM_INT != 31
#error __SETJMP_NUM_INT does agree with expected value
#endif
#if __SETJMP_NUM_DBL > 0
/* callee-save registers FR12-FR15 */
DOUBLE(d12, __SETJMP_DBL(0))
DOUBLE(d14, __SETJMP_DBL(1))
/* callee-save registers FR36-FR63 */
DOUBLE(d36, __SETJMP_DBL(2))
DOUBLE(d38, __SETJMP_DBL(3))
DOUBLE(d40, __SETJMP_DBL(4))
DOUBLE(d42, __SETJMP_DBL(5))
DOUBLE(d44, __SETJMP_DBL(6))
DOUBLE(d46, __SETJMP_DBL(7))
DOUBLE(d48, __SETJMP_DBL(8))
DOUBLE(d50, __SETJMP_DBL(9))
DOUBLE(d52, __SETJMP_DBL(10))
DOUBLE(d54, __SETJMP_DBL(11))
DOUBLE(d56, __SETJMP_DBL(12))
DOUBLE(d58, __SETJMP_DBL(13))
DOUBLE(d60, __SETJMP_DBL(14))
DOUBLE(d62, __SETJMP_DBL(15))
#if __SETJMP_NUM_DBL != 16
#error __SETJMP_NUM_DBL does agree with expected value
#endif
#endif /* __SETJMP_NUM_DBL > 0 */
/* callee-save registers TR5-TR7 */
gettr tr5, r4
INTEGER(r4, __SETJMP_TRG(0))
gettr tr6, r4
INTEGER(r4, __SETJMP_TRG(1))
gettr tr7, r4
INTEGER(r4, __SETJMP_TRG(2))
#if __SETJMP_NUM_TRG != 3
#error __SETJMP_NUM_TRG does agree with expected value
#endif
/* save Linkage Register (LR) for longjmp return */
INTEGER(r18, __SETJMP_LR)
/*
* return a value of zero if call is __sigsetjmp().
* This is so that caller of setjmp() knows
* we have retruned via setjmp, and not via longjmp.
* R0 is the result register.
*/
ptabs/l r18, tr0 /* return to caller */
movi 0, r2 /* return value */
blink tr0, r63
|