Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2007 23:46:28 GMT
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 113033 for review
Message-ID:  <200701162346.l0GNkSOi063600@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113033

Change 113033 by jkim@jkim_hammer on 2007/01/16 23:45:49

	MFi386: iopl(2)
	
	This fixes LTP iopl01 and iopl02 on amd64.

Affected files ...

.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#22 edit
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_proto.h#18 edit
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_syscall.h#18 edit
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysent.c#17 edit
.. //depot/projects/linuxolator/src/sys/amd64/linux32/syscalls.master#17 edit

Differences ...

==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#22 (text+ko) ====

@@ -43,6 +43,7 @@
 #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>
@@ -60,6 +61,7 @@
 
 #include <amd64/linux32/linux.h>
 #include <amd64/linux32/linux32_proto.h>
+#include <amd64/include/psl.h>
 #include <amd64/include/specialreg.h>
 #include <compat/linux/linux_ipc.h>
 #include <compat/linux/linux_signal.h>
@@ -934,6 +936,23 @@
 }
 
 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];
@@ -1271,4 +1290,3 @@
    
 	return (0);
 }
-

==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_proto.h#18 (text+ko) ====

@@ -344,6 +344,9 @@
 struct linux_uname_args {
 	register_t dummy;
 };
+struct linux_iopl_args {
+	char level_l_[PADL_(l_ulong)]; l_ulong level; char level_r_[PADR_(l_ulong)];
+};
 struct linux_vhangup_args {
 	register_t dummy;
 };
@@ -1032,6 +1035,7 @@
 int	linux_newlstat(struct thread *, struct linux_newlstat_args *);
 int	linux_newfstat(struct thread *, struct linux_newfstat_args *);
 int	linux_uname(struct thread *, struct linux_uname_args *);
+int	linux_iopl(struct thread *, struct linux_iopl_args *);
 int	linux_vhangup(struct thread *, struct linux_vhangup_args *);
 int	linux_wait4(struct thread *, struct linux_wait4_args *);
 int	linux_swapoff(struct thread *, struct linux_swapoff_args *);
@@ -1284,6 +1288,7 @@
 #define	LINUX_SYS_AUE_linux_newlstat	AUE_LSTAT
 #define	LINUX_SYS_AUE_linux_newfstat	AUE_FSTAT
 #define	LINUX_SYS_AUE_linux_uname	AUE_NULL
+#define	LINUX_SYS_AUE_linux_iopl	AUE_NULL
 #define	LINUX_SYS_AUE_linux_vhangup	AUE_NULL
 #define	LINUX_SYS_AUE_linux_wait4	AUE_WAIT4
 #define	LINUX_SYS_AUE_linux_swapoff	AUE_SWAPOFF

==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_syscall.h#18 (text+ko) ====

@@ -103,6 +103,7 @@
 #define	LINUX_SYS_linux_newlstat	107
 #define	LINUX_SYS_linux_newfstat	108
 #define	LINUX_SYS_linux_uname	109
+#define	LINUX_SYS_linux_iopl	110
 #define	LINUX_SYS_linux_vhangup	111
 #define	LINUX_SYS_linux_wait4	114
 #define	LINUX_SYS_linux_swapoff	115

==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysent.c#17 (text+ko) ====


==== //depot/projects/linuxolator/src/sys/amd64/linux32/syscalls.master#17 (text+ko) ====

@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701162346.l0GNkSOi063600>