xref: /openbsd-src/sys/arch/arm/arm/sigcode.S (revision d8417bd7da1c4c9f6786edfd187f5ed8fdaf04fb)
1*d8417bd7Sderaadt/*	$OpenBSD: sigcode.S,v 1.14 2023/12/12 07:37:20 deraadt Exp $	*/
2e1e4f5b1Sdrahn/*	$NetBSD: sigcode.S,v 1.6 2003/10/05 19:44:58 matt Exp $	*/
3e1e4f5b1Sdrahn
4e1e4f5b1Sdrahn/*
5e1e4f5b1Sdrahn * Copyright (C) 1994-1997 Mark Brinicombe
6e1e4f5b1Sdrahn * Copyright (C) 1994 Brini
7e1e4f5b1Sdrahn * All rights reserved.
8e1e4f5b1Sdrahn *
9e1e4f5b1Sdrahn * Redistribution and use in source and binary forms, with or without
10e1e4f5b1Sdrahn * modification, are permitted provided that the following conditions
11e1e4f5b1Sdrahn * are met:
12e1e4f5b1Sdrahn * 1. Redistributions of source code must retain the above copyright
13e1e4f5b1Sdrahn *    notice, this list of conditions and the following disclaimer.
14e1e4f5b1Sdrahn * 2. Redistributions in binary form must reproduce the above copyright
15e1e4f5b1Sdrahn *    notice, this list of conditions and the following disclaimer in the
16e1e4f5b1Sdrahn *    documentation and/or other materials provided with the distribution.
17e1e4f5b1Sdrahn * 3. All advertising materials mentioning features or use of this software
18e1e4f5b1Sdrahn *    must display the following acknowledgement:
19e1e4f5b1Sdrahn *	This product includes software developed by Brini.
20e1e4f5b1Sdrahn * 4. The name of Brini may not be used to endorse or promote products
21e1e4f5b1Sdrahn *    derived from this software without specific prior written permission.
22e1e4f5b1Sdrahn *
23e1e4f5b1Sdrahn * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR
24e1e4f5b1Sdrahn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25e1e4f5b1Sdrahn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26e1e4f5b1Sdrahn * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27e1e4f5b1Sdrahn * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28e1e4f5b1Sdrahn * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29e1e4f5b1Sdrahn * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30e1e4f5b1Sdrahn * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31e1e4f5b1Sdrahn * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32e1e4f5b1Sdrahn * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33e1e4f5b1Sdrahn */
34e1e4f5b1Sdrahn
35e1e4f5b1Sdrahn#include "assym.h"
36abff443dSkettenis
37e1e4f5b1Sdrahn#include <sys/syscall.h>
38e1e4f5b1Sdrahn
39abff443dSkettenis#include <machine/asm.h>
40abff443dSkettenis
41e1e4f5b1Sdrahn/*
42e1e4f5b1Sdrahn * Signal trampoline;
43e1e4f5b1Sdrahn */
44e1e4f5b1Sdrahn
45b983598cSderaadt	.section .rodata
46e1753c98Skettenis	.align	2
47b983598cSderaadt	.globl	sigcode
48b983598cSderaadt	.type	x,_ASM_TYPE_FUNCTION
49b983598cSderaadtsigcode:
50e1e4f5b1Sdrahn/*
51e1e4f5b1Sdrahn * The kernel arranges for the handler to be invoked directly.  This
52e1e4f5b1Sdrahn * trampoline is used only to return from the signal.
53e1e4f5b1Sdrahn *
54e1e4f5b1Sdrahn * The stack pointer points to the saved sigcontext.
55e1e4f5b1Sdrahn */
56e1e4f5b1Sdrahn/*	mov	r0, sp */
57e1e4f5b1Sdrahn	add	r0, sp, #SIGF_SC
58e1753c98Skettenis	mov	r12, #SYS_sigreturn
5920cef513Sderaadt	.globl	sigcodecall
6020cef513Sderaadtsigcodecall:
615ab4942aSkettenis	swi	0
625ab4942aSkettenis	dsb	nsh
635ab4942aSkettenis	isb
6481621933Sguenther	.globl  sigcoderet
6581621933Sguenthersigcoderet:
6681621933Sguenther	.global esigcode
6781621933Sguentheresigcode:
68*d8417bd7Sderaadt	/* FALLTHROUGH */
69b983598cSderaadt	.globl	sigfill
70b983598cSderaadtsigfill:
715bbf8832Snaddy	udf	#0
72b983598cSderaadtesigfill:
73b983598cSderaadt
74b983598cSderaadt	.data
75d7b02563Spatrick	.align	2
76b983598cSderaadt	.globl	sigfillsiz
77b983598cSderaadtsigfillsiz:
78b983598cSderaadt	.word	esigfill - sigfill
79b983598cSderaadt
80b983598cSderaadt	.text
81