Received: from eggs.gnu.org ([208.118.235.92]:48423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlmAl-0000BZ-0E for qemu-devel@nongnu.org; Thu, 20 Dec 2012 14:52:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlmAj-000460-Qp for qemu-devel@nongnu.org; Thu, 20 Dec 2012 14:52:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlmAj-00045s-II for qemu-devel@nongnu.org; Thu, 20 Dec 2012 14:52:49 -0500 Date: Thu, 20 Dec 2012 17:54:18 -0200 From: Eduardo Habkost Message-ID: <20121220195418.GQ5334@otherpad.lan.raisama.net> References: <1355961767-3854-1-git-send-email-imammedo@redhat.com> <1355962573-6394-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1355962573-6394-1-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH 11/20] target-i386: add x86cpu_vendor_words2str() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, afaerber@suse.de On Thu, Dec 20, 2012 at 01:16:13AM +0100, Igor Mammedov wrote: > Make for() cycle reusable for the next patch > > Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost > --- > target-i386/cpu.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index a74d74b..06b991e 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -847,6 +847,18 @@ static x86_def_t builtin_x86_defs[] = { > }, > }; > > +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] = edx >> (8 * i); > + dst[i + 8] = ecx >> (8 * i); > + } > + dst[CPUID_VENDOR_SZ] = '\0'; > +} > + > #ifdef CONFIG_KVM > static int cpu_x86_fill_model_id(char *str) > { > @@ -1130,15 +1142,10 @@ static char *x86_cpuid_get_vendor(Object *obj, Error **errp) > X86CPU *cpu = X86_CPU(obj); > CPUX86State *env = &cpu->env; > char *value; > - int i; > > value = (char *)g_malloc(CPUID_VENDOR_SZ + 1); > - for (i = 0; i < 4; i++) { > - value[i ] = env->cpuid_vendor1 >> (8 * i); > - value[i + 4] = env->cpuid_vendor2 >> (8 * i); > - value[i + 8] = env->cpuid_vendor3 >> (8 * i); > - } > - value[CPUID_VENDOR_SZ] = '\0'; > + x86cpu_vendor_words2str(value, env->cpuid_vendor1, env->cpuid_vendor2, > + env->cpuid_vendor3); > return value; > } > > -- > 1.7.11.7 > > -- Eduardo