xref: /DragonStub/lib/ia64/setjmp.S (revision 3b523e30f32977427eece40016571d6d71e72d0b)
1/*
2 * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
3 * This program and the accompanying materials are licensed and made
4available
5 * under the terms and conditions of the BSD License which accompanies
6this
7 * distribution.  The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php.
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
11BASIS,
12 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
13 * IMPLIED.
14 */
15	.text
16	.globl	setjmp
17	.type	setjmp, @function
18setjmp:
19	alloc	loc0 = ar.pfs, 1, 2, 1, 0
20	;;
21	mov	r14 = ar.unat
22	mov	r15 = ar.bsp
23	add	r10 = 0x10*20, in0
24	;;
25	stf.spill.nta	[in0] = f2, 0x10
26	st8.spill.nta	[r10] = r4, 8
27	mov		r21 = b1
28	;;
29	stf.spill.nta	[in0] = f3, 0x10
30	st8.spill.nta	[r10] = r5, 8
31	mov		r22 = b2
32	;;
33	stf.spill.nta	[in0] = f4, 0x10
34	st8.spill.nta	[r10] = r6, 8
35	mov		r23 = b3
36	;;
37	stf.spill.nta	[in0] = f5, 0x10
38	st8.spill.nta	[r10] = r7, 8
39	mov		r24 = b4
40	;;
41	stf.spill.nta	[in0] = f16, 0x10
42	st8.spill.nta	[r10] = sp, 8
43	mov		r25 = b5
44	;;
45	stf.spill.nta	[in0] = f17, 0x10
46	st8.nta		[r10] = loc1, 8
47	mov		r16 = pr
48	;;
49	stf.spill.nta	[in0] = f18, 0x10
50	st8.nta		[r10] = r21, 8
51	mov		r17 = ar.lc
52	;;
53	stf.spill.nta	[in0] = f19, 0x10
54	st8.nta		[r10] = r22, 8
55	;;
56	stf.spill.nta	[in0] = f20, 0x10
57	st8.nta		[r10] = r23, 8
58	;;
59	stf.spill.nta	[in0] = f21, 0x10
60	st8.nta		[r10] = r24, 8
61	;;
62	stf.spill.nta	[in0] = f22, 0x10
63	st8.nta		[r10] = r25, 8
64	;;
65	stf.spill.nta	[in0] = f23, 0x10
66	mov		r18 = ar.unat
67	;;
68	stf.spill.nta	[in0] = f24, 0x10
69	st8.nta		[r10] = r14, 8
70	;;
71	stf.spill.nta	[in0] = f25, 0x10
72	st8.nta		[r10] = r18, 8
73	;;
74	stf.spill.nta	[in0] = f26, 0x10
75	st8.nta		[r10] = loc0, 8
76	;;
77	stf.spill.nta	[in0] = f27, 0x10
78	st8.nta		[r10] = r15, 8
79	mov		r8 = 0
80	;;
81	stf.spill.nta	[in0] = f28, 0x10
82	mov		r19 = ar.fpsr
83	;;
84	stf.spill.nta	[in0] = f29, 0x10
85	st8.nta		[r10] = r16, 8
86	mov		ar.pfs = loc0
87	;;
88	stf.spill.nta	[in0] = f30, 0x10
89	st8.nta		[r10] = r17, 8
90	mov		b0 = loc1
91	;;
92	stf.spill.nta	[in0] = f31, 0x10
93	st8.nta		[r10] = r19
94	;;
95	mov		ar.unat = r14
96	br.ret.sptk	b0
97	;;
98
99	.globl	longjmp
100	.type	longjmp, @function
101	.regstk 2, 0, 0, 0
102longjmp:
103	add		r10 = 0x10*20 + 8*14, in0
104	movl		r2  = ~((((1<<14) - 1) << 16) | 3)
105	;;
106	ld8.nt1		r14 = [r10], -8*2
107	mov		r15 = ar.bspstore
108	;;
109	ld8.nt1		r17 = [r10], -8
110	mov		r16 = ar.rsc
111	cmp.leu		p6  = r14, r15
112	;;
113	ld8.nt1		r18 = [r10], -8
114	ld8.nt1		r25 = [r10], -8
115	and		r2  = r16, r2
116	;;
117	ldf.fill.nt1	f2  = [in0], 0x10
118	ld8.nt1		r24 = [r10], -8
119	mov		b5  = r25
120	;;
121	mov		ar.rsc = r2
122	ld8.nt1		r23 = [r10], -8
123	mov		b4 = r24
124	;;
125	ldf.fill.nt1	f3 = [in0], 0x10
126	mov		ar.unat = r17
127(p6)	br.spnt.many	_skip_flushrs
128	;;
129	flushrs
130	mov		r15 = ar.bsp
131	;;
132_skip_flushrs:
133	mov		r31 = ar.rnat
134	loadrs
135	;;
136	ldf.fill.nt1	f4  = [in0], 0x10
137	ld8.nt1		r22 = [r10], -8
138	dep		r2  = -1, r14, 3, 6
139	;;
140	ldf.fill.nt1	f5  = [in0], 0x10
141	ld8.nt1		r21 = [r10], -8
142	cmp.ltu		p6  = r2, r15
143	;;
144	ld8.nt1		r20 = [r10], -0x10
145(p6)	ld8.nta		r31 = [r2]
146	mov		b3  = r23
147	;;
148	ldf.fill.nt1	f16 = [in0], 0x10
149	ld8.fill.nt1	r7  = [r10], -8
150	mov		b2  = r22
151	;;
152	ldf.fill.nt1	f17 = [in0], 0x10
153	ld8.fill.nt1	r6  = [r10], -8
154	mov		b1  = r21
155	;;
156	ldf.fill.nt1	f18 = [in0], 0x10
157	ld8.fill.nt1	r5  = [r10], -8
158	mov		b0  = r20
159	;;
160	ldf.fill.nt1	f19 = [in0], 0x10
161	ld8.fill.nt1	r4  = [r10], 8*13
162	;;
163	ldf.fill.nt1	f20 = [in0], 0x10
164	ld8.nt1		r19 = [r10], 0x10
165	;;
166	ldf.fill.nt1	f21 = [in0], 0x10
167	ld8.nt1		r26 = [r10], 8
168	mov		ar.pfs = r19
169	;;
170	ldf.fill.nt1	f22 = [in0], 0x10
171	ld8.nt1		r27 = [r10], 8
172	mov		pr  = r26, -1
173	;;
174	ldf.fill.nt1	f23 = [in0], 0x10
175	ld8.nt1		r28 = [r10], -17*8 - 0x10
176	mov		ar.lc = r27
177	;;
178	ldf.fill.nt1	f24 = [in0], 0x10
179	ldf.fill.nt1	f25 = [in0], 0x10
180	mov		r8  = in1
181	;;
182	ldf.fill.nt1	f26 = [in0], 0x10
183	ldf.fill.nt1	f31 = [r10], -0x10
184	;;
185	ldf.fill.nt1	f27 = [in0], 0x10
186	ldf.fill.nt1	f30 = [r10], -0x10
187	;;
188	ldf.fill.nt1	f28 = [in0]
189	ldf.fill.nt1	f29 = [r10], 0x10*3 + 8*4
190	;;
191	ld8.fill.nt1	sp  = [r10]
192	mov		ar.unat = r18
193	;;
194	mov		ar.bspstore = r14
195	mov		ar.rnat = r31
196	;;
197	invala
198	mov		ar.rsc = r16
199	br.ret.sptk	b0
200