Now support per-signal signal trampolines.

This commit is contained in:
manu 2002-06-02 19:06:02 +00:00
parent 3d886831b0
commit a808ca7f07
3 changed files with 26 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $ */
/* $NetBSD: irix_exec.c,v 1.16 2002/06/02 19:06:02 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.16 2002/06/02 19:06:02 manu Exp $");
#ifndef ELFSIZE
#define ELFSIZE 32 /* XXX should die */
@ -331,7 +331,7 @@ irix_e_proc_fork(p, parent)
p->p_emuldata = NULL;
/* Use parent's vmspace beacause our vmspace may not be setup yet */
/* Use parent's vmspace because our vmspace may not be setup yet */
irix_e_proc_init(p, parent->p_vmspace);
ied1 = p->p_emuldata;

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_exec.h,v 1.8 2002/05/28 21:15:41 manu Exp $ */
/* $NetBSD: irix_exec.h,v 1.9 2002/06/02 19:06:02 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -41,10 +41,14 @@
#include <sys/types.h>
#include <sys/exec.h>
#include <sys/signal.h>
#include <sys/exec_elf.h>
#include <machine/vmparam.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
/* Address and size of shared arena used by usinit(3) on IRIX */
#define IRIX_SH_ARENA_ADDR 0x200000
#define IRIX_SH_ARENA_SZ PAGE_SIZE
@ -52,7 +56,7 @@
/* IRIX specific per-process data */
struct irix_emuldata {
#define ied_startcopy ied_sigtramp
void *ied_sigtramp; /* Address of signal trampoline */
void *ied_sigtramp[SVR4_NSIG]; /* Address of signal trampoline */
#define ied_endcopy ied_pptr
struct proc *ied_pptr; /* parent process or NULL */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_signal.c,v 1.14 2002/04/14 21:50:50 manu Exp $ */
/* $NetBSD: irix_signal.c,v 1.15 2002/06/02 19:06:02 manu Exp $ */
/*-
* Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.14 2002/04/14 21:50:50 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.15 2002/06/02 19:06:02 manu Exp $");
#include <sys/types.h>
#include <sys/signal.h>
@ -279,7 +279,7 @@ irix_sendsig(catcher, sig, mask, code)
* the signal trampoline address.
*/
f->f_regs[PC] = (unsigned long)
(((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp);
(((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp[sig]);
/*
* Remember that we're now on the signal stack.
@ -933,8 +933,10 @@ irix_sys_sigaction(p, v, retval)
syscallarg(struct svr4_sigaction *) osa;
syscallarg(void *) sigtramp;
} */ *uap = v;
int signum;
struct svr4_sys_sigaction_args cup;
void *sigtramp;
struct irix_emuldata *ied;
/*
* On IRIX, the sigaction() system call has a fourth argument, which
@ -965,20 +967,23 @@ irix_sys_sigaction(p, v, retval)
* SA_SIGINFO was set, then the higher bit of sf.isf_signo is
* still set.
*
* We cannot handle per-sigaction signal trampoline. The signal
* trampoline is hence saved as per-process, in the p_emuldata
* field of struct proc.
* The signal trampoline is hence saved in the p_emuldata field
* of struct proc, in an array (one element for each signal)
*/
sigtramp = ((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp;
signum = svr4_to_native_signo[SCARG(uap, signum)];
ied = (struct irix_emuldata *)(p->p_emuldata);
#ifdef DEBUG_IRIX
sigtramp = ied->ied_sigtramp[signum];
if (sigtramp != NULL && sigtramp != SCARG(uap, sigtramp))
printf("Warning: unsupported per-sigaction sigtramp\n");
printf("Warning: sigtramp changed from %p to %p for sig. %d\n",
sigtramp, SCARG(uap, sigtramp), signum);
#endif
if (sigtramp == NULL)
((struct irix_emuldata *)
(p->p_emuldata))->ied_sigtramp = SCARG(uap, sigtramp);
ied->ied_sigtramp[signum] = SCARG(uap, sigtramp);
SCARG(&cup, signum) = SCARG(uap, signum);
SCARG(&cup, signum) = signum;
SCARG(&cup, nsa) = SCARG(uap, nsa);
SCARG(&cup, osa) = SCARG(uap, osa);