Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.
This commit is contained in:
parent
d4def06880
commit
13f624ca0f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.122 2010/03/20 23:31:27 chs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.123 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -93,7 +93,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.122 2010/03/20 23:31:27 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.123 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -103,6 +103,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.122 2010/03/20 23:31:27 chs Exp $");
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <sys/atomic.h>
|
||||
|
||||
@ -1218,18 +1219,14 @@ alpha_ucode_to_ksiginfo(u_long ucode)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_machdep.c,v 1.61 2009/12/10 14:13:49 matt Exp $ */
|
||||
/* $NetBSD: netbsd32_machdep.c,v 1.62 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.61 2009/12/10 14:13:49 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.62 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -937,13 +937,15 @@ cpu_getmcontext32(struct lwp *l, mcontext32_t *mcp, unsigned int *flags)
|
||||
void
|
||||
startlwp32(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext32_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
/* Note: we are freeing ucontext_t, not ucontext32_t. */
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.61 2010/02/23 06:27:40 cegger Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.62 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.61 2010/02/23 06:27:40 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.62 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.61 2010/02/23 06:27:40 cegger Exp $");
|
||||
#include <sys/acct.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/syscall.h>
|
||||
@ -719,7 +719,8 @@ startlwp(void *arg)
|
||||
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arm_machdep.c,v 1.27 2009/12/10 14:13:49 matt Exp $ */
|
||||
/* $NetBSD: arm_machdep.c,v 1.28 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
@ -79,12 +79,12 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.27 2009/12/10 14:13:49 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.28 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include <sys/exec.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/ucontext.h>
|
||||
#include <sys/evcnt.h>
|
||||
#include <sys/cpu.h>
|
||||
@ -190,17 +190,14 @@ setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#ifdef DIAGNOSTIC
|
||||
if (err)
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.87 2010/04/06 07:44:09 skrll Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.88 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -58,7 +58,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2010/04/06 07:44:09 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.88 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
/* #define INTRDEBUG */
|
||||
/* #define TRAPDEBUG */
|
||||
@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2010/04/06 07:44:09 skrll Exp $");
|
||||
#include <sys/acct.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/userret.h>
|
||||
|
||||
#include <net/netisr.h>
|
||||
@ -1295,18 +1295,14 @@ out:
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l, l->l_md.md_regs->tf_iioq_head, 0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.255 2010/02/22 06:42:14 darran Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.256 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.255 2010/02/22 06:42:14 darran Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.256 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.255 2010/02/22 06:42:14 darran Exp $");
|
||||
#include <sys/acct.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/syscall.h>
|
||||
@ -860,7 +860,8 @@ startlwp(void *arg)
|
||||
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: m68k_syscall.c,v 1.39 2010/02/25 07:17:48 skrll Exp $ */
|
||||
/* $NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
@ -110,7 +110,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.39 2010/02/25 07:17:48 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_execfmt.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -483,23 +483,19 @@ child_return(void *arg)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
struct frame *f = (struct frame *)l->l_md.md_regs;
|
||||
int error;
|
||||
|
||||
f->f_regs[D0] = 0;
|
||||
f->f_sr &= ~PSL_C;
|
||||
f->f_format = FMT0;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
machine_userret(l, f, 0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mips_machdep.c,v 1.225 2010/01/23 15:55:54 mrg Exp $ */
|
||||
/* $NetBSD: mips_machdep.c,v 1.226 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.225 2010/01/23 15:55:54 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.226 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_cputype.h"
|
||||
#include "opt_compat_netbsd32.h"
|
||||
@ -130,7 +130,7 @@ __KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.225 2010/01/23 15:55:54 mrg Exp $
|
||||
#include <sys/core.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
@ -1943,17 +1943,14 @@ void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
ucontext_t *uc = arg;
|
||||
int err;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(curlwp, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("%s: Error %d from cpu_setmcontext", __func__, err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
userret(curlwp);
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_NETBSD32
|
||||
@ -1964,17 +1961,15 @@ void
|
||||
startlwp32(void *arg)
|
||||
{
|
||||
ucontext32_t *uc = arg;
|
||||
int err;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext32(curlwp, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("%s: Error %d from cpu_setmcontext32", __func__, err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
userret(curlwp);
|
||||
/* Note: we are freeing ucontext_t, not ucontext32_t. */
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
#endif /* COMPAT_NETBSD32 */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.55 2010/03/20 23:31:29 chs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.56 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.55 2010/03/20 23:31:29 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.56 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_altivec.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -78,11 +78,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.55 2010/03/20 23:31:29 chs Exp $");
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
#include <sys/userret.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#if defined(KGDB)
|
||||
#include <sys/kgdb.h>
|
||||
@ -714,18 +714,14 @@ fix_unaligned(struct lwp *l, struct trapframe *frame)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
upcallret(l);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -32,14 +32,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#include "opt_altivec.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/pool.h>
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/reboot.h>
|
||||
@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $");
|
||||
#include <sys/savar.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
@ -897,18 +898,15 @@ copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
struct trapframe *frame = trapframe(l);
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l, frame);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
|
||||
@ -81,7 +81,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#include "opt_kstack_debug.h"
|
||||
|
||||
@ -268,7 +268,6 @@ child_return(void *arg)
|
||||
ktrsysret(SYS_fork, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct emul e_startlwp (for _lwp_create(2))
|
||||
*/
|
||||
@ -276,20 +275,16 @@ void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#ifdef DIAGNOSTIC
|
||||
if (error)
|
||||
printf("startlwp: error %d from cpu_setmcontext()", error);
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Exit hook
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.182 2010/03/20 23:31:30 chs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.183 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.182 2010/03/20 23:31:30 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.183 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_svr4.h"
|
||||
@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.182 2010/03/20 23:31:30 chs Exp $");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/wait.h>
|
||||
@ -71,7 +71,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.182 2010/03/20 23:31:30 chs Exp $");
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/simplelock.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
@ -1303,18 +1302,14 @@ upcallret(struct lwp *l)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l, l->l_md.md_tf->tf_pc, 0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_machdep.c,v 1.91 2009/12/10 14:13:52 matt Exp $ */
|
||||
/* $NetBSD: netbsd32_machdep.c,v 1.92 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.91 2009/12/10 14:13:52 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.92 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -1346,18 +1346,15 @@ cpu_getmcontext32(struct lwp *l, mcontext32_t *mcp, unsigned int *flags)
|
||||
void
|
||||
startlwp32(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext32_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
/* Note: we are freeing ucontext_t, not ucontext32_t. */
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syscall.c,v 1.36 2009/11/21 04:16:52 rmind Exp $ */
|
||||
/* $NetBSD: syscall.c,v 1.37 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.36 2009/11/21 04:16:52 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.37 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#include "opt_sa.h"
|
||||
|
||||
@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.36 2009/11/21 04:16:52 rmind Exp $");
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/ktrace.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/syscallvar.h>
|
||||
@ -473,26 +474,20 @@ child_return(void *arg)
|
||||
ktrsysret((l->l_proc->p_lflag & PL_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Start a new LWP
|
||||
*/
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
userret(l, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.123 2010/03/20 23:31:30 chs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.124 2010/04/23 19:18:10 rmind Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -33,7 +33,7 @@
|
||||
/* All bugs are subject to removal without further notice */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.123 2010/03/20 23:31:30 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.124 2010/04/23 19:18:10 rmind Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -47,7 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.123 2010/03/20 23:31:30 chs Exp $");
|
||||
#include <sys/exec.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
@ -375,19 +375,15 @@ setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
int err;
|
||||
ucontext_t *uc = arg;
|
||||
struct lwp *l = curlwp;
|
||||
lwp_t *l = curlwp;
|
||||
struct pcb *pcb;
|
||||
int error;
|
||||
|
||||
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
#if DIAGNOSTIC
|
||||
if (err) {
|
||||
printf("Error %d from cpu_setmcontext.", err);
|
||||
}
|
||||
#endif
|
||||
pool_put(&lwp_uc_pool, uc);
|
||||
error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
|
||||
KASSERT(error == 0);
|
||||
|
||||
kmem_free(uc, sizeof(ucontext_t));
|
||||
/* XXX - profiling spoiled here */
|
||||
pcb = lwp_getpcb(l);
|
||||
userret(l, pcb->framep, l->l_proc->p_sticks);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_lwp.c,v 1.145 2010/04/12 23:20:18 pooka Exp $ */
|
||||
/* $NetBSD: kern_lwp.c,v 1.146 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -209,7 +209,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.145 2010/04/12 23:20:18 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.146 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_lockdebug.h"
|
||||
@ -242,11 +242,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.145 2010/04/12 23:20:18 pooka Exp $")
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <uvm/uvm_object.h>
|
||||
|
||||
struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
|
||||
|
||||
struct pool lwp_uc_pool;
|
||||
|
||||
static pool_cache_t lwp_cache;
|
||||
struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
|
||||
static pool_cache_t lwp_cache;
|
||||
|
||||
/* DTrace proc provider probes */
|
||||
SDT_PROBE_DEFINE(proc,,,lwp_create,
|
||||
@ -266,8 +263,6 @@ void
|
||||
lwpinit(void)
|
||||
{
|
||||
|
||||
pool_init(&lwp_uc_pool, sizeof(ucontext_t), 0, 0, 0, "lwpucpl",
|
||||
&pool_allocator_nointr, IPL_NONE);
|
||||
lwpinit_specificdata();
|
||||
lwp_sys_init();
|
||||
lwp_cache = pool_cache_init(sizeof(lwp_t), MIN_LWP_ALIGNMENT, 0, 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sys_lwp.c,v 1.48 2009/11/01 21:46:09 rmind Exp $ */
|
||||
/* $NetBSD: sys_lwp.c,v 1.49 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.48 2009/11/01 21:46:09 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.49 2010/04/23 19:18:09 rmind Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -95,11 +95,10 @@ sys__lwp_create(struct lwp *l, const struct sys__lwp_create_args *uap,
|
||||
mutex_exit(p->p_lock);
|
||||
#endif
|
||||
|
||||
newuc = pool_get(&lwp_uc_pool, PR_WAITOK);
|
||||
|
||||
newuc = kmem_alloc(sizeof(ucontext_t), KM_SLEEP);
|
||||
error = copyin(SCARG(uap, ucp), newuc, p->p_emul->e_ucsize);
|
||||
if (error) {
|
||||
pool_put(&lwp_uc_pool, newuc);
|
||||
kmem_free(newuc, sizeof(ucontext_t));
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -107,7 +106,7 @@ sys__lwp_create(struct lwp *l, const struct sys__lwp_create_args *uap,
|
||||
|
||||
uaddr = uvm_uarea_alloc();
|
||||
if (__predict_false(uaddr == 0)) {
|
||||
pool_put(&lwp_uc_pool, newuc);
|
||||
kmem_free(newuc, sizeof(ucontext_t));
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@ -115,7 +114,7 @@ sys__lwp_create(struct lwp *l, const struct sys__lwp_create_args *uap,
|
||||
NULL, 0, p->p_emul->e_startlwp, newuc, &l2, l->l_class);
|
||||
if (__predict_false(error)) {
|
||||
uvm_uarea_free(uaddr);
|
||||
pool_put(&lwp_uc_pool, newuc);
|
||||
kmem_free(newuc, sizeof(ucontext_t));
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -123,7 +122,7 @@ sys__lwp_create(struct lwp *l, const struct sys__lwp_create_args *uap,
|
||||
error = copyout(&lid, SCARG(uap, new_lwp), sizeof(lid));
|
||||
if (error) {
|
||||
lwp_exit(l2);
|
||||
pool_put(&lwp_uc_pool, newuc);
|
||||
kmem_free(newuc, sizeof(ucontext_t));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lwp.h,v 1.130 2010/04/12 22:15:31 pooka Exp $ */
|
||||
/* $NetBSD: lwp.h,v 1.131 2010/04/23 19:18:09 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -210,9 +210,6 @@ LIST_HEAD(lwplist, lwp); /* a list of LWPs */
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct lwplist alllwp; /* List of all LWPs. */
|
||||
|
||||
extern struct pool lwp_uc_pool; /* memory pool for LWP startup args */
|
||||
|
||||
extern lwp_t lwp0; /* LWP for proc0 */
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user