On Thu, Oct 17, 2013 at 01:02:17PM +0200, Paolo Bonzini wrote: > 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@xxxxxxxxxx> Yea, you can add Reviewed-by: Michael S. Tsirkin <mst@xxxxxxxxxx> too. But maybe we can add %k constraints like Paolo said? Being extra careful ... > Paolo -- 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