From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] Re: [PATCH 1/3] kvm-unit-tests: add x86 port io accessors Date: Sun, 27 Feb 2011 08:01:47 -0600 Message-ID: <4D6A594B.5000603@codemonkey.ws> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mail-yx0-f174.google.com ([209.85.213.174]:38027 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845Ab1B0OBt (ORCPT ); Sun, 27 Feb 2011 09:01:49 -0500 Received: by yxs7 with SMTP id 7so1254079yxs.19 for ; Sun, 27 Feb 2011 06:01:49 -0800 (PST) In-Reply-To: <4D6A471D.9050802@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. > > Might as well put all of that into processor.h. Seems reasonable. Regards, Anthony Liguori