diff options
author | jhb <jhb@FreeBSD.org> | 2005-07-07 19:28:55 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2005-07-07 19:28:55 +0000 |
commit | 3185ba880757a204311040276e2e7bfab3e26ec1 (patch) | |
tree | 9dd14680609b3acfed281fdab6a8f883aef76af8 /sys/i386/ibcs2 | |
parent | 89c65bc296d1121e3f14a3f228aa3d87565a4e5a (diff) | |
download | FreeBSD-src-3185ba880757a204311040276e2e7bfab3e26ec1.zip FreeBSD-src-3185ba880757a204311040276e2e7bfab3e26ec1.tar.gz |
Conditionally acquire Giant around the ISC and Xenix system calls based
on the SYF_MPSAFE flag in the wrapper system calls for the ISC and Xenix
system call vectors.
Approved by: re (scottl)
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_isc.c | 18 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_xenix.c | 16 |
2 files changed, 24 insertions, 10 deletions
diff --git a/sys/i386/ibcs2/ibcs2_isc.c b/sys/i386/ibcs2/ibcs2_isc.c index a6004e3..e2638a3 100644 --- a/sys/i386/ibcs2/ibcs2_isc.c +++ b/sys/i386/ibcs2/ibcs2_isc.c @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/lock.h> +#include <sys/mutex.h> #include <sys/systm.h> #include <sys/sysent.h> #include <sys/proc.h> @@ -50,13 +52,19 @@ ibcs2_isc(struct thread *td, struct ibcs2_isc_args *uap) { struct trapframe *tf = td->td_frame; struct sysent *callp; - u_int code; + u_int code; + int error; code = (tf->tf_eax & 0xffffff00) >> 8; callp = &isc_sysent[code]; - if(code < IBCS2_ISC_MAXSYSCALL) - return((*callp->sy_call)(td, (void *)uap)); - else - return ENOSYS; + if (code < IBCS2_ISC_MAXSYSCALL) { + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_lock(&Giant); + error = (*callp->sy_call)(td, (void *)uap); + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_unlock(&Giant); + } else + error = ENOSYS; + return (error); } diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c index 0339f9f..dc8bfac 100644 --- a/sys/i386/ibcs2/ibcs2_xenix.c +++ b/sys/i386/ibcs2/ibcs2_xenix.c @@ -62,15 +62,21 @@ ibcs2_xenix(struct thread *td, struct ibcs2_xenix_args *uap) { struct trapframe *tf = td->td_frame; struct sysent *callp; - u_int code; + u_int code; + int error; code = (tf->tf_eax & 0xff00) >> 8; callp = &xenix_sysent[code]; - if(code < IBCS2_XENIX_MAXSYSCALL) - return((*callp->sy_call)(td, (void *)uap)); - else - return ENOSYS; + if (code < IBCS2_XENIX_MAXSYSCALL) { + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_lock(&Giant); + error = ((*callp->sy_call)(td, (void *)uap)); + if ((callp->sy_narg & SYF_MPSAFE) == 0) + mtx_unlock(&Giant); + } else + error = ENOSYS; + return (error); } int |