diff options
-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 |