From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH unit-tests 06/16] Specify correct operand length for ltr and str. Date: Wed, 29 Dec 2010 11:43:13 +0200 Message-ID: <20101229094313.GB32688@redhat.com> References: <1293030389-1143-1-git-send-email-gleb@redhat.com> <1293030389-1143-7-git-send-email-gleb@redhat.com> <4D1B0176.60504@redhat.com> <20101229094015.GA32688@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33939 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837Ab0L2JnP (ORCPT ); Wed, 29 Dec 2010 04:43:15 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBT9hEf6009726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Dec 2010 04:43:15 -0500 Content-Disposition: inline In-Reply-To: <20101229094015.GA32688@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Dec 29, 2010 at 11:40:15AM +0200, Gleb Natapov wrote: > On Wed, Dec 29, 2010 at 11:37:58AM +0200, Avi Kivity wrote: > > On 12/22/2010 05:06 PM, Gleb Natapov wrote: > > >Signed-off-by: Gleb Natapov > > >--- > > > lib/x86/processor.h | 4 ++-- > > > 1 files changed, 2 insertions(+), 2 deletions(-) > > > > > >diff --git a/lib/x86/processor.h b/lib/x86/processor.h > > >index c348808..c3ab109 100644 > > >--- a/lib/x86/processor.h > > >+++ b/lib/x86/processor.h > > >@@ -193,13 +193,13 @@ static inline u16 sldt(void) > > > > > > static inline void ltr(unsigned val) > > > { > > >- asm volatile ("ltr %0" : : "rm"(val)); > > >+ asm volatile ("ltr %w0" : : "rm"(val)); > > > } > > > > Is this really needed? And isn't this done better by declaring 'u16 val'? > > > > > > > > static inline u16 str(void) > > > { > > > u16 val; > > >- asm volatile ("str %0" : "=rm"(val)); > > >+ asm volatile ("str %w0" : "=rm"(val)); > > > return val; > > > } > > > > > > > This looks completely unneeded, since val is already a u16. > > > IIRC I got errors from assembler. Will recheck. > You are correct. The error was only about ltr. Changing unsigned to u16 fixes it. -- Gleb.