sigsetjmp.S revision 1.1
11.1Sjonathan/*-
21.1Sjonathan * Copyright (c) 1991, 1993, 1995,
31.1Sjonathan *	The Regents of the University of California.  All rights reserved.
41.1Sjonathan *
51.1Sjonathan * This code is derived from software contributed to Berkeley by
61.1Sjonathan * Havard Eidnes.
71.1Sjonathan *
81.1Sjonathan * Redistribution and use in source and binary forms, with or without
91.1Sjonathan * modification, are permitted provided that the following conditions
101.1Sjonathan * are met:
111.1Sjonathan * 1. Redistributions of source code must retain the above copyright
121.1Sjonathan *    notice, this list of conditions and the following disclaimer.
131.1Sjonathan * 2. Redistributions in binary form must reproduce the above copyright
141.1Sjonathan *    notice, this list of conditions and the following disclaimer in the
151.1Sjonathan *    documentation and/or other materials provided with the distribution.
161.1Sjonathan * 3. All advertising materials mentioning features or use of this software
171.1Sjonathan *    must display the following acknowledgement:
181.1Sjonathan *	This product includes software developed by the University of
191.1Sjonathan *	California, Berkeley and its contributors.
201.1Sjonathan * 4. Neither the name of the University nor the names of its contributors
211.1Sjonathan *    may be used to endorse or promote products derived from this software
221.1Sjonathan *    without specific prior written permission.
231.1Sjonathan *
241.1Sjonathan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251.1Sjonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261.1Sjonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271.1Sjonathan * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281.1Sjonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291.1Sjonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301.1Sjonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311.1Sjonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321.1Sjonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331.1Sjonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341.1Sjonathan * SUCH DAMAGE.
351.1Sjonathan */
361.1Sjonathan
371.1Sjonathan#include <sys/syscall.h>
381.1Sjonathan#include <machine/reg.h>
391.1Sjonathan#include <machine/machAsmDefs.h>
401.1Sjonathan#include <machine/setjmp.h>
411.1Sjonathan
421.1Sjonathan#if defined(LIBC_SCCS) && !defined(lint)
431.1Sjonathan	ASMSTR("from: @(#)setjmp.s	8.1 (Berkeley) 6/4/93")
441.1Sjonathan	ASMSTR("$Id: sigsetjmp.S,v 1.1 1995/12/15 01:12:38 jonathan Exp $")
451.1Sjonathan#endif /* LIBC_SCCS and not lint */
461.1Sjonathan
471.1Sjonathan/*
481.1Sjonathan * C library -- sigsetjmp, siglongjmp
491.1Sjonathan *
501.1Sjonathan *	siglongjmp(a,v)
511.1Sjonathan * will generate a "return(v)" from
521.1Sjonathan * the last call to
531.1Sjonathan *	sigsetjmp(a, savemask)
541.1Sjonathan * by restoring registers from the stack,
551.1Sjonathan * and dependent on savemask restores the
561.1Sjonathan * signal mask.
571.1Sjonathan */
581.1Sjonathan
591.1SjonathanLEAF(sigsetjmp)
601.1Sjonathan	sw	a1, (_JBLEN*4)(a0)		# save "savemask"
611.1Sjonathan	bne	a1, 0x0, 1f			# do saving of signal mask?
621.1Sjonathan	j	_setjmp
631.1Sjonathan1:	j	setjmp
641.1SjonathanEND(sigsetjmp)
651.1Sjonathan
661.1SjonathanLEAF(siglongjmp)
671.1Sjonathan	lw	t0, (_JBLEN * 4)(a0)		# get "savemask"
681.1Sjonathan	bne	t0, 0x0, 1f			# restore signal mask?
691.1Sjonathan	j	_longjmp
701.1Sjonathan1:	j	longjmp
711.1SjonathanEND(siglongjmp)
72