Home | History | Annotate | Line # | Download | only in sys
      1  1.9     kamil /*	$NetBSD: __sigtramp2.S,v 1.9 2020/10/19 11:29:26 kamil Exp $	*/
      2  1.1      fvdl 
      3  1.1      fvdl /*
      4  1.1      fvdl  * Copyright (c) 2001 Wasabi Systems, Inc.
      5  1.1      fvdl  * All rights reserved.
      6  1.1      fvdl  *
      7  1.1      fvdl  * Written by Frank van der Linden for Wasabi Systems, Inc.
      8  1.1      fvdl  *
      9  1.1      fvdl  * Redistribution and use in source and binary forms, with or without
     10  1.1      fvdl  * modification, are permitted provided that the following conditions
     11  1.1      fvdl  * are met:
     12  1.1      fvdl  * 1. Redistributions of source code must retain the above copyright
     13  1.1      fvdl  *    notice, this list of conditions and the following disclaimer.
     14  1.1      fvdl  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1      fvdl  *    notice, this list of conditions and the following disclaimer in the
     16  1.1      fvdl  *    documentation and/or other materials provided with the distribution.
     17  1.1      fvdl  * 3. All advertising materials mentioning features or use of this software
     18  1.1      fvdl  *    must display the following acknowledgement:
     19  1.1      fvdl  *      This product includes software developed for the NetBSD Project by
     20  1.1      fvdl  *      Wasabi Systems, Inc.
     21  1.1      fvdl  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22  1.1      fvdl  *    or promote products derived from this software without specific prior
     23  1.1      fvdl  *    written permission.
     24  1.1      fvdl  *
     25  1.1      fvdl  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26  1.1      fvdl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.1      fvdl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.1      fvdl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29  1.1      fvdl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.1      fvdl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.1      fvdl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.1      fvdl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.1      fvdl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.1      fvdl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.1      fvdl  * POSSIBILITY OF SUCH DAMAGE.
     36  1.1      fvdl  */
     37  1.1      fvdl 
     38  1.1      fvdl #include "SYS.h"
     39  1.8     kamil #include "assym.h"
     40  1.1      fvdl 
     41  1.1      fvdl /*
     42  1.1      fvdl  * The x86-64 signal trampoline is invoked only to return from
     43  1.1      fvdl  * the signal; the kernel calls the signal handler directly.
     44  1.8     kamil  *
     45  1.8     kamil  * The unwind entry includes the one byte prior to the trampoline
     46  1.8     kamil  * because the unwinder will look up (return PC - 1) while unwinding.
     47  1.8     kamil  * Normally (return PC - 1) computes an address inside the call
     48  1.8     kamil  * instruction that created the child frame, but here there is no call
     49  1.8     kamil  * instruction so we have to manually add padding.
     50  1.1      fvdl  */
     51  1.8     kamil 	.cfi_startproc simple
     52  1.8     kamil 	.cfi_signal_frame
     53  1.8     kamil 	.cfi_def_cfa r15, 0
     54  1.8     kamil 	.cfi_offset rax, UC_GREGS_RAX
     55  1.8     kamil 	.cfi_offset rdx, UC_GREGS_RDX
     56  1.8     kamil 	.cfi_offset rcx, UC_GREGS_RCX
     57  1.8     kamil 	.cfi_offset rbx, UC_GREGS_RBX
     58  1.8     kamil 	.cfi_offset rsi, UC_GREGS_RSI
     59  1.8     kamil 	.cfi_offset rdi, UC_GREGS_RDI
     60  1.8     kamil 	.cfi_offset rbp, UC_GREGS_RBP
     61  1.9     kamil 	.cfi_offset rsp, UC_GREGS_RSP
     62  1.8     kamil 	.cfi_offset r8,  UC_GREGS_R8
     63  1.8     kamil 	.cfi_offset r9,  UC_GREGS_R9
     64  1.8     kamil 	.cfi_offset r10, UC_GREGS_R10
     65  1.8     kamil 	.cfi_offset r11, UC_GREGS_R11
     66  1.8     kamil 	.cfi_offset r12, UC_GREGS_R12
     67  1.8     kamil 	.cfi_offset r13, UC_GREGS_R13
     68  1.8     kamil 	.cfi_offset r14, UC_GREGS_R14
     69  1.8     kamil 	.cfi_offset r15, UC_GREGS_R15
     70  1.8     kamil 	.cfi_offset rip, UC_GREGS_RIP
     71  1.8     kamil 	nop
     72  1.1      fvdl NENTRY(__sigtramp_siginfo_2)
     73  1.2      fvdl 	movq	%r15,%rdi
     74  1.1      fvdl 	movq	$SYS_setcontext, %rax
     75  1.4  drochner 	syscall
     76  1.5  drochner 	movq	$-1,%rdi /* if we return here, something is wrong */
     77  1.1      fvdl 	movq	$SYS_exit, %rax
     78  1.1      fvdl 	syscall
     79  1.7  christos 	.cfi_endproc
     80  1.6  uebayasi END(__sigtramp_siginfo_2)
     81