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