qemu-devel
[Top][All Lists]
Advanced

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

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


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: [PATCH 1/3] kvm-unit-tests: add x86 port io accessors
Date: Sun, 27 Feb 2011 17:32:45 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7

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<address@hidden>

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]