xref: /dragonfly/sys/platform/pc64/x86_64/sigtramp.s (revision 3e925ec2)
1*b2b3ffcdSSimon Schubert/*-
2*b2b3ffcdSSimon Schubert * Copyright (c) 2003 Peter Wemm <peter@freeBSD.org>
3*b2b3ffcdSSimon Schubert * All rights reserved.
4*b2b3ffcdSSimon Schubert *
5*b2b3ffcdSSimon Schubert * Redistribution and use in source and binary forms, with or without
6*b2b3ffcdSSimon Schubert * modification, are permitted provided that the following conditions
7*b2b3ffcdSSimon Schubert * are met:
8*b2b3ffcdSSimon Schubert * 1. Redistributions of source code must retain the above copyright
9*b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer.
10*b2b3ffcdSSimon Schubert * 2. Redistributions in binary form must reproduce the above copyright
11*b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer in the
12*b2b3ffcdSSimon Schubert *    documentation and/or other materials provided with the distribution.
13*b2b3ffcdSSimon Schubert *
14*b2b3ffcdSSimon Schubert * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*b2b3ffcdSSimon Schubert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*b2b3ffcdSSimon Schubert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*b2b3ffcdSSimon Schubert * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*b2b3ffcdSSimon Schubert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*b2b3ffcdSSimon Schubert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*b2b3ffcdSSimon Schubert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*b2b3ffcdSSimon Schubert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*b2b3ffcdSSimon Schubert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*b2b3ffcdSSimon Schubert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*b2b3ffcdSSimon Schubert * SUCH DAMAGE.
25*b2b3ffcdSSimon Schubert *
26*b2b3ffcdSSimon Schubert * $FreeBSD: src/sys/amd64/amd64/sigtramp.S,v 1.1 2003/05/01 01:05:21 peter Exp $
27*b2b3ffcdSSimon Schubert */
28*b2b3ffcdSSimon Schubert
29*b2b3ffcdSSimon Schubert#include <sys/syscall.h>
30*b2b3ffcdSSimon Schubert
31*b2b3ffcdSSimon Schubert#include <machine/asmacros.h>
32*b2b3ffcdSSimon Schubert
33*b2b3ffcdSSimon Schubert#include "assym.s"
34*b2b3ffcdSSimon Schubert
35*b2b3ffcdSSimon Schubert	.text
36*b2b3ffcdSSimon Schubert/**********************************************************************
37*b2b3ffcdSSimon Schubert *
38*b2b3ffcdSSimon Schubert * Signal trampoline, copied to top of user stack
39*b2b3ffcdSSimon Schubert *
40*b2b3ffcdSSimon Schubert * arguments: %rdi, %rsi, %rdx, %rcx
41*b2b3ffcdSSimon Schubert */
42*b2b3ffcdSSimon SchubertNON_GPROF_ENTRY(sigcode)
43*b2b3ffcdSSimon Schubert	call	*SIGF_HANDLER(%rsp)	/* call signal handler */
44*b2b3ffcdSSimon Schubert	lea	SIGF_UC(%rsp),%rdi	/* get ucontext_t */
45*b2b3ffcdSSimon Schubert	pushq	$0			/* junk to fake return addr. */
46*b2b3ffcdSSimon Schubert	movq	$SYS_sigreturn,%rax
47*b2b3ffcdSSimon Schubert	syscall				/* enter kernel with args */
48*b2b3ffcdSSimon Schubert0:	hlt				/* trap priviliged instruction */
49*b2b3ffcdSSimon Schubert	jmp	0b
50*b2b3ffcdSSimon Schubert
51*b2b3ffcdSSimon Schubert	ALIGN_TEXT
52*b2b3ffcdSSimon Schubertesigcode:
53*b2b3ffcdSSimon Schubert
54*b2b3ffcdSSimon Schubert	.data
55*b2b3ffcdSSimon Schubert	.globl	szsigcode
56*b2b3ffcdSSimon Schubertszsigcode:
57*b2b3ffcdSSimon Schubert	.long	esigcode-sigcode
58