All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] kvm-unittest: fix build with gcc 4.3.X and older
Date: Thu, 17 Oct 2013 13:02:17 +0200	[thread overview]
Message-ID: <525FC3B9.5060807@redhat.com> (raw)
In-Reply-To: <20131017105807.GA26798@redhat.com>

Il 17/10/2013 12:58, Gleb Natapov ha scritto:
>>> > > @@ -143,14 +143,14 @@ static inline int rtc_in(u8 reg)
>>> > >  {
>>> > >      u8 x = reg;
>>> > >      asm volatile("outb %b1, $0x70; inb $0x71, %b0"
>>> > > -		 : "+a"(x) : "0"(x));
>>> > > +		 : "=a"(x) : "0"(x));
>>> > >      return x;
>>> > >  }
>> > 
>> > This should be wrong.  GCC should complain that the same operand is used
>> > for both input and output but has an "=" constraint.
>> > 
>>> > >  static inline void rtc_out(u8 reg, u8 val)
>>> > >  {
>>> > >      asm volatile("outb %b1, $0x70; mov %b2, %b1; outb %b1, $0x71"
>>> > > -		 : "+a"(reg) : "0"(reg), "ri"(val));
>>> > > +		 : "=a"(reg) : "0"(reg), "ri"(val));
>>> > >  }
>> > 
>> > Same here.
>> > 
>> > But I'm not sure what is the error message for older GCC for s3.c, as I
>> > wrote in reply to Michael.
>> > 
> x86/s3.c: In function 'main':
> x86/s3.c:145: error: inconsistent operand constraints in an 'asm'
> 
> And I am puzzled by this too.

Hmm, looks like my version is the incorrect one and, if you use "+a" you
need not use the matching input constraint.  So it's either your
version, or one that removes the "0" altogether.

Thus,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] kvm-unittest: fix build with gcc 4.3.X and older
Date: Thu, 17 Oct 2013 13:02:17 +0200	[thread overview]
Message-ID: <525FC3B9.5060807@redhat.com> (raw)
In-Reply-To: <20131017105807.GA26798@redhat.com>

Il 17/10/2013 12:58, Gleb Natapov ha scritto:
>>> > > @@ -143,14 +143,14 @@ static inline int rtc_in(u8 reg)
>>> > >  {
>>> > >      u8 x = reg;
>>> > >      asm volatile("outb %b1, $0x70; inb $0x71, %b0"
>>> > > -		 : "+a"(x) : "0"(x));
>>> > > +		 : "=a"(x) : "0"(x));
>>> > >      return x;
>>> > >  }
>> > 
>> > This should be wrong.  GCC should complain that the same operand is used
>> > for both input and output but has an "=" constraint.
>> > 
>>> > >  static inline void rtc_out(u8 reg, u8 val)
>>> > >  {
>>> > >      asm volatile("outb %b1, $0x70; mov %b2, %b1; outb %b1, $0x71"
>>> > > -		 : "+a"(reg) : "0"(reg), "ri"(val));
>>> > > +		 : "=a"(reg) : "0"(reg), "ri"(val));
>>> > >  }
>> > 
>> > Same here.
>> > 
>> > But I'm not sure what is the error message for older GCC for s3.c, as I
>> > wrote in reply to Michael.
>> > 
> x86/s3.c: In function 'main':
> x86/s3.c:145: error: inconsistent operand constraints in an 'asm'
> 
> And I am puzzled by this too.

Hmm, looks like my version is the incorrect one and, if you use "+a" you
need not use the matching input constraint.  So it's either your
version, or one that removes the "0" altogether.

Thus,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

  reply	other threads:[~2013-10-17 11:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 19:46 [PATCH] kvm-unittest: fix build with gcc 4.3.X and older Michael S. Tsirkin
2013-10-16 19:46 ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17  6:27 ` Gleb Natapov
2013-10-17  6:27   ` [Qemu-devel] " Gleb Natapov
2013-10-17  8:12   ` Michael S. Tsirkin
2013-10-17  8:12     ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17  8:20     ` Gleb Natapov
2013-10-17  8:20       ` [Qemu-devel] " Gleb Natapov
2013-10-17  8:27       ` Michael S. Tsirkin
2013-10-17  8:27         ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17  8:34         ` Gleb Natapov
2013-10-17  8:34           ` [Qemu-devel] " Gleb Natapov
2013-10-17  9:28           ` Michael S. Tsirkin
2013-10-17  9:28             ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17  9:33             ` Gleb Natapov
2013-10-17  9:33               ` [Qemu-devel] " Gleb Natapov
2013-10-17  9:44               ` Michael S. Tsirkin
2013-10-17  9:44                 ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17  9:43                 ` Gleb Natapov
2013-10-17  9:43                   ` [Qemu-devel] " Gleb Natapov
2013-10-17 10:55   ` Paolo Bonzini
2013-10-17 10:55     ` [Qemu-devel] " Paolo Bonzini
2013-10-17 10:58     ` Gleb Natapov
2013-10-17 10:58       ` [Qemu-devel] " Gleb Natapov
2013-10-17 11:02       ` Paolo Bonzini [this message]
2013-10-17 11:02         ` Paolo Bonzini
2013-10-17 11:31         ` Michael S. Tsirkin
2013-10-17 11:31           ` [Qemu-devel] " Michael S. Tsirkin
2013-10-17 10:53 ` Paolo Bonzini
2013-10-17 10:53   ` [Qemu-devel] " Paolo Bonzini
2013-10-17 11:29   ` Michael S. Tsirkin
2013-10-17 11:29     ` [Qemu-devel] " Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=525FC3B9.5060807@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.