summaryrefslogtreecommitdiff
path: root/arch/x32/bits/io.h
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2014-01-07 22:43:34 +0100
committerrofl0r <retnyg@gmx.net>2014-02-23 11:07:18 +0100
commit323272db175204b951f119dae4bd99ef05e20f13 (patch)
tree70329156d5189294b1e9e7f9c7c326924ad62e35 /arch/x32/bits/io.h
parent0f169cbb79c39a5b15f7a27d9283cdeb6e122b8f (diff)
downloadmusl-323272db175204b951f119dae4bd99ef05e20f13.tar.gz
import vanilla x86_64 code as x32
Diffstat (limited to 'arch/x32/bits/io.h')
-rw-r--r--arch/x32/bits/io.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/x32/bits/io.h b/arch/x32/bits/io.h
new file mode 100644
index 00000000..dd5bddc9
--- /dev/null
+++ b/arch/x32/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+ __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+ __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+ __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+ unsigned char __val;
+ __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+ unsigned short __val;
+ __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+ unsigned int __val;
+ __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsb"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsw"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsl"
+ : "+S" (__buf), "+c"(__n)
+ : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insb"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insw"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insl"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}