-/*
- * The IA64 maps 4 I/O ports for each 4K page
- */
-#define IOLEN ((65536 / 4) * 4096)
-
-asmlinkage long
-sys32_iopl (int level)
-{
- extern unsigned long ia64_iobase;
- int fd;
- struct file * file;
- unsigned int old;
- unsigned long addr;
- mm_segment_t old_fs = get_fs ();
-
- if (level != 3)
- return(-EINVAL);
- /* Trying to gain more privileges? */
- old = ia64_getreg(_IA64_REG_AR_EFLAG);
- if ((unsigned int) level > ((old >> 12) & 3)) {
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
- }
- set_fs(KERNEL_DS);
- fd = sys_open("/dev/mem", O_SYNC | O_RDWR, 0);
- set_fs(old_fs);
- if (fd < 0)
- return fd;
- file = fget(fd);
- if (file == NULL) {
- sys_close(fd);
- return(-EFAULT);
- }
-
- down_write(¤t->mm->mmap_sem);
- addr = do_mmap_pgoff(file, IA32_IOBASE,
- IOLEN, PROT_READ|PROT_WRITE, MAP_SHARED,
- (ia64_iobase & ~PAGE_OFFSET) >> PAGE_SHIFT);
- up_write(¤t->mm->mmap_sem);
-
- if (addr >= 0) {
- old = (old & ~0x3000) | (level << 12);
- ia64_setreg(_IA64_REG_AR_EFLAG, old);
- }
-
- fput(file);
- sys_close(fd);
- return 0;
-}
-
-asmlinkage long
-sys32_ioperm (unsigned int from, unsigned int num, int on)
-{
-
- /*
- * Since IA64 doesn't have permission bits we'd have to go to
- * a lot of trouble to simulate them in software. There's
- * no point, only trusted programs can make this call so we'll
- * just turn it into an iopl call and let the process have
- * access to all I/O ports.
- *
- * XXX proper ioperm() support should be emulated by
- * manipulating the page protections...
- */
- return sys32_iopl(3);
-}
-