/* Here we just change the flags value on the stack: we allow only the super-user to do it. This depends on the stack-layout on system-call entry - see also fork() and the signal handling code.  */
long sys_iopl(unsigned int level, struct pt_regs *regs)
/* Here we just change the flags value on the stack: we allow only the super-user to do it. This depends on the stack-layout on system-call entry - see also fork() and the signal handling code.  */
long sys_iopl(unsigned int level, struct pt_regs *regs)
{
	unsigned int old = (regs->flags >> 12) & 3;
	struct thread_struct *t = &current->thread;
	if (level > 3)
		return -EINVAL;
	if (level > old) {
		if (!capable(CAP_SYS_RAWIO))
			return -EPERM;
	}
	regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
	t->iopl = level << 12;
	set_iopl_mask(t->iopl);
	return 0;
}