1*74ea4300Smaxv/* $NetBSD: freebsd_sigcode.S,v 1.1 2017/08/01 14:43:54 maxv Exp $ */ 2*74ea4300Smaxv 3*74ea4300Smaxv/*- 4*74ea4300Smaxv * Copyright (c) 1998 The NetBSD Foundation, Inc. 5*74ea4300Smaxv * All rights reserved. 6*74ea4300Smaxv * 7*74ea4300Smaxv * This code is derived from software contributed to The NetBSD Foundation 8*74ea4300Smaxv * by Charles M. Hannum. 9*74ea4300Smaxv * 10*74ea4300Smaxv * Redistribution and use in source and binary forms, with or without 11*74ea4300Smaxv * modification, are permitted provided that the following conditions 12*74ea4300Smaxv * are met: 13*74ea4300Smaxv * 1. Redistributions of source code must retain the above copyright 14*74ea4300Smaxv * notice, this list of conditions and the following disclaimer. 15*74ea4300Smaxv * 2. Redistributions in binary form must reproduce the above copyright 16*74ea4300Smaxv * notice, this list of conditions and the following disclaimer in the 17*74ea4300Smaxv * documentation and/or other materials provided with the distribution. 18*74ea4300Smaxv * 19*74ea4300Smaxv * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*74ea4300Smaxv * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*74ea4300Smaxv * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*74ea4300Smaxv * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*74ea4300Smaxv * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*74ea4300Smaxv * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*74ea4300Smaxv * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*74ea4300Smaxv * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*74ea4300Smaxv * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*74ea4300Smaxv * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*74ea4300Smaxv * POSSIBILITY OF SUCH DAMAGE. 30*74ea4300Smaxv */ 31*74ea4300Smaxv 32*74ea4300Smaxv/*- 33*74ea4300Smaxv * Copyright (c) 1990 The Regents of the University of California. 34*74ea4300Smaxv * All rights reserved. 35*74ea4300Smaxv * 36*74ea4300Smaxv * This code is derived from software contributed to Berkeley by 37*74ea4300Smaxv * William Jolitz. 38*74ea4300Smaxv * 39*74ea4300Smaxv * Redistribution and use in source and binary forms, with or without 40*74ea4300Smaxv * modification, are permitted provided that the following conditions 41*74ea4300Smaxv * are met: 42*74ea4300Smaxv * 1. Redistributions of source code must retain the above copyright 43*74ea4300Smaxv * notice, this list of conditions and the following disclaimer. 44*74ea4300Smaxv * 2. Redistributions in binary form must reproduce the above copyright 45*74ea4300Smaxv * notice, this list of conditions and the following disclaimer in the 46*74ea4300Smaxv * documentation and/or other materials provided with the distribution. 47*74ea4300Smaxv * 3. Neither the name of the University nor the names of its contributors 48*74ea4300Smaxv * may be used to endorse or promote products derived from this software 49*74ea4300Smaxv * without specific prior written permission. 50*74ea4300Smaxv * 51*74ea4300Smaxv * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 52*74ea4300Smaxv * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53*74ea4300Smaxv * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 54*74ea4300Smaxv * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 55*74ea4300Smaxv * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 56*74ea4300Smaxv * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 57*74ea4300Smaxv * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58*74ea4300Smaxv * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 59*74ea4300Smaxv * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 60*74ea4300Smaxv * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 61*74ea4300Smaxv * SUCH DAMAGE. 62*74ea4300Smaxv * 63*74ea4300Smaxv * @(#)locore.s 7.3 (Berkeley) 5/13/91 64*74ea4300Smaxv */ 65*74ea4300Smaxv 66*74ea4300Smaxv#include <machine/asm.h> 67*74ea4300Smaxv__KERNEL_RCSID(0, "$NetBSD: freebsd_sigcode.S,v 1.1 2017/08/01 14:43:54 maxv Exp $"); 68*74ea4300Smaxv 69*74ea4300Smaxv#include "assym.h" 70*74ea4300Smaxv 71*74ea4300Smaxv#include <sys/errno.h> 72*74ea4300Smaxv#include <sys/syscall.h> 73*74ea4300Smaxv 74*74ea4300Smaxv#include <compat/freebsd/freebsd_syscall.h> 75*74ea4300Smaxv 76*74ea4300Smaxv/* 77*74ea4300Smaxv * Signal trampoline; copied to top of user stack. 78*74ea4300Smaxv */ 79*74ea4300Smaxv/* LINTSTUB: Var: char freebsd_sigcode[1], freebsd_esigcode[1]; */ 80*74ea4300SmaxvNENTRY(freebsd_sigcode) 81*74ea4300Smaxv call *FREEBSD_SIGF_HANDLER(%esp) 82*74ea4300Smaxv leal FREEBSD_SIGF_SC(%esp),%eax # scp (the call may have clobbered 83*74ea4300Smaxv # the copy at SIGF_SCP(%esp)) 84*74ea4300Smaxv pushl %eax 85*74ea4300Smaxv pushl %eax # junk to fake return address 86*74ea4300Smaxv movl $FREEBSD_SYS_sigreturn,%eax 87*74ea4300Smaxv int $0x80 # enter kernel with args on stack 88*74ea4300Smaxv movl $FREEBSD_SYS_exit,%eax 89*74ea4300Smaxv int $0x80 # exit if sigreturn fails 90*74ea4300Smaxv .globl _C_LABEL(freebsd_esigcode) 91*74ea4300Smaxv_C_LABEL(freebsd_esigcode): 92