patch-2.2.18 linux/arch/arm/kernel/ioport.c

Next file: linux/arch/arm/kernel/irq.c
Previous file: linux/arch/arm/kernel/iic.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/arm/kernel/ioport.c linux/arch/arm/kernel/ioport.c
@@ -1,29 +1,36 @@
 /*
  * linux/arch/arm/kernel/ioport.c
  *
- * Io-port support is not used for ARM
+ * IO permission support for ARM.
  */
 
+#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
+#include <linux/mm.h>
 
-/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
-/*asmlinkage void set_bitmap(unsigned long *bitmap, short base, short extent, int new_value)
-{
-}*/
+#include <asm/pgtable.h>
+#include <asm/uaccess.h>
 
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+#ifdef CONFIG_CPU_32
+asmlinkage int sys_iopl(unsigned long turn_on)
 {
-	return -ENOSYS;
-}
+	if (turn_on && !capable(CAP_SYS_RAWIO))
+		return -EPERM;
 
-asmlinkage int sys_iopl(long ebx,long ecx,long edx,
-	     long esi, long edi, long ebp, long eax, long ds,
-	     long es, long fs, long gs, long orig_eax,
-	     long eip,long cs,long eflags,long esp,long ss)
+	/*
+	 * We only support an on_off approach
+	 */
+	modify_domain(DOMAIN_IO, turn_on ? DOMAIN_MANAGER : DOMAIN_CLIENT);
+
+	return 0;
+}
+#else
+asmlinkage int sys_iopl(unsigned long turn_on)
 {
 	return -ENOSYS;
 }
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)