if setcontext(2) returns, _exit(2) with a return code of -1 instead

of relying on a sensible return value
This commit is contained in:
drochner 2006-11-08 21:16:40 +00:00
parent 2313f534c1
commit 58bd20f660
3 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: __sigtramp2.S,v 1.1 2003/10/07 17:08:07 skd Exp $ */
/* $NetBSD: __sigtramp2.S,v 1.2 2006/11/08 21:16:40 drochner Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -39,8 +39,9 @@
* sp-> siginfo structure [0]
*/
NESTED_NOPROFILE(__sigtramp_siginfo_2,0,0,ra,0,0)
ldgp gp,0(ra)
lda a0,(128)(sp) /* get pointer to ucontext */
CALLSYS_NOERROR(setcontext) /* and call setcontext() with it */
mov v0, a0 /* if that failed, get error code */
CALLSYS_NOERROR(exit) /* and call exit() with it */
ldiq a0,-1 /* if that failed, set an exit code */
CALLSYS_NOERROR(exit) /* and call exit() */
END(__sigtramp_siginfo_2)

View File

@ -1,4 +1,4 @@
/* $NetBSD: __sigtramp2.S,v 1.2 2006/08/02 04:18:48 jld Exp $ */
/* $NetBSD: __sigtramp2.S,v 1.3 2006/11/08 21:16:40 drochner Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -51,9 +51,9 @@
* sp-> signal number [0]
*/
NENTRY(__sigtramp_siginfo_2)
leal 12+128(%esp),%eax /* get pointer to ucontext */
leal 12+128(%esp),%eax /* get address of ucontext */
movl %eax,4(%esp) /* put it in the argument slot */
/* fake return address already there */
SYSTRAP(setcontext) /* do setcontext */
movl %eax,4(%esp) /* error code */
movl $-1,4(%esp) /* if we return here, something is wrong */
SYSTRAP(exit) /* exit */

View File

@ -1,4 +1,4 @@
/* $NetBSD: __sigtramp2.S,v 1.4 2004/03/23 16:33:47 drochner Exp $ */
/* $NetBSD: __sigtramp2.S,v 1.5 2006/11/08 21:16:40 drochner Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -43,8 +43,8 @@
*/
NENTRY(__sigtramp_siginfo_2)
movq %r15,%rdi
pushq $0 /* fake return address */
movq $SYS_setcontext, %rax
syscall
movq $-1,%rdi /* if we return here, something is wrong */
movq $SYS_exit, %rax
syscall