From e4a211bbec694bd8f760b505efa05e164a04da1b Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Sat, 20 Jul 2002 19:24:58 +0000 Subject: Instead of copying out the signal trampoline on top of the stack, create an uvm aobj, copy out the signal trampoline into it and share that page among all processes for the same emulation. This also requires us to actually be able to tell signal code where the trampoline is located, so introduce a new field in struct proc - p_sigcode that is a pointer to sigcode. This allows us to remove all the ugly calculations of the signal trampoline address done in every sendsig function in the tree (that's why so many files are changed). Tested by various people. ok deraadt@ --- sys/compat/common/compat_util.c | 9 ++------- sys/compat/ultrix/ultrix_fs.c | 8 +++----- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'sys/compat') 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; -- cgit v1.2.3