1*6cb10275Sriastradh/* $NetBSD: compat_sigsetjmp.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $ */ 2eebf1202Schristos 3eebf1202Schristos/*- 4eebf1202Schristos * Copyright (c) 1990 The Regents of the University of California. 5eebf1202Schristos * All rights reserved. 6eebf1202Schristos * 7eebf1202Schristos * This code is derived from software contributed to Berkeley by 8eebf1202Schristos * the Systems Programming Group of the University of Utah Computer 9eebf1202Schristos * Science Department. 10eebf1202Schristos * 11eebf1202Schristos * Redistribution and use in source and binary forms, with or without 12eebf1202Schristos * modification, are permitted provided that the following conditions 13eebf1202Schristos * are met: 14eebf1202Schristos * 1. Redistributions of source code must retain the above copyright 15eebf1202Schristos * notice, this list of conditions and the following disclaimer. 16eebf1202Schristos * 2. Redistributions in binary form must reproduce the above copyright 17eebf1202Schristos * notice, this list of conditions and the following disclaimer in the 18eebf1202Schristos * documentation and/or other materials provided with the distribution. 19eebf1202Schristos * 3. Neither the name of the University nor the names of its contributors 20eebf1202Schristos * may be used to endorse or promote products derived from this software 21eebf1202Schristos * without specific prior written permission. 22eebf1202Schristos * 23eebf1202Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24eebf1202Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25eebf1202Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26eebf1202Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27eebf1202Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28eebf1202Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29eebf1202Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30eebf1202Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31eebf1202Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32eebf1202Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33eebf1202Schristos * SUCH DAMAGE. 34eebf1202Schristos */ 35eebf1202Schristos 36eebf1202Schristos#include <machine/asm.h> 37eebf1202Schristos 38eebf1202Schristos#if defined(LIBC_SCCS) && !defined(lint) 39eebf1202Schristos#if 0 40eebf1202Schristos RCSID("from: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90") 41eebf1202Schristos#else 42*6cb10275Sriastradh RCSID("$NetBSD: compat_sigsetjmp.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $") 43eebf1202Schristos#endif 44eebf1202Schristos#endif /* LIBC_SCCS and not lint */ 45eebf1202Schristos 46eebf1202Schristos/* 47eebf1202Schristos * C library -- sigsetjmp, siglongjmp 48eebf1202Schristos * 49eebf1202Schristos * siglongjmp(a,v) 50eebf1202Schristos * will generate a "return(v)" from 51eebf1202Schristos * the last call to 52eebf1202Schristos * sigsetjmp(a,m) 53eebf1202Schristos * by restoring registers from the stack, 54eebf1202Schristos * The previous signal state is restored if 'm' was non-zero. 55eebf1202Schristos */ 56eebf1202Schristos 57eebf1202Schristos/* grab _JBLEN */ 58eebf1202Schristos#include <m68k/setjmp.h> 59eebf1202Schristos 60eebf1202SchristosENTRY(sigsetjmp) 6188723221Smatt movl 8(%sp),%d1 /* grab the mask */ 6288723221Smatt movl 4(%sp),%a0 /* grab the area pointer */ 6388723221Smatt movl %d1,(_JBLEN * 4)(%a0) /* save at end of area */ 64eebf1202Schristos tstl %d1 65eebf1202Schristos bne dosig 66eebf1202Schristos jra PIC_PLT(_C_LABEL(_setjmp)) 67eebf1202Schristosdosig: 68eebf1202Schristos jra PIC_PLT(_C_LABEL(setjmp)) 6988723221SmattEND(sigsetjmp) 70eebf1202Schristos 71eebf1202Schristos 72eebf1202SchristosENTRY(siglongjmp) 7388723221Smatt movl 4(%sp),%a0 /* save area pointer */ 7488723221Smatt tstl (_JBLEN * 4)(%a0) /* check mask... */ 75eebf1202Schristos bne didsig 76eebf1202Schristos jra PIC_PLT(_C_LABEL(_longjmp)) 77eebf1202Schristosdidsig: 78eebf1202Schristos jra PIC_PLT(_C_LABEL(longjmp)) 7988723221SmattEND(siglongjmp) 80