From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37920 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ptic6-0003GV-QX for qemu-devel@nongnu.org; Sun, 27 Feb 2011 10:32:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ptic5-00061u-R3 for qemu-devel@nongnu.org; Sun, 27 Feb 2011 10:32:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ptic5-00061j-Ie for qemu-devel@nongnu.org; Sun, 27 Feb 2011 10:32:49 -0500 Message-ID: <4D6A6E9D.5080500@redhat.com> Date: Sun, 27 Feb 2011 17:32:45 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 1/3] kvm-unit-tests: add x86 port io accessors References: <1298584085-13129-1-git-send-email-aliguori@us.ibm.com> <1298584085-13129-2-git-send-email-aliguori@us.ibm.com> <4D6A471D.9050802@redhat.com> <4D6A594B.5000603@codemonkey.ws> In-Reply-To: <4D6A594B.5000603@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org 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 >>> >>> 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