xref: /openbsd-src/lib/libc/arch/arm/gen/sigsetjmp.S (revision a8d2d9e857f3e0e5e619a6a7a1a692b947560973)
1*a8d2d9e8Sguenther/*	$OpenBSD: sigsetjmp.S,v 1.6 2022/05/25 17:32:36 guenther Exp $	*/
2d987040fSdrahn/*	$NetBSD: sigsetjmp.S,v 1.3 2002/08/17 19:54:30 thorpej Exp $	*/
3d987040fSdrahn
4d987040fSdrahn/*
5d987040fSdrahn * Copyright (c) 1997 Mark Brinicombe
6d987040fSdrahn * All rights reserved.
7d987040fSdrahn *
8d987040fSdrahn * Redistribution and use in source and binary forms, with or without
9d987040fSdrahn * modification, are permitted provided that the following conditions
10d987040fSdrahn * are met:
11d987040fSdrahn * 1. Redistributions of source code must retain the above copyright
12d987040fSdrahn *    notice, this list of conditions and the following disclaimer.
13d987040fSdrahn * 2. Redistributions in binary form must reproduce the above copyright
14d987040fSdrahn *    notice, this list of conditions and the following disclaimer in the
15d987040fSdrahn *    documentation and/or other materials provided with the distribution.
16d987040fSdrahn * 3. All advertising materials mentioning features or use of this software
17d987040fSdrahn *    must display the following acknowledgement:
18d987040fSdrahn *	This product includes software developed by Mark Brinicombe
19d987040fSdrahn * 4. Neither the name of the University nor the names of its contributors
20d987040fSdrahn *    may be used to endorse or promote products derived from this software
21d987040fSdrahn *    without specific prior written permission.
22d987040fSdrahn *
23d987040fSdrahn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24d987040fSdrahn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25d987040fSdrahn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26d987040fSdrahn * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27d987040fSdrahn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28d987040fSdrahn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29d987040fSdrahn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30d987040fSdrahn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31d987040fSdrahn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32d987040fSdrahn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33d987040fSdrahn * SUCH DAMAGE.
34d987040fSdrahn */
35d987040fSdrahn
3638848718Sguenther#include "DEFS.h"
37d987040fSdrahn#include <machine/setjmp.h>
38d987040fSdrahn
39d987040fSdrahn/*
40d987040fSdrahn * C library -- sigsetjmp, siglongjmp
41d987040fSdrahn *
42d987040fSdrahn *	longjmp(a,v)
43d987040fSdrahn * will generate a "return(v)" from the last call to
44d987040fSdrahn *	setjmp(a, m)
45d987040fSdrahn * by restoring registers from the stack.
46d987040fSdrahn * The previous signal state is restored.
47d987040fSdrahn */
48d987040fSdrahn
4942d2c245SguentherENTRY_NB(sigsetjmp)
50d987040fSdrahn	teq	r1, #0
5138848718Sguenther	beq	_HIDDEN(_setjmp)
5238848718Sguenther	b	_HIDDEN(setjmp)
5342d2c245SguentherEND_WEAK(sigsetjmp)
54d987040fSdrahn
55d987040fSdrahn.L_setjmp_magic:
56d987040fSdrahn	.word	_JB_MAGIC__SETJMP
57d987040fSdrahn
5842d2c245SguentherENTRY_NB(siglongjmp)
59d987040fSdrahn	ldr	r2, .L_setjmp_magic
60d987040fSdrahn	ldr	r3, [r0]
61d987040fSdrahn	teq	r2, r3
6238848718Sguenther	beq	_HIDDEN(_longjmp)
6338848718Sguenther	b	_HIDDEN(longjmp)
6442d2c245SguentherEND_WEAK(siglongjmp)
65