Received: from eggs.gnu.org ([208.118.235.92]:46525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1g6C-0000Ot-RI for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:05:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1g67-0001NS-Po for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:05:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1g67-0001NF-IG for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:05:31 -0400 Date: Wed, 15 Aug 2012 13:06:31 -0300 From: Eduardo Habkost Message-ID: <20120815160631.GC4425@otherpad.lan.raisama.net> References: <1344597756-2890-1-git-send-email-imammedo@redhat.com> <1344597756-2890-16-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [RFC 15/20] target-i386: use define for cpuid vendor string size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Pandarathil, Vijaymohan R" Cc: "aliguori@us.ibm.com" , "stefanha@linux.vnet.ibm.com" , "gleb@redhat.com" , "jan.kiszka@siemens.com" , "mtosatti@redhat.com" , "qemu-devel@nongnu.org" , "mdroth@linux.vnet.ibm.com" , "blauwirbel@gmail.com" , "avi@redhat.com" , "pbonzini@redhat.com" , Igor Mammedov , "akong@redhat.com" , "lersek@redhat.com" , "afaerber@suse.de" On Wed, Aug 15, 2012 at 03:52:17PM +0000, Pandarathil, Vijaymohan R wrote: > Since you are introducing #define CPUID_VENDOR_SZ, you may as well want to introduce > > #define CPUID_VENDOR_OFF_1 0 > #define CPUID_VENDOR_OFF_2 4 > #define CPUID_VENDOR_OFF_3 8 > > and use them. > The vendor1/vendor2/vendor3 fields are eliminated on patch 16/20, so I don't see the need for that. > Regards > > Vijay > > > -----Original Message----- > From: qemu-devel-bounces+vijaymohan.pandarathil=hp.com@nongnu.org [mailto:qemu-devel-bounces+vijaymohan.pandarathil=hp.com@nongnu.org] On Behalf Of Igor Mammedov > Sent: Friday, August 10, 2012 4:23 AM > To: qemu-devel@nongnu.org > Cc: aliguori@us.ibm.com; stefanha@linux.vnet.ibm.com; gleb@redhat.com; jan.kiszka@siemens.com; mtosatti@redhat.com; mdroth@linux.vnet.ibm.com; blauwirbel@gmail.com; avi@redhat.com; pbonzini@redhat.com; akong@redhat.com; lersek@redhat.com; afaerber@suse.de; ehabkost@redhat.com > Subject: [Qemu-devel] [RFC 15/20] target-i386: use define for cpuid vendor string size > > Signed-off-by: Igor Mammedov > --- > target-i386/cpu.c | 6 +++--- > target-i386/cpu.h | 2 ++ > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index d3ce849..368360f 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -863,13 +863,13 @@ static char *x86_cpuid_get_vendor(Object *obj, Error **errp) > char *value; > int i; > > - value = (char *)g_malloc(12 + 1); > + 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[12] = '\0'; > + value[CPUID_VENDOR_SZ] = '\0'; > return value; > } > > @@ -880,7 +880,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, > CPUX86State *env = &cpu->env; > int i; > > - if (strlen(value) != 12) { > + if (strlen(value) != CPUID_VENDOR_SZ) { > error_set(errp, QERR_PROPERTY_VALUE_BAD, "", > "vendor", value); > return; > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > index 979682a..5c75704 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -440,6 +440,8 @@ > #define CPUID_SVM_PAUSEFILTER (1 << 10) > #define CPUID_SVM_PFTHRESHOLD (1 << 12) > > +#define CPUID_VENDOR_SZ 12 > + > #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ > #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ > #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */ > -- > 1.7.11.2 > > -- Eduardo