lkml.org 
[lkml]   [2012]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 04/10] x86/microcode_core_early.c: Define interfaces for early loading ucode
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.
--


\
 
 \ /
  Last update: 2012-12-16 19:21    [W:0.439 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site