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