Dan Mick wrote:
> Darren J Moffat wrote:
>> sreenatha wrote:
>>> Hi all,
>>> I am porting linux application to Solaris 10.
>>> Here I am facing the problem to find an equivalent of iopl() (Inpu / 
>>> output privilage) function of Linux to Solaris 10.
>> Why does the application use iopl() on Linux ?  What does it actually 
>> do?  I've read the Linux man page and I can't quite understand what it 
>> does but I think the closest Solaris equivalent might be running with 
>> the sys_devices privilege [ see privileges(5) ].
> 
> There is an undocumented system call that gives IO privileges, which is 
> probably what iopl() does.   As such, you're on your own if you use it, but 
> search the source for V86SC_IOPL.

Right - it was added for X servers to use, and the Xorg code on Solaris
calls that in the same place it calls iopl() on Linux.   I still wonder
if anything should ever be calling that (and I know if we could ever make
X run without it, the security guys would be eager to remove that call as
soon as possible, as it's mere existence is a well-known security issue,
but one we've accepted living with for now).

xf86EnableIO() on Solaris/x86:

 if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
        xf86Msg(X_WARNING,"xf86EnableIOPorts: Failed to set IOPL for I/O\n");
        return FALSE;
 }

xf86EnableIO() on Linux/x86:

        if (ioperm(0, 1024, 1) || iopl(3)) {
                if (errno == ENODEV)
                        ErrorF("xf86EnableIOPorts: no I/O ports found\n");
                else
                      FatalError("xf86EnableIOPorts: failed to set IOPL"
                                 " for I/O (%s)\n", strerror(errno));
                return FALSE;
        }

-- 
        -Alan Coopersmith-           [EMAIL PROTECTED]
         Sun Microsystems, Inc. - X Window System Engineering
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to