sigsetjmp.S revision 1.8
11.8Suwe/* $NetBSD: sigsetjmp.S,v 1.8 2006/01/05 03:40:34 uwe Exp $ */ 21.1Smsaitoh 31.1Smsaitoh/*- 41.1Smsaitoh * Copyright (c) 1990 The Regents of the University of California. 51.1Smsaitoh * All rights reserved. 61.1Smsaitoh * 71.1Smsaitoh * This code is derived from software contributed to Berkeley by 81.1Smsaitoh * William Jolitz. 91.1Smsaitoh * 101.1Smsaitoh * Redistribution and use in source and binary forms, with or without 111.1Smsaitoh * modification, are permitted provided that the following conditions 121.1Smsaitoh * are met: 131.1Smsaitoh * 1. Redistributions of source code must retain the above copyright 141.1Smsaitoh * notice, this list of conditions and the following disclaimer. 151.1Smsaitoh * 2. Redistributions in binary form must reproduce the above copyright 161.1Smsaitoh * notice, this list of conditions and the following disclaimer in the 171.1Smsaitoh * documentation and/or other materials provided with the distribution. 181.6Sagc * 3. Neither the name of the University nor the names of its contributors 191.1Smsaitoh * may be used to endorse or promote products derived from this software 201.1Smsaitoh * without specific prior written permission. 211.1Smsaitoh * 221.1Smsaitoh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Smsaitoh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Smsaitoh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Smsaitoh * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Smsaitoh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Smsaitoh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Smsaitoh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Smsaitoh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Smsaitoh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Smsaitoh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Smsaitoh * SUCH DAMAGE. 331.1Smsaitoh * 341.7Suwe * from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90 351.1Smsaitoh */ 361.1Smsaitoh 371.1Smsaitoh#include <machine/asm.h> 381.8Suwe#include <machine/setjmp.h> 391.8Suwe 401.1Smsaitoh#if defined(LIBC_SCCS) 411.8Suwe RCSID("$NetBSD: sigsetjmp.S,v 1.8 2006/01/05 03:40:34 uwe Exp $") 421.1Smsaitoh#endif 431.1Smsaitoh 441.7SuweENTRY(__sigsetjmp14) 451.1Smsaitoh tst r5, r5 461.8Suwe bt 2f /* if (savemask == 0) */ 471.8Suwe 481.8Suwe /* identical to longjmp except that _JB_HAS_MASK is in the argument */ 491.8Suwe PIC_PROLOGUE(.L_got_1) 501.8Suwe sts.l pr, @-sp 511.8Suwe mov.l r4, @-sp 521.8Suwe mov.l r5, @-sp 531.4Smsaitoh 541.8Suwe mov.l .L___sigprocmask14_1, r0 551.7Suwe mov r4, r6 561.8Suwe mov #1, r4 /* how = SIG_BLOCK */ 571.8Suwe mov #0, r5 /* new = NULL */ 581.8Suwe1: CALL r0 591.8Suwe add #(_JB_SIGMASK * 4), r6 /* old = &sigmask */ 601.8Suwe 611.8Suwe mov.l @sp+, r5 621.8Suwe mov.l @sp+, r4 631.8Suwe lds.l @sp+, pr 641.8Suwe PIC_EPILOGUE 651.8Suwe 661.8Suwe2: /* identical to _setjmp except that _JB_HAS_MASK is in the argument */ 671.8Suwe add #((_JB_HAS_MASK + 1) * 4), r4 681.8Suwe mov.l r5, @-r4 /* has signal mask? */ 691.1Smsaitoh mov.l r15, @-r4 701.1Smsaitoh mov.l r14, @-r4 711.1Smsaitoh mov.l r13, @-r4 721.1Smsaitoh mov.l r12, @-r4 731.1Smsaitoh mov.l r11, @-r4 741.1Smsaitoh mov.l r10, @-r4 751.1Smsaitoh mov.l r9, @-r4 761.1Smsaitoh mov.l r8, @-r4 771.1Smsaitoh sts.l pr, @-r4 781.1Smsaitoh rts 791.8Suwe xor r0, r0 801.8Suwe 811.8Suwe .align 2 821.8Suwe.L_got_1: PIC_GOT_DATUM 831.8Suwe.L___sigprocmask14_1: CALL_DATUM(_C_LABEL(__sigprocmask14), 1b) 841.8Suwe SET_ENTRY_SIZE(__sigsetjmp14) 851.8Suwe 861.1Smsaitoh 871.7SuweENTRY(__siglongjmp14) 881.8Suwe mov.l @(_JB_HAS_MASK * 4, r4), r0 891.1Smsaitoh tst r0, r0 901.8Suwe bt 2f /* if no mask */ 911.8Suwe 921.8Suwe /* identical to longjmp */ 931.8Suwe PIC_PROLOGUE(.L_got_2) 941.8Suwe /* we won't return here, so we don't need to save pr */ 951.8Suwe mov.l r4, @-sp 961.8Suwe mov.l r5, @-sp 971.1Smsaitoh 981.8Suwe mov.l .L___sigprocmask14_2, r0 991.7Suwe mov r4, r5 1001.8Suwe mov #3, r4 /* how = SIG_SETMASK */ 1011.8Suwe add #(_JB_SIGMASK * 4), r5 /* new = &sigmask */ 1021.8Suwe1: CALL r0 1031.8Suwe mov #0, r6 /* old = NULL */ 1041.8Suwe 1051.8Suwe mov.l @sp+, r5 1061.8Suwe mov.l @sp+, r4 1071.8Suwe PIC_EPILOGUE 1081.1Smsaitoh 1091.8Suwe2: /* identical to _longjmp */ 1101.1Smsaitoh lds.l @r4+, pr 1111.1Smsaitoh mov.l @r4+, r8 1121.1Smsaitoh mov.l @r4+, r9 1131.1Smsaitoh mov.l @r4+, r10 1141.1Smsaitoh mov.l @r4+, r11 1151.1Smsaitoh mov.l @r4+, r12 1161.1Smsaitoh mov.l @r4+, r13 1171.1Smsaitoh mov.l @r4+, r14 1181.1Smsaitoh mov.l @r4+, r15 1191.7Suwe 1201.7Suwe mov r5, r0 1211.8Suwe tst r0, r0 /* make sure return value is non-zero */ 1221.1Smsaitoh bf .L0 1231.1Smsaitoh add #1, r0 1241.1Smsaitoh.L0: 1251.1Smsaitoh rts 1261.8Suwe nop 1271.1Smsaitoh 1281.4Smsaitoh .align 2 1291.8Suwe.L_got_2: PIC_GOT_DATUM 1301.8Suwe.L___sigprocmask14_2: CALL_DATUM(_C_LABEL(__sigprocmask14), 1b) 1311.8Suwe SET_ENTRY_SIZE(__siglongjmp14) 132