summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/machdep.c5
-rw-r--r--sys/arch/alpha/alpha/netbsd_machdep.c5
-rw-r--r--sys/arch/hp300/hp300/hpux_machdep.c5
-rw-r--r--sys/arch/hppa/hppa/machdep.c5
-rw-r--r--sys/arch/i386/i386/freebsd_machdep.c6
-rw-r--r--sys/arch/i386/i386/linux_machdep.c6
-rw-r--r--sys/arch/i386/i386/machdep.c5
-rw-r--r--sys/arch/i386/i386/svr4_machdep.c6
-rw-r--r--sys/arch/m68k/m68k/sig_machdep.c5
-rw-r--r--sys/arch/macppc/macppc/machdep.c5
-rw-r--r--sys/arch/mvme68k/mvme68k/hpux_machdep.c5
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c7
-rw-r--r--sys/arch/mvmeppc/mvmeppc/machdep.c5
-rw-r--r--sys/arch/sparc/sparc/machdep.c6
-rw-r--r--sys/arch/sparc/sparc/svr4_machdep.c6
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c6
-rw-r--r--sys/arch/sparc64/sparc64/netbsd_machdep.c6
-rw-r--r--sys/arch/sparc64/stand/ofwboot/version2
-rw-r--r--sys/arch/vax/vax/machdep.c5
-rw-r--r--sys/compat/common/compat_util.c9
-rw-r--r--sys/compat/ultrix/ultrix_fs.c8
-rw-r--r--sys/kern/kern_exec.c81
-rw-r--r--sys/sys/exec.h6
-rw-r--r--sys/sys/proc.h5
24 files changed, 111 insertions, 99 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 1d7b9761bf3..fadfb4d3ce6 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.74 2002/06/08 05:19:12 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.75 2002/07/20 19:24:55 art Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1638,8 +1638,7 @@ sendsig(catcher, sig, mask, code, type, val)
/*
* Set up the registers to return to sigcode.
*/
- frame->tf_regs[FRAME_PC] =
- (u_int64_t)PS_STRINGS - (esigcode - sigcode);
+ frame->tf_regs[FRAME_PC] = p->p_sigcode;
frame->tf_regs[FRAME_A0] = sig;
frame->tf_regs[FRAME_A1] = (psp->ps_siginfo & sigmask(sig)) ?
(u_int64_t)sip : NULL;
diff --git a/sys/arch/alpha/alpha/netbsd_machdep.c b/sys/arch/alpha/alpha/netbsd_machdep.c
index 13fee57ba65..f6ba2928d50 100644
--- a/sys/arch/alpha/alpha/netbsd_machdep.c
+++ b/sys/arch/alpha/alpha/netbsd_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netbsd_machdep.c,v 1.7 2002/03/14 01:26:26 millert Exp $ */
+/* $OpenBSD: netbsd_machdep.c,v 1.8 2002/07/20 19:24:55 art Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -201,8 +201,7 @@ netbsd_sendsig(catcher, sig, mask, code, type, val)
/*
* Set up the registers to return to netbsd_sigcode.
*/
- frame->tf_regs[FRAME_PC] =
- (u_int64_t)PS_STRINGS - (netbsd_esigcode - netbsd_sigcode);
+ frame->tf_regs[FRAME_PC] = p->p_sigcode;
frame->tf_regs[FRAME_A0] = sig;
frame->tf_regs[FRAME_A1] = code;
frame->tf_regs[FRAME_A2] = (u_int64_t)scp;
diff --git a/sys/arch/hp300/hp300/hpux_machdep.c b/sys/arch/hp300/hp300/hpux_machdep.c
index 1f8794c721d..5e149e4f318 100644
--- a/sys/arch/hp300/hp300/hpux_machdep.c
+++ b/sys/arch/hp300/hp300/hpux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_machdep.c,v 1.12 2002/06/04 00:09:08 deraadt Exp $ */
+/* $OpenBSD: hpux_machdep.c,v 1.13 2002/07/20 19:24:55 art Exp $ */
/* $NetBSD: hpux_machdep.c,v 1.19 1998/02/16 20:58:30 thorpej Exp $ */
/*
@@ -391,7 +391,6 @@ hpux_sendsig(catcher, sig, mask, code, type, val)
struct sigacts *psp = p->p_sigacts;
short ft;
int oonstack, fsize;
- extern char sigcode[], esigcode[];
frame = (struct frame *)p->p_md.md_regs;
ft = frame->f_format;
@@ -531,7 +530,7 @@ hpux_sendsig(catcher, sig, mask, code, type, val)
/*
* Signal trampoline code is at base of user stack.
*/
- frame->f_pc = (int)PS_STRINGS - (esigcode - sigcode);
+ frame->f_pc = p->p_sigcode;
#ifdef DEBUG
if ((hpuxsigdebug & SDB_KSTACK) && p->p_pid == hpuxsigpid)
printf("hpux_sendsig(%d): sig %d returns\n",
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 03ebd577c3a..d33a565c17e 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.72 2002/05/14 00:25:02 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.73 2002/07/20 19:24:55 art Exp $ */
/*
* Copyright (c) 1999-2002 Michael Shalayeff
@@ -1256,8 +1256,7 @@ sendsig(catcher, sig, mask, code, type, val)
tf->tf_arg2 = tf->tf_r3 = (register_t)scp;
tf->tf_arg3 = (register_t)catcher;
tf->tf_sp = (register_t)scp + sss;
- tf->tf_iioq_head = HPPA_PC_PRIV_USER |
- ((register_t)PS_STRINGS + sizeof(struct ps_strings));
+ tf->tf_iioq_head = HPPA_PC_PRIV_USER | p->p_sigcode;
tf->tf_iioq_tail = tf->tf_iioq_head + 4;
/* disable tracing in the trapframe */
diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c
index ebc5c51fba1..387ec943199 100644
--- a/sys/arch/i386/i386/freebsd_machdep.c
+++ b/sys/arch/i386/i386/freebsd_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: freebsd_machdep.c,v 1.12 2001/11/06 19:53:14 miod Exp $ */
+/* $OpenBSD: freebsd_machdep.c,v 1.13 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: freebsd_machdep.c,v 1.10 1996/05/03 19:42:05 christos Exp $ */
/*-
@@ -89,7 +89,6 @@ freebsd_sendsig(catcher, sig, mask, code, type, val)
struct freebsd_sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oonstack;
- extern char freebsd_sigcode[], freebsd_esigcode[];
/*
* Build the argument list for the signal handler.
@@ -160,8 +159,7 @@ freebsd_sendsig(catcher, sig, mask, code, type, val)
*/
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = (int)(((char *)PS_STRINGS) -
- (freebsd_esigcode - freebsd_sigcode));
+ tf->tf_eip = p->p_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c
index a2064fbb418..fc3989a98fd 100644
--- a/sys/arch/i386/i386/linux_machdep.c
+++ b/sys/arch/i386/i386/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_machdep.c,v 1.22 2002/04/19 21:28:58 jasoni Exp $ */
+/* $OpenBSD: linux_machdep.c,v 1.23 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */
/*
@@ -116,7 +116,6 @@ linux_sendsig(catcher, sig, mask, code, type, val)
struct linux_sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oonstack;
- extern char linux_sigcode[], linux_esigcode[];
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
@@ -184,8 +183,7 @@ linux_sendsig(catcher, sig, mask, code, type, val)
*/
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = (int)(((char *)PS_STRINGS) -
- (linux_esigcode - linux_sigcode));
+ tf->tf_eip = p->p_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 4fba879ade1..936990935f6 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.211 2002/07/19 17:30:50 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.212 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1467,7 +1467,6 @@ sendsig(catcher, sig, mask, code, type, val)
struct sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oonstack;
- extern char sigcode[], esigcode[];
/*
* Build the argument list for the signal handler.
@@ -1554,7 +1553,7 @@ sendsig(catcher, sig, mask, code, type, val)
__asm("movw %w0,%%fs" : : "r" (GSEL(GUDATA_SEL, SEL_UPL)));
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
+ tf->tf_eip = p->p_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c
index 7ed6edcc7a7..a0569208045 100644
--- a/sys/arch/i386/i386/svr4_machdep.c
+++ b/sys/arch/i386/i386/svr4_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_machdep.c,v 1.15 2002/03/14 01:26:33 millert Exp $ */
+/* $OpenBSD: svr4_machdep.c,v 1.16 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.24 1996/05/03 19:42:26 christos Exp $ */
/*
@@ -325,7 +325,6 @@ svr4_sendsig(catcher, sig, mask, code, type, val)
struct svr4_sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oonstack;
- extern char svr4_esigcode[], svr4_sigcode[];
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
@@ -378,8 +377,7 @@ svr4_sendsig(catcher, sig, mask, code, type, val)
*/
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = (int)(((char *)PS_STRINGS) -
- (svr4_esigcode - svr4_sigcode));
+ tf->tf_eip = p->p_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
diff --git a/sys/arch/m68k/m68k/sig_machdep.c b/sys/arch/m68k/m68k/sig_machdep.c
index e0555f3a5ef..9570ba4a9b1 100644
--- a/sys/arch/m68k/m68k/sig_machdep.c
+++ b/sys/arch/m68k/m68k/sig_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sig_machdep.c,v 1.9 2002/06/04 00:09:08 deraadt Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.10 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: sig_machdep.c,v 1.3 1997/04/30 23:28:03 gwr Exp $ */
/*
@@ -145,7 +145,6 @@ sendsig(catcher, sig, mask, code, type, val)
register struct sigacts *psp = p->p_sigacts;
register short ft;
int oonstack, fsize;
- extern char sigcode[], esigcode[];
frame = (struct frame *)p->p_md.md_regs;
ft = frame->f_format;
@@ -276,7 +275,7 @@ sendsig(catcher, sig, mask, code, type, val)
/*
* Signal trampoline code is at base of user stack.
*/
- frame->f_pc = (int)PS_STRINGS - (esigcode - sigcode);
+ frame->f_pc = p->p_sigcode;
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
printf("sendsig(%d): sig %d returns\n",
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 497d655b801..f50cb9699ae 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.35 2002/06/07 21:54:25 drahn Exp $ */
+/* $OpenBSD: machdep.c,v 1.36 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -774,8 +774,7 @@ sendsig(catcher, sig, mask, code, type, val)
tf->fixreg[3] = (int)sig;
tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
tf->fixreg[5] = (int)&fp->sf_sc;
- tf->srr0 = (int)(((char *)PS_STRINGS)
- - (p->p_emul->e_esigcode - p->p_emul->e_sigcode));
+ tf->srr0 = p->p_sigcode;
#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER
pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),tf->srr0, &pa);
diff --git a/sys/arch/mvme68k/mvme68k/hpux_machdep.c b/sys/arch/mvme68k/mvme68k/hpux_machdep.c
index 2d775d753d4..571cdfa014b 100644
--- a/sys/arch/mvme68k/mvme68k/hpux_machdep.c
+++ b/sys/arch/mvme68k/mvme68k/hpux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_machdep.c,v 1.7 2002/06/04 00:09:08 deraadt Exp $ */
+/* $OpenBSD: hpux_machdep.c,v 1.8 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: hpux_machdep.c,v 1.9 1997/03/16 10:00:45 thorpej Exp $ */
/*
@@ -432,7 +432,6 @@ hpux_sendsig(catcher, sig, mask, code, type, val)
register struct sigacts *psp = p->p_sigacts;
register short ft;
int oonstack, fsize;
- extern char sigcode[], esigcode[];
frame = (struct frame *)p->p_md.md_regs;
ft = frame->f_format;
@@ -571,7 +570,7 @@ hpux_sendsig(catcher, sig, mask, code, type, val)
/*
* Signal trampoline code is at base of user stack.
*/
- frame->f_pc = (int)PS_STRINGS - (esigcode - sigcode);
+ frame->f_pc = p->p_sigcode;
#ifdef DEBUG
if ((hpuxsigdebug & SDB_KSTACK) && p->p_pid == hpuxsigpid)
printf("hpux_sendsig(%d): sig %d returns\n",
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index f0de9357b07..b5e9e1ed9c7 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.94 2002/06/04 00:09:08 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.95 2002/07/20 19:24:56 art Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -876,9 +876,6 @@ sendsig(catcher, sig, mask, code, type, val)
int oonstack, fsize;
struct sigframe sf;
int addr;
- extern char sigcode[], esigcode[];
-
-#define szsigcode (esigcode - sigcode)
tf = p->p_md.md_tf;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
@@ -993,7 +990,7 @@ sendsig(catcher, sig, mask, code, type, val)
* Build the argument list for the signal handler.
* Signal trampoline code is at base of user stack.
*/
- addr = (int)PS_STRINGS - szsigcode;
+ addr = p->p_sigcode;
if (cputyp != CPU_88110) {
/* mc88100 */
tf->snip = (addr & ~3) | NIP_V;
diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c
index 855d28aa085..b9ea45475b0 100644
--- a/sys/arch/mvmeppc/mvmeppc/machdep.c
+++ b/sys/arch/mvmeppc/mvmeppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.26 2002/06/08 15:48:58 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.27 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -768,8 +768,7 @@ sendsig(catcher, sig, mask, code, type, val)
tf->fixreg[3] = (int)sig;
tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
tf->fixreg[5] = (int)&fp->sf_sc;
- tf->srr0 = (int)(((char *)PS_STRINGS)
- - (p->p_emul->e_esigcode - p->p_emul->e_sigcode));
+ tf->srr0 = p->p_sigcode;
#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER
pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),tf->srr0, &pa);
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 41ed403374d..7de944e8aa1 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.83 2002/06/14 04:16:06 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.84 2002/07/20 19:24:56 art Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -525,8 +525,6 @@ sendsig(catcher, sig, mask, code, type, val)
struct trapframe *tf;
int caddr, oonstack, oldsp, newsp;
struct sigframe sf;
- extern char sigcode[], esigcode[];
-#define szsigcode (esigcode - sigcode)
#ifdef COMPAT_SUNOS
extern struct emul emul_sunos;
#endif
@@ -624,7 +622,7 @@ sendsig(catcher, sig, mask, code, type, val)
} else
#endif
{
- caddr = (int)PS_STRINGS - szsigcode;
+ caddr = p->p_sigcode;
tf->tf_global[1] = (int)catcher;
}
tf->tf_pc = caddr;
diff --git a/sys/arch/sparc/sparc/svr4_machdep.c b/sys/arch/sparc/sparc/svr4_machdep.c
index cfd23afdf5d..cd448800d36 100644
--- a/sys/arch/sparc/sparc/svr4_machdep.c
+++ b/sys/arch/sparc/sparc/svr4_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_machdep.c,v 1.10 2002/03/14 01:26:44 millert Exp $ */
+/* $OpenBSD: svr4_machdep.c,v 1.11 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.24 1997/07/29 10:04:45 fair Exp $ */
/*
@@ -452,8 +452,6 @@ svr4_sendsig(catcher, sig, mask, code, type, val)
struct svr4_sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oonstack, oldsp, newsp, caddr;
- extern char svr4_sigcode[], svr4_esigcode[];
-
tf = (struct trapframe *)p->p_md.md_tf;
oldsp = tf->tf_out[6];
@@ -514,7 +512,7 @@ svr4_sendsig(catcher, sig, mask, code, type, val)
/*
* Build context to run handler in.
*/
- caddr = (int)PS_STRINGS - (svr4_esigcode - svr4_sigcode);
+ caddr = p->p_sigcode;
tf->tf_global[1] = (int)catcher;
tf->tf_pc = caddr;
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 4fe6af36656..ddf79f9c508 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.46 2002/07/10 20:30:15 jsyn Exp $ */
+/* $OpenBSD: machdep.c,v 1.47 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -625,8 +625,6 @@ sendsig(catcher, sig, mask, code, type, val)
struct rwindow *oldsp, *newsp;
struct sigframe sf;
int onstack;
- extern char sigcode[], esigcode[];
-#define szsigcode (esigcode - sigcode)
tf = p->p_md.md_tf;
oldsp = (struct rwindow *)(u_long)(tf->tf_out[6] + STACK_OFFSET);
@@ -710,7 +708,7 @@ sendsig(catcher, sig, mask, code, type, val)
* Arrange to continue execution at the code copied out in exec().
* It needs the function to call in %g1, and a new stack pointer.
*/
- addr = (vaddr_t)PS_STRINGS - szsigcode;
+ addr = p->p_sigcode;
tf->tf_global[1] = (vaddr_t)catcher;
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
diff --git a/sys/arch/sparc64/sparc64/netbsd_machdep.c b/sys/arch/sparc64/sparc64/netbsd_machdep.c
index c5c527cb5f5..7bbf4f02e51 100644
--- a/sys/arch/sparc64/sparc64/netbsd_machdep.c
+++ b/sys/arch/sparc64/sparc64/netbsd_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netbsd_machdep.c,v 1.3 2002/06/15 17:23:31 art Exp $ */
+/* $OpenBSD: netbsd_machdep.c,v 1.4 2002/07/20 19:24:57 art Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -146,8 +146,6 @@ netbsd_sendsig(catcher, sig, mask, code, type, val)
struct rwindow *oldsp, *newsp;
struct netbsd_sigframe sf, *fp;
int onstack;
- extern char netbsd_sigcode[], netbsd_esigcode[];
-#define szsigcode (netbsd_esigcode - netbsd_sigcode)
tf = p->p_md.md_tf;
oldsp = (struct rwindow *)(u_long)(tf->tf_out[6] + STACK_OFFSET);
@@ -215,7 +213,7 @@ netbsd_sendsig(catcher, sig, mask, code, type, val)
* Arrange to continue execution at the code copied out in exec().
* It needs the function to call in %g1, and a new stack pointer.
*/
- addr = (vaddr_t)PS_STRINGS - szsigcode;
+ addr = p->p_sigcode;
tf->tf_global[1] = (vaddr_t)catcher;
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
diff --git a/sys/arch/sparc64/stand/ofwboot/version b/sys/arch/sparc64/stand/ofwboot/version
index 0cfbf08886f..b8626c4cff2 100644
--- a/sys/arch/sparc64/stand/ofwboot/version
+++ b/sys/arch/sparc64/stand/ofwboot/version
@@ -1 +1 @@
-2
+4
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index f6404516fa3..2a6d400a6cf 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.59 2002/05/16 07:37:44 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.60 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -439,7 +439,6 @@ sendsig(catcher, sig, mask, code, type, val)
struct trapframe *syscf;
struct sigcontext *sigctx, gsigctx;
struct trampframe *trampf, gtrampf;
- extern char sigcode[], esigcode[];
unsigned cursp;
int onstack;
@@ -490,7 +489,7 @@ printf("sendsig: signal %x catcher %x\n", sig, catcher);
copyout(&gsigctx, sigctx, sizeof(gsigctx)))
sigexit(p, SIGILL);
- syscf->pc = (unsigned) (((char *) PS_STRINGS) - (esigcode - sigcode));
+ syscf->pc = p->p_sigcode;
syscf->psl = PSL_U | PSL_PREVU;
syscf->ap = (unsigned) sigctx-8;
syscf->sp = cursp;
diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c
index 0e320e35819..c11ecca3dd0 100644
--- a/sys/compat/common/compat_util.c
+++ b/sys/compat/common/compat_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat_util.c,v 1.8 2000/10/16 20:10:50 jasoni Exp $ */
+/* $OpenBSD: compat_util.c,v 1.9 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */
/*
@@ -205,9 +205,7 @@ caddr_t
stackgap_init(e)
struct emul *e;
{
-#define szsigcode ((caddr_t)(e->e_esigcode - e->e_sigcode))
return STACKGAPBASE;
-#undef szsigcode
}
void *
@@ -217,13 +215,10 @@ stackgap_alloc(sgp, sz)
{
void *n = (void *) *sgp;
caddr_t nsgp;
- struct proc *p = curproc; /* XXX */
- struct emul *e = p->p_emul;
- int sigsize = e->e_esigcode - e->e_sigcode;
sz = ALIGN(sz);
nsgp = *sgp + sz;
- if (nsgp > ((caddr_t)PS_STRINGS - sigsize))
+ if (nsgp > ((caddr_t)PS_STRINGS))
return NULL;
*sgp = nsgp;
return n;
diff --git a/sys/compat/ultrix/ultrix_fs.c b/sys/compat/ultrix/ultrix_fs.c
index fa09441a86d..bd5bcf841ff 100644
--- a/sys/compat/ultrix/ultrix_fs.c
+++ b/sys/compat/ultrix/ultrix_fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ultrix_fs.c,v 1.10 2002/07/12 14:02:23 art Exp $ */
+/* $OpenBSD: ultrix_fs.c,v 1.11 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: ultrix_fs.c,v 1.4 1996/04/07 17:23:06 jonathan Exp $ */
/*
@@ -331,13 +331,11 @@ ultrix_sys_mount(p, v, retval)
int error;
int otype = SCARG(uap, type);
- extern char sigcode[], esigcode[];
char fsname[MFSNAMELEN];
char * fstype;
struct sys_mount_args nuap;
-
-#define szsigcode (esigcode - sigcode)
- caddr_t usp = (caddr_t)ALIGN(PS_STRINGS - szsigcode - STACKGAPLEN);
+ caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t usp = stackgap_alloc(&sg, 1024 /* XXX */);
bzero(&nuap, sizeof(nuap));
SCARG(&nuap, flags) = 0;
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index fd12717ce6a..7fb2276bb39 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.67 2002/05/02 00:36:04 millert Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.68 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -66,6 +66,11 @@
#include <dev/rndvar.h>
/*
+ * Map the shared signal code.
+ */
+int exec_sigcode_map(struct proc *, struct emul *);
+
+/*
* stackgap_random specifies if the stackgap should have a random size added
* to it. Must be a n^2. If non-zero, the stack gap will be calculated as:
* (arc4random() * ALIGNBYTES) & (stackgap_random - 1) + STACKGAPLEN.
@@ -246,7 +251,6 @@ sys_execve(p, v, retval)
struct ps_strings arginfo;
struct vmspace *vm = p->p_vmspace;
char **tmpfap;
- int szsigcode;
extern struct emul emul_native;
/*
@@ -365,15 +369,12 @@ sys_execve(p, v, retval)
dp = (char *)ALIGN(dp);
- szsigcode = pack.ep_emul->e_esigcode - pack.ep_emul->e_sigcode;
-
sgap = STACKGAPLEN;
if (stackgap_random != 0)
sgap += (arc4random() * ALIGNBYTES) & (stackgap_random - 1);
/* Now check if args & environ fit into new stack */
len = ((argc + envc + 2 + pack.ep_emul->e_arglen) * sizeof(char *) +
- sizeof(long) + dp + sgap + szsigcode +
- sizeof(struct ps_strings)) - argp;
+ sizeof(long) + dp + sgap + sizeof(struct ps_strings)) - argp;
len = ALIGN(len); /* make the stack "safely" aligned */
@@ -424,8 +425,8 @@ sys_execve(p, v, retval)
arginfo.ps_nenvstr = envc;
#ifdef MACHINE_STACK_GROWS_UP
- stack = (char *)USRSTACK + sizeof(arginfo) + szsigcode;
- slen = len - sizeof(arginfo) - szsigcode;
+ stack = (char *)USRSTACK + sizeof(arginfo);
+ slen = len - sizeof(arginfo);
#else
stack = (char *)(USRSTACK - len);
#endif
@@ -437,17 +438,6 @@ sys_execve(p, v, retval)
if (copyout(&arginfo, (char *)PS_STRINGS, sizeof(arginfo)))
goto exec_abort;
- /* copy out the process's signal trampoline code */
-#ifdef MACHINE_STACK_GROWS_UP
- if (szsigcode && copyout((char *)pack.ep_emul->e_sigcode,
- ((char *)PS_STRINGS) + sizeof(arginfo), szsigcode))
- goto exec_abort;
-#else
- if (szsigcode && copyout((char *)pack.ep_emul->e_sigcode,
- ((char *)PS_STRINGS) - szsigcode, szsigcode))
- goto exec_abort;
-#endif
-
stopprofclock(p); /* stop profiling */
fdcloseexec(p); /* handle close on exec */
execsigs(p); /* reset catched signals */
@@ -607,6 +597,10 @@ sys_execve(p, v, retval)
(*pack.ep_emul->e_setregs)(p, &pack, (u_long)stack, retval);
#endif
+ /* map the process's signal trampoline code */
+ if (exec_sigcode_map(p, pack.ep_emul))
+ goto exec_abort;
+
if (p->p_flag & P_TRACED)
psignal(p, SIGTRAP);
@@ -708,3 +702,52 @@ copyargs(pack, arginfo, stack, argp)
return (cpp);
}
+
+int
+exec_sigcode_map(struct proc *p, struct emul *e)
+{
+ vsize_t sz;
+
+ sz = (vaddr_t)e->e_esigcode - (vaddr_t)e->e_sigcode;
+
+ /*
+ * If we don't have a sigobject for this emulation, create one.
+ *
+ * sigobject is an anonymous memory object (just like SYSV shared
+ * memory) that we keep a permanent reference to and that we map
+ * in all processes that need this sigcode. The creation is simple,
+ * we create an object, add a permanent reference to it, map it in
+ * kernel space, copy out the sigcode to it and unmap it.
+ * The we map it with PROT_READ|PROT_EXEC into the process just
+ * the way sys_mmap would map it.
+ */
+ if (e->e_sigobject == NULL) {
+ vaddr_t va;
+ int r;
+
+ e->e_sigobject = uao_create(sz, 0);
+ uao_reference(e->e_sigobject); /* permanent reference */
+
+ va = vm_map_min(kernel_map); /* hint */
+ if ((r = uvm_map(kernel_map, &va, round_page(sz), e->e_sigobject,
+ 0, 0, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW,
+ UVM_INH_SHARE, UVM_ADV_RANDOM, 0)))) {
+ printf("kernel mapping failed %d\n", r);
+ return (ENOMEM);
+ }
+ memcpy((void *)va, e->e_sigcode, sz);
+ uvm_unmap(kernel_map, va, va + round_page(sz));
+ }
+
+ /* Just a hint to uvm_mmap where to put it. */
+ p->p_sigcode = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ);
+ uao_reference(e->e_sigobject);
+ if (uvm_map(&p->p_vmspace->vm_map, &p->p_sigcode, round_page(sz),
+ e->e_sigobject, 0, 0, UVM_MAPFLAG(UVM_PROT_RX, UVM_PROT_RX,
+ UVM_INH_SHARE, UVM_ADV_RANDOM, 0))) {
+ printf("user mapping failed\n");
+ return (ENOMEM);
+ }
+
+ return (0);
+}
diff --git a/sys/sys/exec.h b/sys/sys/exec.h
index c1159e37f66..eee337c776f 100644
--- a/sys/sys/exec.h
+++ b/sys/sys/exec.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.h,v 1.15 2002/07/19 01:06:18 jason Exp $ */
+/* $OpenBSD: exec.h,v 1.16 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */
/*-
@@ -85,10 +85,10 @@ struct ps_strings {
#endif
#ifdef MACHINE_STACK_GROWS_UP
#define STACKGAPBASE_UNALIGNED \
- ((caddr_t)PS_STRINGS + sizeof(struct ps_strings) + (u_long)szsigcode)
+ ((caddr_t)PS_STRINGS + sizeof(struct ps_strings))
#else
#define STACKGAPBASE_UNALIGNED \
- ((caddr_t)PS_STRINGS - szsigcode - STACKGAPLEN)
+ ((caddr_t)PS_STRINGS - STACKGAPLEN)
#endif
#define STACKGAPBASE \
((caddr_t)ALIGN(STACKGAPBASE_UNALIGNED))
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index d2cc9018460..ed3d79b4104 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.61 2002/07/03 21:19:08 miod Exp $ */
+/* $OpenBSD: proc.h,v 1.62 2002/07/20 19:24:57 art Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -77,6 +77,7 @@ struct pgrp {
*/
struct exec_package;
struct ps_strings;
+struct uvm_object;
union sigval;
struct emul {
@@ -98,6 +99,7 @@ struct emul {
int (*e_fixup)(struct proc *, struct exec_package *);
char *e_sigcode; /* Start of sigcode */
char *e_esigcode; /* End of sigcode */
+ struct uvm_object *e_sigobject; /* shared sigcode object */
};
/*
@@ -196,6 +198,7 @@ struct proc {
char p_comm[MAXCOMLEN+1];
struct pgrp *p_pgrp; /* Pointer to process group. */
+ vaddr_t p_sigcode; /* user pointer to the signal code. */
/* End area that is copied on creation. */
#define p_endcopy p_addr