11.3Sriastrad/*	$NetBSD: compat_sigsetjmp.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $	*/
21.1Schristos
31.1Schristos/*-
41.1Schristos * Copyright (c) 1990 The Regents of the University of California.
51.1Schristos * All rights reserved.
61.1Schristos *
71.1Schristos * This code is derived from software contributed to Berkeley by
81.1Schristos * the Systems Programming Group of the University of Utah Computer
91.1Schristos * Science Department.
101.1Schristos *
111.1Schristos * Redistribution and use in source and binary forms, with or without
121.1Schristos * modification, are permitted provided that the following conditions
131.1Schristos * are met:
141.1Schristos * 1. Redistributions of source code must retain the above copyright
151.1Schristos *    notice, this list of conditions and the following disclaimer.
161.1Schristos * 2. Redistributions in binary form must reproduce the above copyright
171.1Schristos *    notice, this list of conditions and the following disclaimer in the
181.1Schristos *    documentation and/or other materials provided with the distribution.
191.1Schristos * 3. Neither the name of the University nor the names of its contributors
201.1Schristos *    may be used to endorse or promote products derived from this software
211.1Schristos *    without specific prior written permission.
221.1Schristos *
231.1Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
241.1Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251.1Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
261.1Schristos * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
271.1Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
281.1Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
291.1Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.1Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.1Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.1Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.1Schristos * SUCH DAMAGE.
341.1Schristos */
351.1Schristos
361.1Schristos#include <machine/asm.h>
371.1Schristos
381.1Schristos#if defined(LIBC_SCCS) && !defined(lint)
391.1Schristos#if 0
401.1Schristos	RCSID("from: @(#)_setjmp.s	5.1 (Berkeley) 5/12/90")
411.1Schristos#else
421.3Sriastrad	RCSID("$NetBSD: compat_sigsetjmp.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $")
431.1Schristos#endif
441.1Schristos#endif /* LIBC_SCCS and not lint */
451.1Schristos
461.1Schristos/*
471.1Schristos * C library -- sigsetjmp, siglongjmp
481.1Schristos *
491.1Schristos *	siglongjmp(a,v)
501.1Schristos * will generate a "return(v)" from
511.1Schristos * the last call to
521.1Schristos *	sigsetjmp(a,m)
531.1Schristos * by restoring registers from the stack,
541.1Schristos * The previous signal state is restored if 'm' was non-zero.
551.1Schristos */
561.1Schristos
571.1Schristos/* grab _JBLEN */
581.1Schristos#include <m68k/setjmp.h>
591.1Schristos
601.1SchristosENTRY(sigsetjmp)
611.2Smatt	movl	8(%sp),%d1	/* grab the mask */
621.2Smatt	movl	4(%sp),%a0	/* grab the area pointer */
631.2Smatt	movl	%d1,(_JBLEN * 4)(%a0)	/* save at end of area */
641.1Schristos	tstl	%d1
651.1Schristos	bne	dosig
661.1Schristos	jra	PIC_PLT(_C_LABEL(_setjmp))
671.1Schristosdosig:
681.1Schristos	jra	PIC_PLT(_C_LABEL(setjmp))
691.2SmattEND(sigsetjmp)
701.1Schristos
711.1Schristos
721.1SchristosENTRY(siglongjmp)
731.2Smatt	movl	4(%sp),%a0	/* save area pointer */
741.2Smatt	tstl	(_JBLEN * 4)(%a0) /* check mask... */
751.1Schristos	bne	didsig
761.1Schristos	jra	PIC_PLT(_C_LABEL(_longjmp))
771.1Schristosdidsig:
781.1Schristos	jra	PIC_PLT(_C_LABEL(longjmp))
791.2SmattEND(siglongjmp)
80