From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752785Ab2LPR5Z (ORCPT ); Sun, 16 Dec 2012 12:57:25 -0500 Received: from mail.skyhub.de ([78.46.96.112]:49994 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752081Ab2LPR5Y (ORCPT ); Sun, 16 Dec 2012 12:57:24 -0500 Date: Sun, 16 Dec 2012 18:57:22 +0100 From: Borislav Petkov To: Fenghua Yu Cc: H Peter Anvin , Ingo Molnar , Thomas Gleixner , Asit K Mallick , Tigran Aivazian , Andreas Herrmann , Borislav Petkov , Yinghai Lu , linux-kernel , x86 Subject: Re: [PATCH v3 04/10] x86/microcode_core_early.c: Define interfaces for early loading ucode Message-ID: <20121216175722.GA14678@liondog.tnic> Mail-Followup-To: Borislav Petkov , Fenghua Yu , H Peter Anvin , Ingo Molnar , Thomas Gleixner , Asit K Mallick , Tigran Aivazian , Andreas Herrmann , Borislav Petkov , Yinghai Lu , linux-kernel , x86 References: <1355654609-16800-1-git-send-email-fenghua.yu@intel.com> <1355654609-16800-5-git-send-email-fenghua.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1355654609-16800-5-git-send-email-fenghua.yu@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 16, 2012 at 02:43:23AM -0800, Fenghua Yu wrote: > +#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) << 24)) > +#define CPUID_INTEL1 QCHAR('G', 'e', 'n', 'u') > +#define CPUID_INTEL2 QCHAR('i', 'n', 'e', 'I') > +#define CPUID_INTEL3 QCHAR('n', 't', 'e', 'l') > +#define CPUID_AMD1 QCHAR('A', 'u', 't', 'h') > +#define CPUID_AMD2 QCHAR('e', 'n', 't', 'i') > +#define CPUID_AMD3 QCHAR('c', 'A', 'M', 'D') > + > +#define CPUID_IS(a, b, c) (!((ebx ^ (a))|(edx ^ (b))|(ecx ^ (c)))) What, this macro is relying on external variable names and doesn't have them as its own macro arguments? Why? This is really fragile and very much prone to errors. What's wrong with doing: #define CPUID_IS(a, b, c, ebx, ecx, edx) (!(((ebx) ^ (a))|((edx) ^ (b))|((ecx) ^ (c)))) ? -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. --