mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-20 16:30:53 +00:00
7414aa41a6
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>
33 lines
700 B
Perl
33 lines
700 B
Perl
#!/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);
|