From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSYk0-0004aM-JH for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:51:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSYjz-0004Xe-3F for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:51:24 -0400 Received: from [199.232.76.173] (port=46556 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSYjy-0004XS-R7 for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:51:22 -0400 Received: from mail.codesourcery.com ([65.74.133.4]:39208) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KSYjy-0006s1-8L for qemu-devel@nongnu.org; Mon, 11 Aug 2008 10:51:22 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH 1/3] [x86] Clean up vendor identification Date: Mon, 11 Aug 2008 15:51:15 +0100 References: <48A01658.6030308@suse.de> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808111551.16227.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Carlos A. M. dos Santos" > >> #define CPUID_VENDOR_INTEL_1 'Genu' > >> ... > > > > Is that a real improvement? It won't make the code faster and the > > readability doesn't improve that much either. > > I'd take it as a security improvement. One can easily commit a typo > when editting magic numbers, either decimal or hexa. I don't believe this argument at all. A bug is a bug, it's got nothing to do with "security". If anything the hex values are more reliable because you don't have to guess how the string is converted to an integer - this is proved by the fact that the above suggestion is incorrect[1]. The hex values are given in the cpu reference docs, so there shouldn't be any doubt whether they are correct. [1] As someone else mentioned (though not very clearly) gcc interprets 'Genu' as a big-endian value, whereas the Intel docs define "Genu" as being little-endian. Paul