debuggers.hg

view xenolinux-2.4.21-sparse/arch/xeno/kernel/ioport.c @ 672:2e36bfa1978c

bitkeeper revision 1.353 (3f13c7d5NDWHAyq2VYrx7Mqs7QYIfQ)

vga.h, keyboard.h, setup.c, ioport.c:
Cleanups.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jul 15 09:22:29 2003 +0000 (2003-07-15)
parents 6879a4610638
children 1e118e51c91f
line source
1 #include <linux/sched.h>
2 #include <linux/kernel.h>
3 #include <linux/errno.h>
4 #include <linux/types.h>
5 #include <linux/stddef.h>
6 #include <asm/hypervisor-ifs/dom0_ops.h>
9 asmlinkage int sys_iopl(unsigned int new_io_pl)
10 {
11 unsigned int old_io_pl = current->thread.io_pl;
12 dom0_op_t op;
14 if ( !(start_info.flags & SIF_PRIVILEGED) )
15 return -EPERM;
17 if ( new_io_pl > 3 )
18 return -EINVAL;
20 /* Need "raw I/O" privileges for direct port access. */
21 if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
22 return -EPERM;
24 /* Maintain OS privileges even if user attempts to relinquish them. */
25 if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
26 new_io_pl = 1;
28 /* Change our version of the privilege levels. */
29 current->thread.io_pl = new_io_pl;
31 /* Force the change at ring 0. */
32 op.cmd = DOM0_IOPL;
33 op.u.iopl.domain = start_info.dom_id;
34 op.u.iopl.iopl = new_io_pl;
35 HYPERVISOR_dom0_op(&op);
37 return 0;
38 }
41 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
42 {
43 unsigned int new_io_pl = turn_on ? 3 : 0;
44 printk("ioperm not fully supported - set iopl to %d\n", new_io_pl);
45 return sys_iopl(new_io_pl);
46 }