Provide a small inline wrapper for sysent::sy_call() and use it to store

the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.
This commit is contained in:
ad 2008-10-21 12:16:58 +00:00
parent a9327b33e2
commit d1b01a3709
27 changed files with 175 additions and 93 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:58 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:58 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,6 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -199,7 +200,7 @@ linux_syscall_plain(struct lwp *l, u_int64_t code, struct trapframe *framep)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -289,7 +290,7 @@ linux_syscall_fancy(struct lwp *l, u_int64_t code, struct trapframe *framep)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: osf1_syscall.c,v 1.30 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: osf1_syscall.c,v 1.31 2008/10/21 12:16:58 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.30 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.31 2008/10/21 12:16:58 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,6 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.30 2008/10/21 11:51:23 ad Exp $")
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -196,7 +197,7 @@ osf1_syscall_plain(struct lwp *l, u_int64_t code, struct trapframe *framep)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -285,7 +286,7 @@ osf1_syscall_fancy(struct lwp *l, u_int64_t code, struct trapframe *framep)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.33 2008/10/15 06:51:17 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.34 2008/10/21 12:16:58 ad Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.33 2008/10/15 06:51:17 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.34 2008/10/21 12:16:58 ad Exp $");
#include "opt_sa.h"
@ -101,6 +101,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.33 2008/10/15 06:51:17 wrstuden Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/ktrace.h>
#include <uvm/uvm_extern.h>
@ -207,7 +208,7 @@ syscall_plain(struct lwp *l, u_int64_t code, struct trapframe *framep)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -303,7 +304,7 @@ syscall_fancy(struct lwp *l, u_int64_t code, struct trapframe *framep)
if ((error = trace_enter(code, args, callp->sy_narg)) == 0) {
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
switch (error) {

View File

@ -1,7 +1,7 @@
/* $NetBSD: linux32_syscall.c,v 1.26 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: linux32_syscall.c,v 1.27 2008/10/21 12:16:59 ad Exp $ */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.26 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.27 2008/10/21 12:16:59 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -9,6 +9,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.26 2008/10/21 11:51:23 ad Exp
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -80,7 +81,7 @@ linux32_syscall(frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_linux.h"
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.28 2008/10/21 11:51:23 ad Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -105,7 +106,7 @@ linux_syscall(struct trapframe *frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_syscall.c,v 1.28 2008/04/28 20:23:12 martin Exp $ */
/* $NetBSD: netbsd32_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.28 2008/04/28 20:23:12 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.28 2008/04/28 20:23:12 martin
#include <sys/signal.h>
/* XXX this file ought to include the netbsd32 version of these 2 headers */
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/syscall_stats.h>
@ -104,7 +105,7 @@ netbsd32_syscall(struct trapframe *frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
if (__predict_false(p->p_trace_enabled)

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.43 2008/10/15 06:51:17 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.44 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.43 2008/10/15 06:51:17 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.44 2008/10/21 12:16:59 ad Exp $");
#include "opt_sa.h"
@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.43 2008/10/15 06:51:17 wrstuden Exp $"
#include <sys/savar.h>
#include <sys/ktrace.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syscall_stats.h>
#include <uvm/uvm_extern.h>
@ -129,7 +130,7 @@ syscall(struct trapframe *frame)
|| (error = trace_enter(code, args, callp->sy_narg)) == 0) {
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
if (__predict_false(p->p_trace_enabled)

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscall.c,v 1.21 2008/04/28 20:23:13 martin Exp $ */
/* $NetBSD: linux_syscall.c,v 1.22 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.21 2008/04/28 20:23:13 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.22 2008/10/21 12:16:59 ad Exp $");
#include <sys/device.h>
#include <sys/errno.h>
@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.21 2008/04/28 20:23:13 martin Ex
#include <sys/signalvar.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -127,7 +128,7 @@ linux_syscall_plain(trapframe_t *frame, struct lwp *l, u_int32_t insn)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -175,7 +176,7 @@ linux_syscall_fancy(trapframe_t *frame, struct lwp *l, u_int32_t insn)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.44 2008/10/17 08:51:43 cegger Exp $ */
/* $NetBSD: syscall.c,v 1.45 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.44 2008/10/17 08:51:43 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.45 2008/10/21 12:16:59 ad Exp $");
#include "opt_sa.h"
@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.44 2008/10/17 08:51:43 cegger Exp $");
#include <sys/reboot.h>
#include <sys/signalvar.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/ktrace.h>
@ -318,7 +319,7 @@ syscall_plain(struct trapframe *frame, struct lwp *l, u_int32_t insn)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -464,7 +465,7 @@ syscall_fancy(struct trapframe *frame, struct lwp *l, u_int32_t insn)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $ */
/* $NetBSD: trap.c,v 1.57 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.57 2008/10/21 12:16:59 ad Exp $");
/* #define INTRDEBUG */
/* #define TRAPDEBUG */
@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $");
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/mutex.h>
@ -1305,7 +1306,7 @@ syscall(struct trapframe *frame, int *args)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: freebsd_syscall.c,v 1.34 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: freebsd_syscall.c,v 1.35 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.34 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.35 2008/10/21 12:16:59 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.34 2008/10/21 11:51:23 ad Exp
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -120,7 +121,7 @@ freebsd_syscall_plain(frame)
rval[0] = 0;
rval[1] = frame->tf_edx; /* need to keep edx for shared FreeBSD bins */
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -201,7 +202,7 @@ freebsd_syscall_fancy(frame)
if ((error = trace_enter(code, args, callp->sy_narg)) == 0) {
rval[0] = 0;
rval[1] = frame->tf_edx; /* need to keep edx for shared FreeBSD bins */
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_syscall.c,v 1.43 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: ibcs2_syscall.c,v 1.44 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.43 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.44 2008/10/21 12:16:59 ad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.43 2008/10/21 11:51:23 ad Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -117,7 +118,7 @@ ibcs2_syscall_plain(frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -196,7 +197,7 @@ ibcs2_syscall_fancy(frame)
if ((error = trace_enter(code, args, callp->sy_narg)) == 0) {
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscall.c,v 1.48 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: linux_syscall.c,v 1.49 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.48 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.49 2008/10/21 12:16:59 ad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.48 2008/10/21 11:51:23 ad Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -102,12 +103,12 @@ linux_syscall(struct trapframe *frame)
if (__predict_false(l->l_proc->p_trace_enabled)) {
error = trace_enter(code, args, callp->sy_narg);
if (__predict_true(error == 0)) {
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
code = frame->tf_eax & (LINUX_SYS_NSYSENT - 1);
trace_exit(code, rval, error);
}
} else
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
if (__predict_true(error == 0)) {
frame->tf_eax = rval[0];

View File

@ -1,4 +1,4 @@
/* $NetBSD: mach_syscall.c,v 1.32 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: mach_syscall.c,v 1.33 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.32 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.33 2008/10/21 12:16:59 ad Exp $");
#include "opt_vm86.h"
@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.32 2008/10/21 11:51:23 ad Exp $")
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -132,7 +133,7 @@ mach_syscall_plain(frame)
rval[0] = 0;
rval[1] = 0;
KERNEL_LOCK(1, NULL);
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
KERNEL_UNLOCK_ONE(NULL);
switch (error) {
case 0:
@ -224,7 +225,7 @@ mach_syscall_fancy(frame)
rval[0] = 0;
rval[1] = 0;
KERNEL_LOCK(1, NULL);
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
KERNEL_UNLOCK_ONE(NULL);
out:
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_syscall.c,v 1.42 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: svr4_syscall.c,v 1.43 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.42 2008/10/21 11:51:23 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.43 2008/10/21 12:16:59 ad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.42 2008/10/21 11:51:23 ad Exp $")
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -114,7 +115,7 @@ svr4_syscall_plain(frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -191,7 +192,7 @@ svr4_syscall_fancy(frame)
if ((error = trace_enter(code, args, callp->sy_narg)) == 0) {
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.57 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.57 2008/10/21 12:16:59 ad Exp $");
#include "opt_vm86.h"
#include "opt_sa.h"
@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.56 2008/10/15 06:51:17 wrstuden Exp $"
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syscall_stats.h>
#include <uvm/uvm_extern.h>
@ -108,7 +109,7 @@ syscall(struct trapframe *frame)
rval[0] = 0;
rval[1] = 0;
KASSERT(l->l_holdcnt == 0);
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
}
if (__predict_false(l->l_proc->p_trace_enabled)

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $ */
/* $NetBSD: linux_syscall.c,v 1.19 2008/10/21 12:16:59 ad Exp $ */
/*-
* Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.19 2008/10/21 12:16:59 ad Exp $");
#include "opt_execfmt.h"
@ -120,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $
#include <sys/acct.h>
#include <sys/kernel.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syslog.h>
#include <sys/user.h>
@ -188,7 +189,7 @@ linux_syscall_plain(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -268,7 +269,7 @@ linux_syscall_fancy(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: m68k_syscall.c,v 1.35 2008/10/15 06:51:18 wrstuden Exp $ */
/* $NetBSD: m68k_syscall.c,v 1.36 2008/10/21 12:16:59 ad 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.35 2008/10/15 06:51:18 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.36 2008/10/21 12:16:59 ad Exp $");
#include "opt_execfmt.h"
#include "opt_compat_netbsd.h"
@ -126,6 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.35 2008/10/15 06:51:18 wrstuden E
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syslog.h>
#include <sys/user.h>
#include <sys/ktrace.h>
@ -273,7 +274,7 @@ syscall_plain(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -394,7 +395,7 @@ syscall_fancy(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $ */
/* $NetBSD: sunos_syscall.c,v 1.19 2008/10/21 12:16:59 ad Exp $ */
/*-
* Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos_syscall.c,v 1.19 2008/10/21 12:16:59 ad Exp $");
#include "opt_execfmt.h"
@ -120,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunos_syscall.c,v 1.18 2008/02/06 22:12:40 dsl Exp $
#include <sys/acct.h>
#include <sys/kernel.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syslog.h>
#include <sys/user.h>
@ -213,7 +214,7 @@ sunos_syscall_plain(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -321,7 +322,7 @@ sunos_syscall_fancy(register_t code, struct lwp *l, struct frame *frame)
rval[0] = 0;
rval[1] = frame->f_regs[D1];
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.35 2008/10/15 06:51:18 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.36 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -107,7 +107,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.35 2008/10/15 06:51:18 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.36 2008/10/21 12:16:59 ad Exp $");
#include "opt_sa.h"
@ -117,6 +117,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.35 2008/10/15 06:51:18 wrstuden Exp $"
#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/sa.h>
#include <sys/savar.h>
@ -285,7 +286,7 @@ EMULNAME(syscall_plain)(struct lwp *l, u_int status, u_int cause, u_int opc)
rval[1] = frame->f_regs[_R_V1];
#endif
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -436,7 +437,7 @@ EMULNAME(syscall_fancy)(struct lwp *l, u_int status, u_int cause, u_int opc)
rval[1] = frame->f_regs[_R_V1];
#endif
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.42 2008/10/15 06:51:18 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.43 2008/10/21 12:16:59 ad Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@ -46,6 +46,7 @@
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/ktrace.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -63,7 +64,7 @@
#define EMULNAME(x) (x)
#define EMULNAMEU(x) (x)
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.42 2008/10/15 06:51:18 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.43 2008/10/21 12:16:59 ad Exp $");
void
child_return(void *arg)
@ -153,7 +154,7 @@ EMULNAME(syscall_plain)(struct trapframe *frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, params, rval);
error = sy_call(callp, l, params, rval);
switch (error) {
case 0:
@ -268,7 +269,7 @@ EMULNAME(syscall_fancy)(struct trapframe *frame)
rval[0] = 0;
rval[1] = 0;
error = (*callp->sy_call)(l, params, rval);
error = sy_call(callp, l, params, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.11 2008/10/15 06:51:18 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.12 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@ -86,6 +86,7 @@
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sh3/userret.h>
@ -217,7 +218,7 @@ syscall_plain(struct lwp *l, struct trapframe *tf)
rval[0] = 0;
rval[1] = tf->tf_r1;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
@ -359,7 +360,7 @@ syscall_fancy(struct lwp *l, struct trapframe *tf)
rval[0] = 0;
rval[1] = tf->tf_r1;
error = (*callp->sy_call)(l, args, rval);
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.20 2008/10/15 06:51:18 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.21 2008/10/21 12:16:59 ad Exp $ */
/*
* Copyright (c) 1996
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.20 2008/10/15 06:51:18 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.21 2008/10/21 12:16:59 ad Exp $");
#include "opt_sparc_arch.h"
#include "opt_multiprocessor.h"
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.20 2008/10/15 06:51:18 wrstuden Exp $"
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/ktrace.h>
#include <uvm/uvm_extern.h>
@ -240,7 +241,7 @@ syscall_plain(register_t code, struct trapframe *tf, register_t pc)
l->l_savp->savp_pflags &= ~SAVP_FLAG_DELIVERING;
#endif
error = (*callp->sy_call)(l, &args, rval.o);
error = sy_call(callp, l, &args, rval.o);
switch (error) {
case 0:
@ -324,7 +325,7 @@ syscall_fancy(register_t code, struct trapframe *tf, register_t pc)
l->l_savp->savp_pflags &= ~SAVP_FLAG_DELIVERING;
#endif
error = (*callp->sy_call)(l, &args, rval.o);
error = sy_call(callp, l, &args, rval.o);
out:
switch (error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.34 2008/10/15 06:51:19 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.35 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.34 2008/10/15 06:51:19 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.35 2008/10/21 12:16:59 ad Exp $");
#include "opt_sa.h"
@ -92,6 +92,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.34 2008/10/15 06:51:19 wrstuden Exp $"
#include <sys/signal.h>
#include <sys/ktrace.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <uvm/uvm_extern.h>
@ -314,7 +315,7 @@ syscall_plain(struct trapframe64 *tf, register_t code, register_t pc)
rval[0] = 0;
rval[1] = tf->tf_out[1];
error = (*callp->sy_call)(l, &args, rval);
error = sy_call(callp, l, &args, rval);
switch (error) {
case 0:
@ -417,7 +418,7 @@ syscall_fancy(struct trapframe64 *tf, register_t code, register_t pc)
rval[0] = 0;
rval[1] = tf->tf_out[1];
error = (*callp->sy_call)(l, &args, rval);
error = sy_call(callp, l, &args, rval);
out:
switch (error) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.14 2008/10/15 06:51:19 wrstuden Exp $ */
/* $NetBSD: syscall.c,v 1.15 2008/10/21 12:16:59 ad 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: syscall.c,v 1.14 2008/10/15 06:51:19 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.15 2008/10/21 12:16:59 ad Exp $");
#include "opt_multiprocessor.h"
#include "opt_sa.h"
@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.14 2008/10/15 06:51:19 wrstuden Exp $"
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/exec.h>
@ -128,7 +129,7 @@ syscall(struct trapframe *frame)
if (__predict_true(!p->p_trace_enabled)
|| __predict_false(callp->sy_flags & SYCALL_INDIRECT)
|| (error = trace_enter(frame->code, args, callp->sy_narg)) == 0) {
error = (*callp->sy_call)(curlwp, args, rval);
error = sy_call(callp, curlwp, args, rval);
}
KASSERT(exptr == l->l_addr->u_pcb.framep);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lwp.h,v 1.112 2008/10/21 11:51:23 ad Exp $ */
/* $NetBSD: lwp.h,v 1.113 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -67,6 +67,7 @@
*/
struct lockdebug;
struct sadata_vp;
struct sysent;
struct lwp {
/* Scheduling and overall state */
@ -169,6 +170,7 @@ struct lwp {
u_int l_dopreempt; /* s: kernel preemption pending */
int l_pflag; /* !: LWP private flags */
int l_dupfd; /* !: side return from cloning devs XXX */
const volatile struct sysent *l_sycall;/* !: currently active syscall */
struct rusage l_ru; /* !: accounting information */
uint64_t l_pfailtime; /* !: for kernel preemption */
uintptr_t l_pfailaddr; /* !: for kernel preemption */

55
sys/sys/syscallvar.h Normal file
View File

@ -0,0 +1,55 @@
/* $NetBSD: syscallvar.h,v 1.1 2008/10/21 12:16:59 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software developed for The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SYS_SYSCALLVAR_H_
#define _SYS_SYSCALLVAR_H_
#ifndef _KERNEL
#error nothing of interest to userspace here
#endif
#include <sys/systm.h>
#include <sys/proc.h>
static inline int
sy_call(const struct sysent *sy, struct lwp *l, const void *uap,
register_t *rval)
{
int error;
l->l_sycall = sy;
error = (*sy->sy_call)(l, uap, rval);
l->l_sycall = NULL;
return error;
}
#endif /* _SYS_SYSCALLVAR_H_ */