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