xref: /netbsd-src/lib/libc/compat/arch/i386/gen/compat_sigsetjmp.S (revision 0d34bfa26d596b4f9bcb49175a92020d91572850)
1*0d34bfa2Suebayasi/*	$NetBSD: compat_sigsetjmp.S,v 1.3 2014/05/23 02:34:33 uebayasi Exp $	*/
25b84b398Schristos
35b84b398Schristos/*-
45b84b398Schristos * Copyright (c) 1990 The Regents of the University of California.
55b84b398Schristos * All rights reserved.
65b84b398Schristos *
75b84b398Schristos * This code is derived from software contributed to Berkeley by
85b84b398Schristos * William Jolitz.
95b84b398Schristos *
105b84b398Schristos * Redistribution and use in source and binary forms, with or without
115b84b398Schristos * modification, are permitted provided that the following conditions
125b84b398Schristos * are met:
135b84b398Schristos * 1. Redistributions of source code must retain the above copyright
145b84b398Schristos *    notice, this list of conditions and the following disclaimer.
155b84b398Schristos * 2. Redistributions in binary form must reproduce the above copyright
165b84b398Schristos *    notice, this list of conditions and the following disclaimer in the
175b84b398Schristos *    documentation and/or other materials provided with the distribution.
185b84b398Schristos * 3. Neither the name of the University nor the names of its contributors
195b84b398Schristos *    may be used to endorse or promote products derived from this software
205b84b398Schristos *    without specific prior written permission.
215b84b398Schristos *
225b84b398Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
235b84b398Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
245b84b398Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
255b84b398Schristos * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
265b84b398Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
275b84b398Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
285b84b398Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
295b84b398Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
305b84b398Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
315b84b398Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
325b84b398Schristos * SUCH DAMAGE.
335b84b398Schristos *
345b84b398Schristos *	from: @(#)setjmp.s	5.1 (Berkeley) 4/23/90"
355b84b398Schristos */
365b84b398Schristos
375b84b398Schristos#include <machine/asm.h>
385b84b398Schristos#if defined(LIBC_SCCS)
39*0d34bfa2Suebayasi	RCSID("$NetBSD: compat_sigsetjmp.S,v 1.3 2014/05/23 02:34:33 uebayasi Exp $")
405b84b398Schristos#endif
415b84b398Schristos
425b84b398SchristosENTRY(sigsetjmp)
435b84b398Schristos	movl	4(%esp),%ecx
445b84b398Schristos	movl	8(%esp),%eax
455b84b398Schristos	movl	%eax,28(%ecx)
465b84b398Schristos	testl	%eax,%eax
475b84b398Schristos	jz	2f
485b84b398Schristos
495b84b398Schristos	PIC_PROLOGUE
505b84b398Schristos	pushl	$0
514d12bfcdSjoerg#ifdef __PIC__
525b84b398Schristos	call	PIC_PLT(_C_LABEL(sigblock))
535b84b398Schristos#else
545b84b398Schristos	call	_C_LABEL(sigblock)
555b84b398Schristos#endif
565b84b398Schristos	addl	$4,%esp
575b84b398Schristos	PIC_EPILOGUE
585b84b398Schristos
595b84b398Schristos	movl	4(%esp),%ecx
605b84b398Schristos	movl	%eax,24(%ecx)
615b84b398Schristos2:	movl	0(%esp),%edx
625b84b398Schristos	movl	%edx, 0(%ecx)
635b84b398Schristos	movl	%ebx, 4(%ecx)
645b84b398Schristos	movl	%esp, 8(%ecx)
655b84b398Schristos	movl	%ebp,12(%ecx)
665b84b398Schristos	movl	%esi,16(%ecx)
675b84b398Schristos	movl	%edi,20(%ecx)
685b84b398Schristos	xorl	%eax,%eax
695b84b398Schristos	ret
70*0d34bfa2SuebayasiEND(sigsetjmp)
715b84b398Schristos
725b84b398SchristosENTRY(siglongjmp)
735b84b398Schristos	movl	4(%esp),%edx
745b84b398Schristos	cmpl	$0,28(%edx)
755b84b398Schristos	jz	2f
765b84b398Schristos
775b84b398Schristos	PIC_PROLOGUE
785b84b398Schristos	pushl	24(%edx)
794d12bfcdSjoerg#ifdef __PIC__
805b84b398Schristos	call	PIC_PLT(_C_LABEL(sigsetmask))
815b84b398Schristos#else
825b84b398Schristos	call	_C_LABEL(sigsetmask)
835b84b398Schristos#endif
845b84b398Schristos	addl	$4,%esp
855b84b398Schristos	PIC_EPILOGUE
865b84b398Schristos
875b84b398Schristos2:	movl	4(%esp),%edx
885b84b398Schristos	movl	8(%esp),%eax
895b84b398Schristos	movl	0(%edx),%ecx
905b84b398Schristos	movl	4(%edx),%ebx
915b84b398Schristos	movl	8(%edx),%esp
925b84b398Schristos	movl	12(%edx),%ebp
935b84b398Schristos	movl	16(%edx),%esi
945b84b398Schristos	movl	20(%edx),%edi
955b84b398Schristos	testl	%eax,%eax
965b84b398Schristos	jnz	3f
975b84b398Schristos	incl	%eax
985b84b398Schristos3:	movl	%ecx,0(%esp)
995b84b398Schristos	ret
100*0d34bfa2SuebayasiEND(siglongjmp)
101