OpenBSD Handbook Manuals
Search

amd64_iopl(2)

Canonical URL: /amd64_iopl.2/

AMD64_IOPL(2) System Calls Manual (amd64) AMD64_IOPL(2)

amd64_ioplchange the amd64 I/O privilege level

/* -lamd64 */
#include <sys/types.h>
#include <machine/sysarch.h>

int
amd64_iopl(int iopl);

() sets the amd64 I/O privilege level to the value specified by iopl.

This call may only be made by the superuser. Additionally, it is only permitted when the securelevel(7) is less than or equal to 0 or the machdep.allowaperture sysctl has been set to a non-zero value.

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

amd64_iopl() will fail if:

[]
The caller was not the superuser, or the securelevel is greater than zero and machdep.allowaperture has not been set to a non-zero value.

securelevel(7)

Intel, AMD64 Microprocessor Programmer's Reference Manual.

You can really hose your machine if you enable user-level I/O and write to hardware ports without care.

OpenBSD 7.9 June 5, 2025 AMD64_IOPL(2)

Need conceptual guidance? Continue in the OpenBSD Handbook.