1/* $OpenBSD: sigsetjmp.S,v 1.3 2012/08/22 17:19:35 pascal Exp $ */ 2/* $NetBSD: sigsetjmp.S,v 1.5 2000/08/28 00:45:59 eeh Exp $ */ 3/* 4 * Copyright (c) 1995 Paul Kranenburg 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Paul Kranenburg. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 */ 33 34#include "SYS.h" 35 36#ifdef __PIC__ 37 38ENTRY(sigsetjmp) 39 PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE 40 set _C_LABEL(setjmp), %o2 ! if (%o1 != 0) goto _setjmp; 41 set _C_LABEL(_setjmp), %o3 ! else goto __setjmp; 42 movrnz %o1, %o2, %o3 43 ldx [%g1+%o3], %g1 44 jmp %g1 45 st %o1,[%o0 + 8*14] ! jmpbuf[JBLEN] 46 47 48ENTRY(siglongjmp) 49 PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE 50 ld [%o0 + 8*14],%o2 ! jmpbuf[JBLEN] 51 set _C_LABEL(longjmp), %o3 ! if (%o2 != 0) goto _longjmp; 52 set _C_LABEL(_longjmp), %o4 ! else goto __longjmp; 53 movrnz %o2, %o3, %o4 54 ldx [%g1 + %o4], %g1 55 jmp %g1 56 nop 57 unimp 0 58 59#else /* PIC */ 60 61ENTRY(sigsetjmp) 62 brz,pt %o1,_C_LABEL(_setjmp) 63 st %o1,[%o0 + 8*14] ! jmpbuf[JBLEN] 64 ba,a,pt %icc,_C_LABEL(setjmp) 65 nop ! spitfire bug 66 unimp 0 67 68ENTRY(siglongjmp) 69 ld [%o0 + 8*14], %g1 70 brz,pt %g1, _C_LABEL(_longjmp) 71 nop 72 ba,a,pt %icc, _C_LABEL(longjmp) 73 unimp 0 74 75#endif /* PIC */ 76