1*252fbae2Sskrll/* $NetBSD: compat_sigsetjmp.S,v 1.3 2020/10/15 05:27:53 skrll Exp $ */ 2f80595caStsutsui 3f80595caStsutsui/*- 4f80595caStsutsui * Copyright (c) 1991, 1993, 1995, 5f80595caStsutsui * The Regents of the University of California. All rights reserved. 6f80595caStsutsui * 7f80595caStsutsui * This code is derived from software contributed to Berkeley by 8f80595caStsutsui * Havard Eidnes. 9f80595caStsutsui * 10f80595caStsutsui * Redistribution and use in source and binary forms, with or without 11f80595caStsutsui * modification, are permitted provided that the following conditions 12f80595caStsutsui * are met: 13f80595caStsutsui * 1. Redistributions of source code must retain the above copyright 14f80595caStsutsui * notice, this list of conditions and the following disclaimer. 15f80595caStsutsui * 2. Redistributions in binary form must reproduce the above copyright 16f80595caStsutsui * notice, this list of conditions and the following disclaimer in the 17f80595caStsutsui * documentation and/or other materials provided with the distribution. 18f80595caStsutsui * 3. Neither the name of the University nor the names of its contributors 19f80595caStsutsui * may be used to endorse or promote products derived from this software 20f80595caStsutsui * without specific prior written permission. 21f80595caStsutsui * 22f80595caStsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23f80595caStsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24f80595caStsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f80595caStsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26f80595caStsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27f80595caStsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28f80595caStsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29f80595caStsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30f80595caStsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31f80595caStsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32f80595caStsutsui * SUCH DAMAGE. 33f80595caStsutsui */ 34f80595caStsutsui 35f80595caStsutsui#include <sys/syscall.h> 36f80595caStsutsui#include <mips/asm.h> 37f45a8c29Smatt#include <mips/regdef.h> 38f45a8c29Smatt 39f45a8c29Smatt#include "assym.h" 40f80595caStsutsui 41f80595caStsutsui#if defined(LIBC_SCCS) && !defined(lint) 42f45a8c29Smatt#if 0 43f80595caStsutsui ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93") 44f45a8c29Smatt#else 45*252fbae2Sskrll ASMSTR("$NetBSD: compat_sigsetjmp.S,v 1.3 2020/10/15 05:27:53 skrll Exp $") 46f80595caStsutsui#endif 47f45a8c29Smatt#endif /* LIBC_SCCS and not lint */ 48f80595caStsutsui 49f80595caStsutsui/* 50f80595caStsutsui * C library -- sigsetjmp, siglongjmp 51f80595caStsutsui * 52f80595caStsutsui * siglongjmp(a,v) 53f80595caStsutsui * will generate a "return(v)" from 54f80595caStsutsui * the last call to 55f80595caStsutsui * sigsetjmp(a, savemask) 56f80595caStsutsui * by restoring registers from the stack, 57f80595caStsutsui * and dependent on savemask restores the 58f80595caStsutsui * signal mask. 59f80595caStsutsui */ 60f80595caStsutsui 61f80595caStsutsuiLEAF(sigsetjmp) 62f45a8c29Smatt SETUP_GP 63f45a8c29Smatt SETUP_GP64(t0, sigsetjmp) 64*252fbae2Sskrll INT_S a1, _SC_MASK13(a0) # save "savemask" 65f80595caStsutsui bne a1, 0x0, 1f # do saving of signal mask? 66f45a8c29Smatt PTR_LA t9, _C_LABEL(_setjmp) 67f80595caStsutsui jr t9 68f80595caStsutsui 69f45a8c29Smatt1: PTR_LA t9, _C_LABEL(setjmp) 70f80595caStsutsui jr t9 71f80595caStsutsuiEND(sigsetjmp) 72f80595caStsutsui 73f80595caStsutsuiLEAF(siglongjmp) 74f45a8c29Smatt SETUP_GP 75f45a8c29Smatt SETUP_GP64(t0, siglongjmp) 76*252fbae2Sskrll INT_L t1, _SC_MASK13(a0) # get "savemask" 77f45a8c29Smatt bne t1, 0x0, 1f # restore signal mask? 78f45a8c29Smatt PTR_LA t9, _C_LABEL(_longjmp) 79f80595caStsutsui jr t9 80f45a8c29Smatt 81f45a8c29Smatt1: PTR_LA t9, _C_LABEL(longjmp) 82f80595caStsutsui jr t9 83f80595caStsutsuiEND(siglongjmp) 84