Re: [Qemu-devel] Re: [PATCH 1/3] kvm-unit-tests: add x86 port io accessors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/27/2011 04:01 PM, Anthony Liguori wrote:
On 02/27/2011 06:44 AM, Avi Kivity wrote:
On 02/24/2011 11:48 PM, Anthony Liguori wrote:
Signed-off-by: Anthony Liguori<aliguori@xxxxxxxxxx>

diff --git a/lib/x86/io.h b/lib/x86/io.h
new file mode 100644
index 0000000..bd6341c
--- /dev/null
+++ b/lib/x86/io.h
@@ -0,0 +1,40 @@
+#ifndef IO_H
+#define IO_H
+
+static inline unsigned char inb(unsigned short port)
+{
+    unsigned char value;
+    asm volatile("inb %w1, %0" : "=a" (value) : "Nd" (port));
+    return value;
+}

Are those %[wb] really needed? gcc should do the right thing based on the argument type.

It's just a little extra type safety.

Yeah, but those constraints aren't really documented. Linux does use them in a handful of places so they're unlikely to go away though.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux