X86_64_IOPL(2) System Calls Manual (x86_64) X86_64_IOPL(2)

x86_64_iopl
change the x86_64 I/O privilege level

x86_64 Architecture Library (libx86_64, -lx86_64)

#include <sys/types.h>
#include <machine/sysarch.h>

int
x86_64_iopl(int iopl);

x86_64_iopl() sets the x86_64 I/O privilege level to the value specified by iopl. This call is restricted to the super-user.

Upon successful completion, x86_64_iopl() returns 0. Otherwise, a value of -1 is returned and the global variable errno is set to indicate the error.

x86_64_iopl() will fail if:
[]
The caller was not the super-user, or the operation was not permitted at the current security level.

You can really hose your machine if you enable user-level I/O and write to hardware ports without care.
July 3, 2002 NetBSD 9.2