1outb(2) System Calls Manual outb(2)
2
3
4
6 outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl,
7 outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O
8
10 Standard C library (libc, -lc)
11
13 #include <sys/io.h>
14
15 unsigned char inb(unsigned short port);
16 unsigned char inb_p(unsigned short port);
17 unsigned short inw(unsigned short port);
18 unsigned short inw_p(unsigned short port);
19 unsigned int inl(unsigned short port);
20 unsigned int inl_p(unsigned short port);
21
22 void outb(unsigned char value, unsigned short port);
23 void outb_p(unsigned char value, unsigned short port);
24 void outw(unsigned short value, unsigned short port);
25 void outw_p(unsigned short value, unsigned short port);
26 void outl(unsigned int value, unsigned short port);
27 void outl_p(unsigned int value, unsigned short port);
28
29 void insb(unsigned short port, void addr[.count],
30 unsigned long count);
31 void insw(unsigned short port, void addr[.count],
32 unsigned long count);
33 void insl(unsigned short port, void addr[.count],
34 unsigned long count);
35 void outsb(unsigned short port, const void addr[.count],
36 unsigned long count);
37 void outsw(unsigned short port, const void addr[.count],
38 unsigned long count);
39 void outsl(unsigned short port, const void addr[.count],
40 unsigned long count);
41
43 This family of functions is used to do low-level port input and output.
44 The out* functions do port output, the in* functions do port input; the
45 b-suffix functions are byte-width and the w-suffix functions word-
46 width; the _p-suffix functions pause until the I/O completes.
47
48 They are primarily designed for internal kernel use, but can be used
49 from user space.
50
51 You must compile with -O or -O2 or similar. The functions are defined
52 as inline macros, and will not be substituted in without optimization
53 enabled, causing unresolved references at link time.
54
55 You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow
56 the user space application to access the I/O ports in question. Fail‐
57 ure to do this will cause the application to receive a segmentation
58 fault.
59
61 outb() and friends are hardware-specific. The value argument is passed
62 first and the port argument is passed second, which is the opposite or‐
63 der from most DOS implementations.
64
66 None.
67
69 ioperm(2), iopl(2)
70
71
72
73Linux man-pages 6.05 2023-03-30 outb(2)