sigsetjmp.S revision 1.6
11.6Sthorpej/* $NetBSD: sigsetjmp.S,v 1.6 2002/11/10 18:10:25 thorpej 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.1Sjonathan * 3. All advertising materials mentioning features or use of this software 191.1Sjonathan * must display the following acknowledgement: 201.1Sjonathan * This product includes software developed by the University of 211.1Sjonathan * California, Berkeley and its contributors. 221.1Sjonathan * 4. Neither the name of the University nor the names of its contributors 231.1Sjonathan * may be used to endorse or promote products derived from this software 241.1Sjonathan * without specific prior written permission. 251.1Sjonathan * 261.1Sjonathan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271.1Sjonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281.1Sjonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291.1Sjonathan * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301.1Sjonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311.1Sjonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321.1Sjonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331.1Sjonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341.1Sjonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351.1Sjonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361.1Sjonathan * SUCH DAMAGE. 371.1Sjonathan */ 381.1Sjonathan 391.1Sjonathan#include <sys/syscall.h> 401.4Sjonathan#include <mips/regnum.h> 411.4Sjonathan#include <mips/asm.h> 421.5Scastor#include <machine/setjmp.h> 431.1Sjonathan 441.1Sjonathan#if defined(LIBC_SCCS) && !defined(lint) 451.1Sjonathan ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") 461.6Sthorpej ASMSTR("$NetBSD: sigsetjmp.S,v 1.6 2002/11/10 18:10:25 thorpej Exp $") 471.1Sjonathan#endif /* LIBC_SCCS and not lint */ 481.1Sjonathan 491.6Sthorpej#ifdef __ABICALLS__ 501.4Sjonathan .abicalls 511.4Sjonathan#endif 521.4Sjonathan 531.1Sjonathan/* 541.1Sjonathan * C library -- sigsetjmp, siglongjmp 551.1Sjonathan * 561.1Sjonathan * siglongjmp(a,v) 571.1Sjonathan * will generate a "return(v)" from 581.1Sjonathan * the last call to 591.1Sjonathan * sigsetjmp(a, savemask) 601.1Sjonathan * by restoring registers from the stack, 611.1Sjonathan * and dependent on savemask restores the 621.1Sjonathan * signal mask. 631.1Sjonathan */ 641.1Sjonathan 651.1SjonathanLEAF(sigsetjmp) 661.6Sthorpej#ifdef __ABICALLS__ 671.4Sjonathan .set noreorder 681.4Sjonathan .cpload t9 691.4Sjonathan .set reorder 701.4Sjonathan#endif 711.1Sjonathan sw a1, (_JBLEN*4)(a0) # save "savemask" 721.1Sjonathan bne a1, 0x0, 1f # do saving of signal mask? 731.4Sjonathan la t9, _setjmp 741.4Sjonathan jr t9 751.4Sjonathan 761.4Sjonathan1: la t9, setjmp 771.4Sjonathan jr t9 781.1SjonathanEND(sigsetjmp) 791.1Sjonathan 801.1SjonathanLEAF(siglongjmp) 811.6Sthorpej#ifdef __ABICALLS__ 821.4Sjonathan .set noreorder 831.4Sjonathan .cpload t9 841.4Sjonathan .set reorder 851.4Sjonathan#endif 861.1Sjonathan lw t0, (_JBLEN * 4)(a0) # get "savemask" 871.1Sjonathan bne t0, 0x0, 1f # restore signal mask? 881.4Sjonathan la t9, _longjmp 891.4Sjonathan jr t9 901.4Sjonathan1: la t9, longjmp 911.4Sjonathan jr t9 921.1SjonathanEND(siglongjmp) 93