Loading...
Note: File does not exist in v4.6.
1#!/usr/bin/perl -w
2#
3# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
4#
5
6($in, $out) = @ARGV;
7
8open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";
9open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
10
11print OUT "#include <asm/cpufeature.h>\n\n";
12print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
13
14%features = ();
15$err = 0;
16
17while (defined($line = <IN>)) {
18 if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
19 $macro = $1;
20 $feature = "\L$2";
21 $tail = $3;
22 if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
23 $feature = "\L$1";
24 }
25
26 next if ($feature eq '');
27
28 if ($features{$feature}++) {
29 print STDERR "$in: duplicate feature name: $feature\n";
30 $err++;
31 }
32 printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature;
33 }
34}
35print OUT "};\n";
36
37close(IN);
38close(OUT);
39
40if ($err) {
41 unlink($out);
42 exit(1);
43}
44
45exit(0);