summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2007-02-15 01:13:36 +0000
committerjkim <jkim@FreeBSD.org>2007-02-15 01:13:36 +0000
commitca68f71cb93c39ec4a8a8f5c89d90469f2c73675 (patch)
tree1dd3798d1880b57212b3e0c15ecce60fd88a47fc
parent6fadbd6f66b3bf791552eda479f86ffcc27d5be2 (diff)
downloadFreeBSD-src-ca68f71cb93c39ec4a8a8f5c89d90469f2c73675.zip
FreeBSD-src-ca68f71cb93c39ec4a8a8f5c89d90469f2c73675.tar.gz
MFP4: 113033
Port iopl(2) from i386. This fixes LTP iopl01 and iopl02 on amd64.
-rw-r--r--sys/amd64/linux32/linux32_machdep.c20
-rw-r--r--sys/amd64/linux32/syscalls.master2
2 files changed, 20 insertions, 2 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 53ad3d4..a890569 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -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>
@@ -902,6 +904,23 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
}
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)
{
int pip[2];
@@ -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)
{
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index d29c0fe..9c3ee1e 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -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
OpenPOWER on IntegriCloud