diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-08-27 17:56:44 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-08-27 19:23:22 -0700 |
commit | 7414aa41a63348c3bc72d8c37b716024c29b6d50 (patch) | |
tree | 8af23e3dbc48f8c4b3ae85bcaafcff0db39eaa11 /arch/x86/kernel/cpu/mkcapflags.pl | |
parent | b30a72a7edfc64c8929104d5c2178aca489aa559 (diff) | |
download | blackbird-op-linux-7414aa41a63348c3bc72d8c37b716024c29b6d50.tar.gz blackbird-op-linux-7414aa41a63348c3bc72d8c37b716024c29b6d50.zip |
x86: generate names for /proc/cpuinfo from <asm/cpufeature.h>
We have had a number of cases where <asm/cpufeature.h> (and its
predecessors) have diverged substantially from the names list in
/proc/cpuinfo. This patch generates the latter from the former.
It retains the option for explicitly overriding the strings, but by
making that require a separate action it should at least be less
likely to happen.
It would be good to do a future pass and rename strings that are
gratuituously different in the kernel (/proc/cpuinfo is a userspace
interface and must remain constant.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/cpu/mkcapflags.pl')
-rw-r--r-- | arch/x86/kernel/cpu/mkcapflags.pl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl new file mode 100644 index 000000000000..dfea390e1608 --- /dev/null +++ b/arch/x86/kernel/cpu/mkcapflags.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h +# + +($in, $out) = @ARGV; + +open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n"; +open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; + +print OUT "#include <asm/cpufeature.h>\n\n"; +print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; + +while (defined($line = <IN>)) { + if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { + $macro = $1; + $feature = $2; + $tail = $3; + if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { + $feature = $1; + } + + if ($feature ne '') { + printf OUT "\t%-32s = \"%s\",\n", + "[$macro]", "\L$feature"; + } + } +} +print OUT "};\n"; + +close(IN); +close(OUT); |