105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm/* libunwind - a platform-independent unwind library
23d881cd0cb0a1c4e9c223a978098f033b42f326fhp.com!davidm   Copyright (C) 2004-2005 Hewlett-Packard Co
305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmThis file is part of libunwind.
605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmPermission is hereby granted, free of charge, to any person obtaining
805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidma copy of this software and associated documentation files (the
905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm"Software"), to deal in the Software without restriction, including
1005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmwithout limitation the rights to use, copy, modify, merge, publish,
1105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to
1205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmpermit persons to whom the Software is furnished to do so, subject to
1305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmthe following conditions:
1405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
1505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmThe above copyright notice and this permission notice shall be
1605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmincluded in all copies or substantial portions of the Software.
1705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
1805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
2205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
2505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
2605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.text
2705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
2896d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm#define CALL_NEXT_PTR(gp_save_reg, arg0, arg1)				\
2996d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	ld8 r2 = [arg0], 8;;	/* read the next function pointer */	\
30c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	ld8 r3 = [r2], 8;;	/* read the function's entry-point */	\
31c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	ld8 r2 = [r2];;		/* read the function's gp */		\
32c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov b6 = r3;							\
33c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov gp_save_reg = gp;						\
3496d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	mov out0 = arg0;						\
3596d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	mov out1 = arg1;						\
36c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov gp = r2;							\
37c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	br.call.sptk.many rp = b6;;					\
38c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov gp = gp_save_reg
39c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
4096d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm#define CALL_NEXT(gp_save_reg)	CALL_NEXT_PTR(gp_save_reg, in0, in1)
4196d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm
42a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm#define LOAD_VAL(reg)				\
43a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	ld8 reg = [in1], 8;;			\
4494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	tbit.nz p15, p0 = reg, 0;;		\
4594b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm(p15)	ld8.s reg = [r0]
46a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
47c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
4894b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.global flushrs
4994b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.proc flushrs
5094b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidmflushrs:
5194b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	flushrs;;
5294b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	br.ret.sptk.many rp
5394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.endp flushrs
5494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
55c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	/* Save r4-r7 into stacked registers, load them up with the
56c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	   values passed via the pointer in in1 and then call the
57c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	   function passed via the pointer in in0.  */
58c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
5905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.global save_static_to_stacked
6005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.proc save_static_to_stacked
6105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmsave_static_to_stacked:
6205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.prologue
6305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.regstk 2, 7, 2, 0
6405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.save ar.pfs, loc0
6505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	alloc loc0 = ar.pfs, 2, 7, 2, 0
6605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.save rp, loc1
6705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov loc1 = rp
6805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.spillreg r4, loc2
6905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov loc2 = r4
7005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.spillreg r5, loc3
7105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov loc3 = r5
7205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.spillreg r6, loc4
7305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov loc4 = r6
7405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.spillreg r7, loc5
7505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov loc5 = r7
7605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.body
77a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r4)
78a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r5)
79a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r6)
80a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r7)
81c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	CALL_NEXT(loc6)
8205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
8305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov r4 = loc2
8405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov r5 = loc3
8505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov r6 = loc4
8605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov r7 = loc5
8705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm
8805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov ar.pfs = loc0
8905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	mov rp = loc1
9005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	br.ret.sptk.many rp
9105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm	.endp save_static_to_stacked
92c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
93c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	/* Save f2 to the memory stack, save r4 to f2, then load
94c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	   r4 with the value passed via in1 and call the function
95c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	   passed via in0.  */
96c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
97a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.global save_static_to_fr
98a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.proc save_static_to_fr
99a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_fr:
100c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.prologue
101c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.regstk 2, 3, 2, 0
102c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.save ar.pfs, loc0
103c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	alloc loc0 = ar.pfs, 2, 3, 2, 0
104c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.save rp, loc1
105c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov loc1 = rp
106c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.fframe 16
10782e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp f2, 0
108c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	stf.spill [sp] = f2, -16
109c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.spillreg r4, f2
110c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	setf.sig f2 = r4
111c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
112c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	.body
113c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
114c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	ld8 r4 = [in1], 8;;
115c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	tbit.nz p6, p0 = r4, 0;;
116c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm(p6)	ld8.s r4 = [r0]
117c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
118c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	CALL_NEXT(loc2)
119c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
120c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	getf.sig r4 = f2		// restore r4
121a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.restore sp
122a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	add sp = 16, sp;;
123a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	ldf.fill f2 = [sp]		// restore r2
124c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm
125c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov ar.pfs = loc0
126c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	mov rp = loc1
127c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm	br.ret.sptk.many rp
128a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.endp save_static_to_fr
129a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
130a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	/* If r4 is not a NaT, save b3 to a stacked register and
131a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	   then save r4 in b3.  The non-NaTness of r4 is saved in
132a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	   p1.  */
133a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
134a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.global save_static_to_br
135a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.proc save_static_to_br
136a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_br:
137a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.prologue
13894b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.regstk 2, 6, 2, 0
139a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save ar.pfs, loc0
14094b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	alloc loc0 = ar.pfs, 2, 6, 2, 0
141a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save rp, loc1
142a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov loc1 = rp
143a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
144a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save pr, loc2
145a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov loc2 = pr			// save predicates
146a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
147a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.spillreg b3, loc3
148a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov loc3 = b3
149a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
150a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	tnat.z p1, p2 = r4;;
151a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.spillreg.p p1, r4, b3
152a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm(p1)	mov b3 = r4
15394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.spillreg.p p2, r4, loc4
15494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm(p2)	mov loc4 = r4
155a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
156a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.body
157a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
158a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r4)
15994b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	CALL_NEXT(loc5)
160a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
16194b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.pred.rel.mutex p1, p2
162a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm(p1)	mov r4 = b3			// restore r4
16394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm(p2)	mov r4 = loc4
164a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
165a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov ar.pfs = loc0
166a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov rp = loc1
167a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov pr = loc2, -1
168a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov b3 = loc3			// restore b3
169a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	br.ret.sptk.many rp
170a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.endp save_static_to_br
171a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
172a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	/* Spill r4 into memory and then save r5 in r4.  */
173a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
174a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.global save_static_to_mem
175a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.proc save_static_to_mem
176a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_mem:
177a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.prologue
178a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.regstk 2, 4, 2, 0
179a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save ar.pfs, loc0
180a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	alloc loc0 = ar.pfs, 2, 4, 2, 0
181a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save rp, loc1
182a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov loc1 = rp
183a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.save ar.unat, loc2
184a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov loc2 = ar.unat
185a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
186a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.fframe 16
18782e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp r4, 0
188a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	st8.spill [sp] = r4, -16
189a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
190a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.spillreg r5, r4
191a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov r4 = r5
192a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
193a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.body
194a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
195a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	LOAD_VAL(r5)
196a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	CALL_NEXT(loc3)
197a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
198a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov r5 = r4			// restore r5
199a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.restore sp
200a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	add sp = 16, sp;;
201a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	ld8.fill r4 = [sp]		// restore r4
202a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm
203a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov ar.pfs = loc0
204a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov rp = loc1
205a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	mov ar.unat = loc2		// restore ar.unat
206a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	br.ret.sptk.many rp
207a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm	.endp save_static_to_mem
2081f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
2095071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	/* Spill r6 into memory and save primary ar.unat in a register.  */
2105071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2115071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.global save_static_to_mem2
2125071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.proc save_static_to_mem2
2135071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidmsave_static_to_mem2:
2145071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.prologue
2155071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.regstk 2, 5, 2, 0
2165071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.pfs, loc0
2175071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	alloc loc0 = ar.pfs, 2, 5, 2, 0
2185071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save rp, loc1
2195071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc1 = rp
2205071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.unat, loc2
2215071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc2 = ar.unat
2225071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2235071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.fframe 16
22482e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp r6, 0
2255071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8.spill [sp] = r6, -16;;
2265071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save @priunat, loc3
2275071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc3 = ar.unat
2285071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = 0			// trash ar.unat
2295071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2305071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.body
2315071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2325071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	LOAD_VAL(r6)
2335071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	CALL_NEXT(loc4)
2345071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2355071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc3		// restore primary UNaT
2365071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.restore sp
2375071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add sp = 16, sp;;
2385071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8.fill r6 = [sp]		// restore r6
2395071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2405071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.pfs = loc0
2415071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov rp = loc1
2425071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc2		// restore ar.unat
2435071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	br.ret.sptk.many rp
2445071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.endp save_static_to_mem2
2455071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2465071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	/* Spill r6 into memory and save primary ar.unat in memory.  */
2475071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2485071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.global save_static_to_mem3
2495071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.proc save_static_to_mem3
2505071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidmsave_static_to_mem3:
2515071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.prologue
2525071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.regstk 2, 5, 2, 0
2535071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.pfs, loc0
2545071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	alloc loc0 = ar.pfs, 2, 5, 2, 0
2555071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save rp, loc1
2565071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc1 = rp
2575071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.unat, loc2
2585071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc2 = ar.unat
2595071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2605071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 8, sp
2615071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.fframe 16
26282e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp r6, 0
2635071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8.spill [sp] = r6, -16;;
2645071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov r3 = ar.unat;;
26582e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.savepsp @priunat, -8
2665071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8 [r2] = r3
2675071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = 0			// trash ar.unat
2685071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2695071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.body
2705071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2715071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	LOAD_VAL(r6)
2725071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	CALL_NEXT(loc4)
2735071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2745071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 24, sp;;
2755071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8 r3 = [r2];;
2765071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = r3		// restore primary UNaT
2775071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.restore sp
2785071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add sp = 16, sp;;
2795071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8.fill r6 = [sp]		// restore r6
2805071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2815071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.pfs = loc0
2825071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov rp = loc1
2835071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc2		// restore ar.unat
2845071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	br.ret.sptk.many rp
2855071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.endp save_static_to_mem3
2865071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2875071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	/* Spill r6 into memory and save primary ar.unat in register,
2885071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	   then in memory.  */
2895071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
2905071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.global save_static_to_mem4
2915071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.proc save_static_to_mem4
2925071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidmsave_static_to_mem4:
2935071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.prologue
2945071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.regstk 2, 5, 2, 0
2955071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.pfs, loc0
2965071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	alloc loc0 = ar.pfs, 2, 5, 2, 0
2975071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save rp, loc1
2985071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc1 = rp
2995071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.unat, loc2
3005071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc2 = ar.unat
3015071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3025071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 8, sp
3035071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.fframe 16
30482e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp r6, 0
3055071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8.spill [sp] = r6, -16;;
3065071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save @priunat, r3
3075071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov r3 = ar.unat;;
3085071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = 0			// trash ar.unat
30982e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.savepsp @priunat, -8
3105071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8 [r2] = r3
3115071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov r3 = r0			// trash register pri UNaT location
3125071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.body
3135071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3145071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	LOAD_VAL(r6)
3155071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	CALL_NEXT(loc4)
3165071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3175071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 24, sp;;
3185071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8 r3 = [r2];;
3195071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = r3		// restore primary UNaT
3205071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.restore sp
3215071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add sp = 16, sp;;
3225071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8.fill r6 = [sp]		// restore r6
3235071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3245071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.pfs = loc0
3255071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov rp = loc1
3265071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc2		// restore ar.unat
3275071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	br.ret.sptk.many rp
3285071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.endp save_static_to_mem4
3295071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3305071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	/* Spill r6 into memory and save primary ar.unat in register,
3315071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	   then in memory.  */
3325071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3335071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.global save_static_to_mem5
3345071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.proc save_static_to_mem5
3355071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidmsave_static_to_mem5:
3365071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.prologue
3375071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.regstk 2, 5, 2, 0
3385071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.pfs, loc0
3395071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	alloc loc0 = ar.pfs, 2, 5, 2, 0
3405071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save rp, loc1
3415071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc1 = rp
3425071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save ar.unat, loc2
3435071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc2 = ar.unat
3445071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3455071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 8, sp
3465071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.fframe 16
34782e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.spillpsp r6, 0
3485071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8.spill [sp] = r6, -16;;
3495071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov r3 = ar.unat;;
3505071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = 0			// trash ar.unat
35182e02ac518e7a7e7ebd364133ed4d8948984e7f4hp.com!davidm	.savepsp @priunat, -8
3525071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8 [r2] = r3
3535071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.save @priunat, loc3
3545071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov loc3 = r3
3555071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	st8 [r2] = r0			// trash memory pri UNaT location
3565071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.body
3575071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3585071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	LOAD_VAL(r6)
3595071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	CALL_NEXT(loc4)
3605071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3615071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add r2 = 24, sp;;
3625071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8 r3 = [r2];;
3635071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc3		// restore primary UNaT
3645071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.restore sp
3655071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	add sp = 16, sp;;
3665071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	ld8.fill r6 = [sp]		// restore r6
3675071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3685071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.pfs = loc0
3695071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov rp = loc1
3705071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov ar.unat = loc2		// restore ar.unat
3715071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	br.ret.sptk.many rp
3725071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.endp save_static_to_mem5
3735071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm
3741f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	/* Save r4-r7 to various scratch registers, then trigger
3751f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	   a segfault.  */
3761f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
3771f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.global save_static_to_scratch
3781f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.proc save_static_to_scratch
3791f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidmsave_static_to_scratch:
3801f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.prologue
3811f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
3821f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.spillreg r4, r16
3831f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	mov r16 = r4			// save r4 in r16
3841f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	tnat.nz p6, p7 = r5;;
3851f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.spillreg.p p6, r5, f31
3861f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm(p6)	setf.sig f31 = r5		// save r5 in f31 if it's a NaT
3871f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.spillreg.p p7, r5, b6
3881f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm(p7)	mov b6 = r5			//         in  b6 if it not
3891f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.spillreg r6, f32
3901f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	setf.sig f32 = r6		// save r6 in f32 (fph partition)
3911f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.spillsp r7, 0
3921f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	st8.spill [sp] = r7		// save r7 in the scratch stack space
3935071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	.spillreg f4, f6
3945071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov f6 = f4;;
3951f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.body
3961f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
3973d881cd0cb0a1c4e9c223a978098f033b42f326fhp.com!davidm	ld8 r2 = [in1]
3983d881cd0cb0a1c4e9c223a978098f033b42f326fhp.com!davidm	;;
3993d881cd0cb0a1c4e9c223a978098f033b42f326fhp.com!davidm	mov ar.ec = r2
4003d881cd0cb0a1c4e9c223a978098f033b42f326fhp.com!davidm
4011f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	LOAD_VAL(r4)
4021f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	LOAD_VAL(r5)
4031f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	LOAD_VAL(r6)
4041f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	LOAD_VAL(r7)
4055071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	setf.sig f4 = r4
4061f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
4071f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	/* Now force a SIGSEGV.  Make sure the ld8 is at the beginning of a
4081f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	   bundle, so the signal-handler can skip over it simply by
4091f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	   incrementing the IP.  */
4101f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	{
4111f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm		.mmi
4121f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm		ld8 r2 = [r0]
4131f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm		nop.m 0
4141f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm		nop.i 0 ;;
4151f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	}
4161f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
4175071803e5dfc01f724d89b297db56cf60beaa5e1hp.com!davidm	mov f4 = f6
4181f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	mov r4 = r16
4191f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.pred.rel.mutex p6, p7
4201f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm(p6)	getf.sig r5 = f31
4211f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm(p7)	mov r5 = b6
4221f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	getf.sig r6 = f32
4231f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	ld8.fill r7 = [sp]
4241f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm
4251f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	br.ret.sptk.many rp
4261f3439fc5d4fe4c57af5d1278f92e203044d1db1hp.com!davidm	.endp save_static_to_scratch
42794b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
42896d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	/* Rotate registers a bit in a vain attempt to sow some confusion.
42996d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	   Care must be taken not to write any rotating general register
43096d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	   after rotation, because we keep the preserved state
43196d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	   there... */
43296d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm
43394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.global rotate_regs
43494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.proc rotate_regs
43594b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidmrotate_regs:
43694b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.prologue
43794b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.regstk 2, 14, 2, 16
43894b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.save ar.pfs, loc0
43994b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	alloc loc0 = ar.pfs, 2, 14, 2, 16
44094b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.save rp, loc1
44194b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov loc1 = rp
44294b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.save pr, loc2
44394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov loc2 = pr
44494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.save ar.lc, loc3
44594b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov loc3 = ar.lc
44696d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	.spillreg r4, loc4
44796d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	mov loc4 = r4
44894b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
44996d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	ld8 r2 = [in1], 8;;
45005feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov pr = r2, -1
45105feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
45205feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	ld8 r2 = [in1], 8;;
45394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov r8 = in0
45494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov r9 = in1
45594b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	and r2 = 127, r2;;
45694b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov ar.ec = 0
45794b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov ar.lc = r2;;
45805feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
45905feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	// use p6 to preserve p63 as it gets rotated into p16:
46005feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm(p16)	cmp.eq.unc p6,p0 = r0,r0;;
46105feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm1:
46205feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm(p6)	cmp.eq.unc p16,p0 = r0,r0
46305feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm(p63)	cmp.eq.unc p6,p0 = r0,r0
46405feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	br.ctop.dptk.few 1b;;
46505feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
46605feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm(p6)	cmp.eq.unc p63,p0 = r0,r0
46794b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
46896d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	CALL_NEXT_PTR(r4, r8, r9)
46994b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
47094b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	clrrrb
47194b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
47294b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov ar.pfs = loc0
47394b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov rp = loc1
47494b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov pr = loc2, -1
47594b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	mov ar.lc = loc3
47696d2898321e753c6cc2ee31aee0fe4aef6ad8277mostang.com!davidm	mov r4 = loc4
47794b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	br.ret.sptk.many rp
47894b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm
47994b71a1cd855910e19a2088f8531e409cc699dbahp.com!davidm	.endp rotate_regs
48005feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
48105feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.global save_pr
48205feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.proc save_pr
48305feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidmsave_pr:
48405feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.prologue
48505feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.regstk 2, 4, 2, 0
48605feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.save ar.pfs, loc0
48705feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	alloc loc0 = ar.pfs, 2, 4, 2, 0
48805feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.save rp, loc1
48905feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov loc1 = rp
49005feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.save pr, loc2
49105feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov loc2 = pr
49205feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
49305feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	ld8 r2 = [in1], 8;;
49405feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov pr = r2, -1
49505feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
49605feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	CALL_NEXT(loc3)
49705feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
49805feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov ar.pfs = loc0
49905feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov rp = loc1
50005feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	mov pr = loc2, -1
50105feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	br.ret.sptk.many rp
50205feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm
50305feedabeaa8eb45bc75b40309f7d2c365ebf581hp.com!davidm	.endp save_pr
50457e569646368cb730f028ecf1732143474e3e642Jan Kratochvil
50557e569646368cb730f028ecf1732143474e3e642Jan Kratochvil#ifdef __linux__
50657e569646368cb730f028ecf1732143474e3e642Jan Kratochvil        /* We do not need executable stack.  */
50757e569646368cb730f028ecf1732143474e3e642Jan Kratochvil        .section        .note.GNU-stack,"",@progbits
50857e569646368cb730f028ecf1732143474e3e642Jan Kratochvil#endif
509