sigsetjmp.S revision 1.8
11.8Stsutsui/* $NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $ */ 21.3Sjonathan 31.1Sjonathan/*- 41.1Sjonathan * Copyright (c) 1991, 1993, 1995, 51.1Sjonathan * The Regents of the University of California. All rights reserved. 61.1Sjonathan * 71.1Sjonathan * This code is derived from software contributed to Berkeley by 81.1Sjonathan * Havard Eidnes. 91.1Sjonathan * 101.1Sjonathan * Redistribution and use in source and binary forms, with or without 111.1Sjonathan * modification, are permitted provided that the following conditions 121.1Sjonathan * are met: 131.1Sjonathan * 1. Redistributions of source code must retain the above copyright 141.1Sjonathan * notice, this list of conditions and the following disclaimer. 151.1Sjonathan * 2. Redistributions in binary form must reproduce the above copyright 161.1Sjonathan * notice, this list of conditions and the following disclaimer in the 171.1Sjonathan * documentation and/or other materials provided with the distribution. 181.7Sagc * 3. Neither the name of the University nor the names of its contributors 191.1Sjonathan * may be used to endorse or promote products derived from this software 201.1Sjonathan * without specific prior written permission. 211.1Sjonathan * 221.1Sjonathan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Sjonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Sjonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Sjonathan * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Sjonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Sjonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Sjonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Sjonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Sjonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Sjonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Sjonathan * SUCH DAMAGE. 331.1Sjonathan */ 341.1Sjonathan 351.1Sjonathan#include <sys/syscall.h> 361.4Sjonathan#include <mips/regnum.h> 371.4Sjonathan#include <mips/asm.h> 381.5Scastor#include <machine/setjmp.h> 391.1Sjonathan 401.1Sjonathan#if defined(LIBC_SCCS) && !defined(lint) 411.1Sjonathan ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") 421.8Stsutsui ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $") 431.1Sjonathan#endif /* LIBC_SCCS and not lint */ 441.1Sjonathan 451.6Sthorpej#ifdef __ABICALLS__ 461.4Sjonathan .abicalls 471.4Sjonathan#endif 481.4Sjonathan 491.1Sjonathan/* 501.1Sjonathan * C library -- sigsetjmp, siglongjmp 511.1Sjonathan * 521.1Sjonathan * siglongjmp(a,v) 531.1Sjonathan * will generate a "return(v)" from 541.1Sjonathan * the last call to 551.1Sjonathan * sigsetjmp(a, savemask) 561.1Sjonathan * by restoring registers from the stack, 571.1Sjonathan * and dependent on savemask restores the 581.1Sjonathan * signal mask. 591.1Sjonathan */ 601.1Sjonathan 611.8StsutsuiLEAF(__sigsetjmp14) 621.6Sthorpej#ifdef __ABICALLS__ 631.4Sjonathan .set noreorder 641.4Sjonathan .cpload t9 651.4Sjonathan .set reorder 661.4Sjonathan#endif 671.1Sjonathan sw a1, (_JBLEN*4)(a0) # save "savemask" 681.1Sjonathan bne a1, 0x0, 1f # do saving of signal mask? 691.4Sjonathan la t9, _setjmp 701.4Sjonathan jr t9 711.4Sjonathan 721.8Stsutsui1: la t9, __setjmp14 731.4Sjonathan jr t9 741.8StsutsuiEND(__sigsetjmp14) 751.1Sjonathan 761.8StsutsuiLEAF(__siglongjmp14) 771.6Sthorpej#ifdef __ABICALLS__ 781.4Sjonathan .set noreorder 791.4Sjonathan .cpload t9 801.4Sjonathan .set reorder 811.4Sjonathan#endif 821.1Sjonathan lw t0, (_JBLEN * 4)(a0) # get "savemask" 831.1Sjonathan bne t0, 0x0, 1f # restore signal mask? 841.4Sjonathan la t9, _longjmp 851.4Sjonathan jr t9 861.8Stsutsui1: la t9, __longjmp14 871.4Sjonathan jr t9 881.8StsutsuiEND(__siglongjmp14) 89