MFP4: 113033

Port iopl(2) from i386.  This fixes LTP iopl01 and iopl02 on amd64.
This commit is contained in:
Jung-uk Kim 2007-02-15 01:13:36 +00:00
parent 1441cab7b2
commit 1e5ed8c1c2
2 changed files with 20 additions and 2 deletions

View file

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
@ -52,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/unistd.h>
#include <machine/frame.h>
#include <machine/psl.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@ -901,6 +903,23 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
return (error);
}
int
linux_iopl(struct thread *td, struct linux_iopl_args *args)
{
int error;
if (args->level < 0 || args->level > 3)
return (EINVAL);
if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
return (error);
td->td_frame->tf_rflags = (td->td_frame->tf_rflags & ~PSL_IOPL) |
(args->level * (PSL_IOPL / 3));
return (0);
}
int
linux_pipe(struct thread *td, struct linux_pipe_args *args)
{
@ -932,7 +951,6 @@ linux_pipe(struct thread *td, struct linux_pipe_args *args)
td->td_retval[0] = 0;
return (0);
}
int
linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
{

View file

@ -198,7 +198,7 @@
108 AUE_FSTAT STD { int linux_newfstat(l_uint fd, \
struct l_newstat *buf); }
109 AUE_NULL STD { int linux_uname(void); }
110 AUE_NULL UNIMPL iopl
110 AUE_NULL STD { int linux_iopl(l_ulong level); }
111 AUE_NULL STD { int linux_vhangup(void); }
112 AUE_NULL UNIMPL idle
113 AUE_NULL UNIMPL vm86old