Home | History | Annotate | Download | only in hppa
      1 /* libunwind - a platform-independent unwind library
      2    Copyright (C) 2004 Hewlett-Packard Co
      3 	Contributed by David Mosberger-Tang <davidm (at) hpl.hp.com>
      4 
      5 This file is part of libunwind.
      6 
      7 Permission is hereby granted, free of charge, to any person obtaining
      8 a copy of this software and associated documentation files (the
      9 "Software"), to deal in the Software without restriction, including
     10 without limitation the rights to use, copy, modify, merge, publish,
     11 distribute, sublicense, and/or sell copies of the Software, and to
     12 permit persons to whom the Software is furnished to do so, subject to
     13 the following conditions:
     14 
     15 The above copyright notice and this permission notice shall be
     16 included in all copies or substantial portions of the Software.
     17 
     18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
     25 
     26 /* The setcontext() in glibc is a no-op (as of 4 Dec 2004), so we have
     27    to implement something useful on our own here.  */
     28 
     29 #define FILL(n) ldw (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26),%r##n
     30 
     31 #include "offsets.h"
     32 
     33 	.align 4
     34 	.global _Uhppa_setcontext
     35 	.protected _Uhppa_setcontext
     36 	.proc
     37 	.callinfo
     38 _Uhppa_setcontext:
     39 	FILL (2)		/* return-pointer */
     40 	FILL (3)		/* frame pointer */
     41 	FILL (4)		/* 2nd-ary frame pointer */
     42 	FILL (5)		/* preserved register */
     43 	FILL (6)		/* preserved register */
     44 	FILL (7)		/* preserved register */
     45 	FILL (8)		/* preserved register */
     46 	FILL (9)		/* preserved register */
     47 	FILL (10)		/* preserved register */
     48 	FILL (11)		/* preserved register */
     49 	FILL (12)		/* preserved register */
     50 	FILL (13)		/* preserved register */
     51 	FILL (14)		/* preserved register */
     52 	FILL (15)		/* preserved register */
     53 	FILL (16)		/* preserved register */
     54 	FILL (17)		/* preserved register */
     55 	FILL (18)		/* preserved register */
     56 	FILL (19)		/* linkage-table register */
     57 	FILL (27)		/* global-data pointer */
     58 	FILL (30)		/* stack pointer */
     59 
     60 	ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29
     61 	fldds,ma 8(%r29), %fr12
     62 	fldds,ma 8(%r29), %fr13
     63 	fldds,ma 8(%r29), %fr14
     64 	fldds,ma 8(%r29), %fr15
     65 	fldds,ma 8(%r29), %fr16
     66 	fldds,ma 8(%r29), %fr17
     67 	fldds,ma 8(%r29), %fr18
     68 	fldds,ma 8(%r29), %fr19
     69 	fldds,ma 8(%r29), %fr20
     70 	fldds    8(%r29), %fr21
     71 
     72 	bv,n	%r0(%rp)
     73 	.procend
     74 #ifdef __linux__
     75 	/* We do not need executable stack.  */
     76 	.section	.note.GNU-stack,"",@progbits
     77 #endif
     78