11.9Smatt/* $NetBSD: sigsetjmp.S,v 1.9 2009/12/14 01:07:42 matt 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.9Smatt#include "assym.h" 411.9Smatt#include "SYS.h" 421.9Smatt 431.1Sjonathan#if defined(LIBC_SCCS) && !defined(lint) 441.9Smatt#if 0 451.9Smatt RCSID("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") 461.9Smatt#else 471.9Smatt RCSID("$NetBSD: sigsetjmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $") 481.9Smatt#endif 491.1Sjonathan#endif /* LIBC_SCCS and not lint */ 501.1Sjonathan 511.1Sjonathan/* 521.1Sjonathan * C library -- sigsetjmp, siglongjmp 531.1Sjonathan * 541.1Sjonathan * siglongjmp(a,v) 551.1Sjonathan * will generate a "return(v)" from 561.1Sjonathan * the last call to 571.1Sjonathan * sigsetjmp(a, savemask) 581.1Sjonathan * by restoring registers from the stack, 591.1Sjonathan * and dependent on savemask restores the 601.1Sjonathan * signal mask. 611.1Sjonathan */ 621.1Sjonathan 631.8StsutsuiLEAF(__sigsetjmp14) 641.9Smatt PIC_PROLOGUE(__sigsetjmp14) 651.9Smatt REG_S a1, _JBLEN*SZREG(a0) # save "savemask" 661.1Sjonathan bne a1, 0x0, 1f # do saving of signal mask? 671.9Smatt PIC_TAILCALL(_setjmp) 681.4Sjonathan 691.9Smatt1: PIC_TAILCALL(__setjmp14) 701.8StsutsuiEND(__sigsetjmp14) 711.1Sjonathan 721.8StsutsuiLEAF(__siglongjmp14) 731.9Smatt PIC_PROLOGUE(__siglongjmp14) 741.9Smatt REG_L t0, _JBLEN*SZREG(a0) # get "savemask" 751.1Sjonathan bne t0, 0x0, 1f # restore signal mask? 761.9Smatt PIC_TAILCALL(_longjmp) 771.9Smatt 781.9Smatt1: PIC_TAILCALL(__longjmp14) 791.8StsutsuiEND(__siglongjmp14) 80