2002-12-31 17:36:52 +08:00
|
|
|
/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
2000-06-10 08:14:45 +08:00
|
|
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 14:58:28 +08:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-06-10 08:14:45 +08:00
|
|
|
|
|
|
|
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
|
2001-07-06 14:58:28 +08:00
|
|
|
Lesser General Public License for more details.
|
2000-06-10 08:14:45 +08:00
|
|
|
|
2001-07-06 14:58:28 +08:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
2000-06-10 08:14:45 +08:00
|
|
|
|
|
|
|
The layout of the jmp_buf is as follows. This is subject to change
|
|
|
|
and user-code should never depend on the particular layout of
|
|
|
|
jmp_buf!
|
2001-03-25 13:15:51 +08:00
|
|
|
|
2000-06-10 08:14:45 +08:00
|
|
|
|
|
|
|
offset: description:
|
|
|
|
------- ------------
|
|
|
|
0x000 stack pointer (r12) ; unchangeable (see _JMPBUF_UNWINDS)
|
|
|
|
0x008 r1 (gp)
|
|
|
|
0x010 caller's unat
|
|
|
|
0x018 fpsr
|
|
|
|
0x020 r4
|
|
|
|
0x028 r5
|
|
|
|
0x030 r6
|
|
|
|
0x038 r7
|
|
|
|
0x040 rp (b0)
|
|
|
|
0x048 b1
|
|
|
|
0x050 b2
|
|
|
|
0x058 b3
|
|
|
|
0x060 b4
|
|
|
|
0x068 b5
|
|
|
|
0x070 ar.pfs
|
|
|
|
0x078 ar.lc
|
|
|
|
0x080 pr
|
|
|
|
0x088 ar.bsp ; unchangeable (see __longjmp.S)
|
|
|
|
0x090 ar.unat
|
|
|
|
0x098 &__jmp_buf ; address of the jmpbuf (needed to locate NaT bits in unat)
|
|
|
|
0x0a0 f2
|
|
|
|
0x0b0 f3
|
|
|
|
0x0c0 f4
|
|
|
|
0x0d0 f5
|
|
|
|
0x0e0 f16
|
|
|
|
0x0f0 f17
|
|
|
|
0x100 f18
|
|
|
|
0x110 f19
|
|
|
|
0x120 f20
|
|
|
|
0x130 f21
|
|
|
|
0x130 f22
|
|
|
|
0x140 f23
|
|
|
|
0x150 f24
|
|
|
|
0x160 f25
|
|
|
|
0x170 f26
|
|
|
|
0x180 f27
|
|
|
|
0x190 f28
|
|
|
|
0x1a0 f29
|
|
|
|
0x1b0 f30
|
|
|
|
0x1c0 f31 */
|
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
#include <features.h>
|
|
|
|
|
|
|
|
/* The following two entry points are the traditional entry points: */
|
|
|
|
|
2001-03-25 13:15:51 +08:00
|
|
|
LEAF(setjmp)
|
|
|
|
alloc r8=ar.pfs,2,0,0,0
|
2000-06-10 08:14:45 +08:00
|
|
|
mov in1=1
|
|
|
|
br.cond.sptk.many __sigsetjmp
|
2001-03-25 13:15:51 +08:00
|
|
|
END(setjmp)
|
2000-06-10 08:14:45 +08:00
|
|
|
|
2001-03-25 13:15:51 +08:00
|
|
|
LEAF(_setjmp)
|
2000-06-10 08:14:45 +08:00
|
|
|
alloc r8=ar.pfs,2,0,0,0
|
|
|
|
mov in1=0
|
|
|
|
br.cond.sptk.many __sigsetjmp
|
2001-03-25 13:15:51 +08:00
|
|
|
END(_setjmp)
|
2003-01-01 04:46:11 +08:00
|
|
|
libc_hidden_def (_setjmp)
|
2000-06-10 08:14:45 +08:00
|
|
|
|
|
|
|
/* __sigsetjmp(__jmp_buf buf, int savemask) */
|
2001-03-25 13:15:51 +08:00
|
|
|
|
|
|
|
ENTRY(__sigsetjmp)
|
|
|
|
.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
|
2003-05-15 04:44:11 +08:00
|
|
|
alloc loc1=ar.pfs,2,3,2,0
|
|
|
|
.save ar.unat, loc2
|
|
|
|
mov loc2=ar.unat
|
2000-06-10 08:14:45 +08:00
|
|
|
;;
|
|
|
|
mov r17=ar.fpsr
|
|
|
|
mov r2=in0
|
|
|
|
add r3=8,in0
|
|
|
|
;;
|
2003-03-28 03:51:26 +08:00
|
|
|
.mem.offset 8,0; st8.spill.nta [r2]=sp,16 // r12 (sp)
|
|
|
|
.mem.offset 0,0; st8.spill.nta [r3]=gp,16 // r1 (gp)
|
2000-06-10 08:14:45 +08:00
|
|
|
;;
|
2003-05-15 04:44:11 +08:00
|
|
|
st8.nta [r2]=loc2,16 // save caller's unat
|
2000-06-10 08:14:45 +08:00
|
|
|
st8.nta [r3]=r17,16 // save fpsr
|
|
|
|
add r8=0xa0,in0
|
|
|
|
;;
|
2003-03-28 03:51:26 +08:00
|
|
|
.mem.offset 8,0; st8.spill.nta [r2]=r4,16 // r4
|
|
|
|
.mem.offset 0,0; st8.spill.nta [r3]=r5,16 // r5
|
2000-06-10 08:14:45 +08:00
|
|
|
add r9=0xb0,in0
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f2,32
|
|
|
|
stf.spill.nta [r9]=f3,32
|
2001-03-25 13:15:51 +08:00
|
|
|
mov loc0=rp
|
|
|
|
.body
|
2000-06-10 08:14:45 +08:00
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f4,32
|
|
|
|
stf.spill.nta [r9]=f5,32
|
|
|
|
mov r17=b1
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f16,32
|
|
|
|
stf.spill.nta [r9]=f17,32
|
|
|
|
mov r18=b2
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f18,32
|
|
|
|
stf.spill.nta [r9]=f19,32
|
|
|
|
mov r19=b3
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f20,32
|
|
|
|
stf.spill.nta [r9]=f21,32
|
|
|
|
mov r20=b4
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f22,32
|
|
|
|
stf.spill.nta [r9]=f23,32
|
|
|
|
mov r21=b5
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f24,32
|
|
|
|
stf.spill.nta [r9]=f25,32
|
|
|
|
mov r22=ar.lc
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f26,32
|
|
|
|
stf.spill.nta [r9]=f27,32
|
|
|
|
mov r24=pr
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f28,32
|
|
|
|
stf.spill.nta [r9]=f29,32
|
|
|
|
;;
|
|
|
|
stf.spill.nta [r8]=f30
|
|
|
|
stf.spill.nta [r9]=f31
|
|
|
|
|
2003-03-28 03:51:26 +08:00
|
|
|
.mem.offset 8,0; st8.spill.nta [r2]=r6,16 // r6
|
|
|
|
.mem.offset 0,0; st8.spill.nta [r3]=r7,16 // r7
|
2000-06-10 08:14:45 +08:00
|
|
|
;;
|
|
|
|
mov r23=ar.bsp
|
|
|
|
mov r25=ar.unat
|
|
|
|
mov out0=in0
|
|
|
|
|
2001-03-25 13:15:51 +08:00
|
|
|
st8.nta [r2]=loc0,16 // b0
|
2000-06-10 08:14:45 +08:00
|
|
|
st8.nta [r3]=r17,16 // b1
|
2000-09-30 00:45:44 +08:00
|
|
|
mov out1=in1
|
2000-06-10 08:14:45 +08:00
|
|
|
;;
|
|
|
|
st8.nta [r2]=r18,16 // b2
|
|
|
|
st8.nta [r3]=r19,16 // b3
|
|
|
|
;;
|
|
|
|
st8.nta [r2]=r20,16 // b4
|
|
|
|
st8.nta [r3]=r21,16 // b5
|
|
|
|
;;
|
2001-03-25 13:15:51 +08:00
|
|
|
st8.nta [r2]=loc1,16 // ar.pfs
|
2000-06-10 08:14:45 +08:00
|
|
|
st8.nta [r3]=r22,16 // ar.lc
|
|
|
|
;;
|
|
|
|
st8.nta [r2]=r24,16 // pr
|
|
|
|
st8.nta [r3]=r23,16 // ar.bsp
|
|
|
|
;;
|
|
|
|
st8.nta [r2]=r25 // ar.unat
|
|
|
|
st8.nta [r3]=in0 // &__jmp_buf
|
2000-09-30 00:45:44 +08:00
|
|
|
br.call.dpnt.few rp=__sigjmp_save
|
2000-06-10 08:14:45 +08:00
|
|
|
.ret0: // force a new bundle ::q
|
2003-05-15 04:44:11 +08:00
|
|
|
mov.m ar.unat=loc2 // restore caller's unat
|
2001-03-25 13:15:51 +08:00
|
|
|
mov rp=loc0
|
|
|
|
mov ar.pfs=loc1
|
2003-03-28 03:51:26 +08:00
|
|
|
mov r8=0
|
2000-06-10 08:14:45 +08:00
|
|
|
ret
|
2001-03-25 13:15:51 +08:00
|
|
|
END(__sigsetjmp)
|
2000-06-10 08:14:45 +08:00
|
|
|
|
2000-11-22 04:55:38 +08:00
|
|
|
weak_extern(_setjmp)
|
2000-06-10 08:14:45 +08:00
|
|
|
weak_extern(setjmp)
|