compat_sigsetjmp.S revision 1.4
11.4Sriastrad/*	$NetBSD: compat_sigsetjmp.S,v 1.4 2025/04/24 01:42:38 riastradh 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/asm.h>
371.2Smatt#include <mips/regdef.h>
381.2Smatt
391.2Smatt#include "assym.h"
401.1Stsutsui
411.1Stsutsui#if defined(LIBC_SCCS) && !defined(lint)
421.2Smatt#if 0
431.1Stsutsui	ASMSTR("from: @(#)setjmp.s	8.1 (Berkeley) 6/4/93")
441.2Smatt#else
451.4Sriastrad	ASMSTR("$NetBSD: compat_sigsetjmp.S,v 1.4 2025/04/24 01:42:38 riastradh Exp $")
461.2Smatt#endif
471.1Stsutsui#endif /* LIBC_SCCS and not lint */
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.2Smatt	SETUP_GP
631.2Smatt	SETUP_GP64(t0, sigsetjmp)
641.3Sskrll	INT_S	a1, _SC_MASK13(a0)		# save "savemask"
651.1Stsutsui	bne	a1, 0x0, 1f			# do saving of signal mask?
661.2Smatt	PTR_LA	t9, _C_LABEL(_setjmp)
671.4Sriastrad	RESTORE_GP64
681.2Smatt	jr	t9
691.1Stsutsui
701.2Smatt1:	PTR_LA	t9, _C_LABEL(setjmp)
711.4Sriastrad	RESTORE_GP64
721.2Smatt	jr	t9
731.1StsutsuiEND(sigsetjmp)
741.1Stsutsui
751.1StsutsuiLEAF(siglongjmp)
761.2Smatt	SETUP_GP
771.2Smatt	SETUP_GP64(t0, siglongjmp)
781.3Sskrll	INT_L	t1, _SC_MASK13(a0)		# get "savemask"
791.2Smatt	bne	t1, 0x0, 1f			# restore signal mask?
801.2Smatt	PTR_LA	t9, _C_LABEL(_longjmp)
811.1Stsutsui	jr	t9
821.2Smatt
831.2Smatt1:	PTR_LA	t9, _C_LABEL(longjmp)
841.1Stsutsui	jr	t9
851.1StsutsuiEND(siglongjmp)
86