kill sigcontext passing to signal handlers, we don't have to worry

about compatibility
This commit is contained in:
drochner 2004-03-25 14:21:29 +00:00
parent 75109b28b4
commit 65626c5d91
3 changed files with 7 additions and 74 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.3 2003/10/06 22:57:23 fvdl Exp $
# $NetBSD: Makefile.inc,v 1.4 2004/03/25 14:21:29 drochner Exp $
KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S rindex.S \
memchr.S memcmp.S memcpy.S memmove.S memset.S \
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S
SRCS+= __sigaction14_sigtramp.c __sigtramp1.S __sigtramp2.S
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S

View File

@ -1,4 +1,4 @@
/* $NetBSD: __sigaction14_sigtramp.c,v 1.6 2004/03/23 16:19:41 drochner Exp $ */
/* $NetBSD: __sigaction14_sigtramp.c,v 1.7 2004/03/25 14:21:29 drochner Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -50,33 +50,20 @@
int
__libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
{
extern const int __sigtramp_sigcontext_1[];
extern const int __sigtramp_siginfo_2[];
int rv;
#if 0
/*
* If no sigaction, use the "default" trampoline since it won't
* be used.
*/
if (act == NULL)
return __sigaction_sigtramp(sig, act, oact, NULL, 0);
#endif
/*
* We select the non-SA_SIGINFO trampoline if SA_SIGINFO is not
* set in the sigaction.
*/
if ((act->sa_flags & SA_SIGINFO) == 0) {
int sav = errno;
rv = __sigaction_sigtramp(sig, act, oact,
__sigtramp_sigcontext_1, 1);
if (rv >= 0 || errno != EINVAL)
return rv;
errno = sav;
}
/*
* If SA_SIGINFO was specified or the compatibility trampolines
* can't be used, use the siginfo trampoline.
* Don't provide sigcontext compatibility,
* always use the siginfo trampoline.
*/
return __sigaction_sigtramp(sig, act, oact, __sigtramp_siginfo_2, 2);
}

View File

@ -1,54 +0,0 @@
/* $NetBSD: __sigtramp1.S,v 1.4 2003/03/15 12:34:33 fvdl Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The x86-64 signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, the stack looks like:
*
* sp-> sigcontext structure
*/
NENTRY(__sigtramp_sigcontext_1)
movq %rsp,%rdi
pushq %rdi /* fake return address */
movl $SYS___sigreturn14,%eax
int $0x80 /* to avoid clobbering registers */
movl $SYS_exit,%eax
syscall