16daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang/* libunwind - a platform-independent unwind library
26daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang   Copyright (C) 2004 Hewlett-Packard Co
36daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
46daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
56daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangThis file is part of libunwind.
66daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
76daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangPermission is hereby granted, free of charge, to any person obtaining
86daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tanga copy of this software and associated documentation files (the
96daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang"Software"), to deal in the Software without restriction, including
106daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tangwithout limitation the rights to use, copy, modify, merge, publish,
116daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tangdistribute, sublicense, and/or sell copies of the Software, and to
126daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tangpermit persons to whom the Software is furnished to do so, subject to
136daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tangthe following conditions:
146daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
156daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangThe above copyright notice and this permission notice shall be
166daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tangincluded in all copies or substantial portions of the Software.
176daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
186daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
196daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
206daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
216daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
226daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
236daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
246daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-TangWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
256daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
266daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang/* The setcontext() in glibc is a no-op (as of 4 Dec 2004), so we have
276daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang   to implement something useful on our own here.  */
286daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
296daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang#define FILL(n) ldw (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26),%r##n
306daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
316daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang#include "offsets.h"
326daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
336daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.align 4
346daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.global _Uhppa_setcontext
356daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.protected _Uhppa_setcontext
366daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.proc
376daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.callinfo
386daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang_Uhppa_setcontext:
396daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (2)		/* return-pointer */
406daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (3)		/* frame pointer */
416daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (4)		/* 2nd-ary frame pointer */
426daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (5)		/* preserved register */
436daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (6)		/* preserved register */
446daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (7)		/* preserved register */
456daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (8)		/* preserved register */
466daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (9)		/* preserved register */
476daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (10)		/* preserved register */
486daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (11)		/* preserved register */
496daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (12)		/* preserved register */
506daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (13)		/* preserved register */
516daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (14)		/* preserved register */
526daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (15)		/* preserved register */
536daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (16)		/* preserved register */
546daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (17)		/* preserved register */
556daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (18)		/* preserved register */
566daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (19)		/* linkage-table register */
576daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (27)		/* global-data pointer */
586daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	FILL (30)		/* stack pointer */
596daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
606daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29
616daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr12
626daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr13
636daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr14
646daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr15
656daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr16
666daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr17
676daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr18
686daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr19
696daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds,ma 8(%r29), %fr20
706daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	fldds    8(%r29), %fr21
716daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang
726daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	bv,n	%r0(%rp)
736daeeac60ac046af9487dadd5a6b38fce0ea8219David Mosberger-Tang	.procend
7457e569646368cb730f028ecf1732143474e3e642Jan Kratochvil#ifdef __linux__
7557e569646368cb730f028ecf1732143474e3e642Jan Kratochvil	/* We do not need executable stack.  */
7657e569646368cb730f028ecf1732143474e3e642Jan Kratochvil	.section	.note.GNU-stack,"",@progbits
7757e569646368cb730f028ecf1732143474e3e642Jan Kratochvil#endif
78