Home | History | Annotate | Line # | Download | only in gen
sigsetjmp.S revision 1.1
      1 /*	$NetBSD: sigsetjmp.S,v 1.1 1995/01/11 20:22:28 pk Exp $	*/
      2 /*
      3  * Copyright (c) 1995 Paul Kranenburg
      4  * All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *      This product includes software developed by Paul Kranenburg.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  *
     31  */
     32 
     33 #include "SYS.h"
     34 
     35 #ifdef PIC
     36 	/*
     37 	 * We cannot do PIC branches to external labels, hence all this crap.
     38 	 */
     39 	.data
     40 L_setjmp:	.word	_setjmp
     41 L__setjmp:	.word	__setjmp
     42 L_longjmp:	.word	_longjmp
     43 L__longjmp:	.word	__longjmp
     44 
     45 	.text
     46 
     47 ENTRY(sigsetjmp)
     48 	PIC_PROLOGUE(%g1,%g2)
     49 	cmp %o1,0
     50 	st %o1,[%o0+40]		! jmpbuf[JBLEN]
     51 	bne 1f
     52 	nop
     53 	ld [%g1+L__setjmp], %g1
     54 	ba,a 2f
     55 1:
     56 	ld [%g1+L_setjmp], %g1
     57 	ba,a 2f
     58 	unimp 0
     59 
     60 ENTRY(siglongjmp)
     61 	PIC_PROLOGUE(%g1,%g2)
     62 	ld [%o0+40],%g2
     63 	cmp %g2,0
     64 	bne 1f
     65 	nop
     66 	ld [%g1+L__longjmp], %g1
     67 	ba,a 2f
     68 1:
     69 	ld [%g1+L_longjmp], %g1
     70 2:
     71 	ld [%g1],%g1
     72 	jmp %g1
     73 	nop
     74 	unimp 0
     75 #else
     76 
     77 ENTRY(sigsetjmp)
     78 	cmp %o1,0
     79 	st %o1,[%o0+40]		! jmpbuf[JBLEN]
     80 	be __setjmp
     81 	nop
     82 	ba _setjmp
     83 	nop
     84 	unimp 0
     85 
     86 ENTRY(siglongjmp)
     87 	ld [%o0+40],%g1
     88 	cmp %g1,0
     89 	be __longjmp
     90 	nop
     91 	ba _longjmp
     92 	nop
     93 	unimp 0
     94 #endif
     95