From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrEA0-0003hI-De for qemu-devel@nongnu.org; Fri, 04 Jan 2013 15:46:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrE9z-0007eL-Aj for qemu-devel@nongnu.org; Fri, 04 Jan 2013 15:46:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrE9z-0007eC-2c for qemu-devel@nongnu.org; Fri, 04 Jan 2013 15:46:35 -0500 Date: Fri, 4 Jan 2013 21:46:30 +0100 From: Igor Mammedov Message-ID: <20130104214630.49900aed@thinkpad.mammed.net> In-Reply-To: <20130104200233.GT18372@otherpad.lan.raisama.net> References: <20130104155013.GS18372@otherpad.lan.raisama.net> <1357328244-4410-1-git-send-email-imammedo@redhat.com> <20130104200233.GT18372@otherpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/20 v3] target-i386: add x86cpu_vendor_words2str() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, afaerber@suse.de On Fri, 4 Jan 2013 18:02:33 -0200 Eduardo Habkost wrote: > On Fri, Jan 04, 2013 at 08:37:24PM +0100, Igor Mammedov wrote: > > Make for() cycle reusable for the next patch > > > > Signed-off-by: Igor Mammedov > > --- > > v3: > > fix/swap vendor2 and vendor3 order > > Spotted-By: Eduardo Habkost > > v2: > > place x86cpu_vendor_words2str() a bit earlier, before feature > > arrays to avoid compile error when vendor property is converted > > static property. > > --- > > target-i386/cpu.c | 21 ++++++++++++++------- > > 1 files changed, 14 insertions(+), 7 deletions(-) > > > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index d6e4e71..e26e631 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -45,6 +45,18 @@ > > #include "hw/apic_internal.h" > > #endif > > > > +static void x86cpu_vendor_words2str(char *dst, uint32_t ebx, uint32_t ecx, > > + uint32_t edx) > > +{ > > + int i; > > + for (i = 0; i < 4; i++) { > > + dst[i] = ebx >> (8 * i); > > + dst[i + 4] = ecx >> (8 * i); > > + dst[i + 8] = edx >> (8 * i); > > + } > > + dst[CPUID_VENDOR_SZ] = '\0'; > > +} > > Now the code seems to work as expected, but the parameter names are > misleading. String bytes 4-7 (vendor2) come from EDX on the CPUID > instruction, and bytes 8-11 (vendor3) come from ECX. Look at the > x86cpu_vendor_words2str() calls you added on patch 10/20. Perhaps naming params like this would be better: x86cpu_vendor_words2str(char *dst, uint32_t vendor1, uint32_t vendor2, uint32_t vendor3) > [...] > > > > -- > > 1.7.1 > > > > -- > Eduardo -- Regards, Igor