sigsetjmp.S revision 1.3
11.3Sjonathan/* $NetBSD: sigsetjmp.S,v 1.3 1996/09/16 18:11:03 jonathan 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.2Sjonathan#include <machine/regnum.h> 411.1Sjonathan#include <machine/machAsmDefs.h> 421.1Sjonathan#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.3Sjonathan ASMSTR("$NetBSD: sigsetjmp.S,v 1.3 1996/09/16 18:11:03 jonathan Exp $") 471.1Sjonathan#endif /* LIBC_SCCS and not lint */ 481.1Sjonathan 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.1SjonathanLEAF(sigsetjmp) 621.1Sjonathan sw a1, (_JBLEN*4)(a0) # save "savemask" 631.1Sjonathan bne a1, 0x0, 1f # do saving of signal mask? 641.1Sjonathan j _setjmp 651.1Sjonathan1: j setjmp 661.1SjonathanEND(sigsetjmp) 671.1Sjonathan 681.1SjonathanLEAF(siglongjmp) 691.1Sjonathan lw t0, (_JBLEN * 4)(a0) # get "savemask" 701.1Sjonathan bne t0, 0x0, 1f # restore signal mask? 711.1Sjonathan j _longjmp 721.1Sjonathan1: j longjmp 731.1SjonathanEND(siglongjmp) 74