1static __inline void outb(unsigned char __val, unsigned short __port) {
2    __asm__ volatile("outb %0,%1"
3                     :
4                     : "a"(__val), "dN"(__port));
5}
6
7static __inline void outw(unsigned short __val, unsigned short __port) {
8    __asm__ volatile("outw %0,%1"
9                     :
10                     : "a"(__val), "dN"(__port));
11}
12
13static __inline void outl(unsigned int __val, unsigned short __port) {
14    __asm__ volatile("outl %0,%1"
15                     :
16                     : "a"(__val), "dN"(__port));
17}
18
19static __inline unsigned char inb(unsigned short __port) {
20    unsigned char __val;
21    __asm__ volatile("inb %1,%0"
22                     : "=a"(__val)
23                     : "dN"(__port));
24    return __val;
25}
26
27static __inline unsigned short inw(unsigned short __port) {
28    unsigned short __val;
29    __asm__ volatile("inw %1,%0"
30                     : "=a"(__val)
31                     : "dN"(__port));
32    return __val;
33}
34
35static __inline unsigned int inl(unsigned short __port) {
36    unsigned int __val;
37    __asm__ volatile("inl %1,%0"
38                     : "=a"(__val)
39                     : "dN"(__port));
40    return __val;
41}
42
43static __inline void outsb(unsigned short __port, const void* __buf, unsigned long __n) {
44    __asm__ volatile("cld; rep; outsb"
45                     : "+S"(__buf), "+c"(__n)
46                     : "d"(__port));
47}
48
49static __inline void outsw(unsigned short __port, const void* __buf, unsigned long __n) {
50    __asm__ volatile("cld; rep; outsw"
51                     : "+S"(__buf), "+c"(__n)
52                     : "d"(__port));
53}
54
55static __inline void outsl(unsigned short __port, const void* __buf, unsigned long __n) {
56    __asm__ volatile("cld; rep; outsl"
57                     : "+S"(__buf), "+c"(__n)
58                     : "d"(__port));
59}
60
61static __inline void insb(unsigned short __port, void* __buf, unsigned long __n) {
62    __asm__ volatile("cld; rep; insb"
63                     : "+D"(__buf), "+c"(__n)
64                     : "d"(__port));
65}
66
67static __inline void insw(unsigned short __port, void* __buf, unsigned long __n) {
68    __asm__ volatile("cld; rep; insw"
69                     : "+D"(__buf), "+c"(__n)
70                     : "d"(__port));
71}
72
73static __inline void insl(unsigned short __port, void* __buf, unsigned long __n) {
74    __asm__ volatile("cld; rep; insl"
75                     : "+D"(__buf), "+c"(__n)
76                     : "d"(__port));
77}
78