diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mkcapflags.pl')
-rw-r--r-- | arch/x86/kernel/cpu/mkcapflags.pl | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl index dfea390e1608..c7b3fe2d72e0 100644 --- a/arch/x86/kernel/cpu/mkcapflags.pl +++ b/arch/x86/kernel/cpu/mkcapflags.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl -w |
2 | # | 2 | # |
3 | # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h | 3 | # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h |
4 | # | 4 | # |
@@ -11,22 +11,35 @@ open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; | |||
11 | print OUT "#include <asm/cpufeature.h>\n\n"; | 11 | print OUT "#include <asm/cpufeature.h>\n\n"; |
12 | print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; | 12 | print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; |
13 | 13 | ||
14 | %features = (); | ||
15 | $err = 0; | ||
16 | |||
14 | while (defined($line = <IN>)) { | 17 | while (defined($line = <IN>)) { |
15 | if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { | 18 | if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { |
16 | $macro = $1; | 19 | $macro = $1; |
17 | $feature = $2; | 20 | $feature = "\L$2"; |
18 | $tail = $3; | 21 | $tail = $3; |
19 | if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { | 22 | if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { |
20 | $feature = $1; | 23 | $feature = "\L$1"; |
21 | } | 24 | } |
22 | 25 | ||
23 | if ($feature ne '') { | 26 | next if ($feature eq ''); |
24 | printf OUT "\t%-32s = \"%s\",\n", | 27 | |
25 | "[$macro]", "\L$feature"; | 28 | if ($features{$feature}++) { |
29 | print STDERR "$in: duplicate feature name: $feature\n"; | ||
30 | $err++; | ||
26 | } | 31 | } |
32 | printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature; | ||
27 | } | 33 | } |
28 | } | 34 | } |
29 | print OUT "};\n"; | 35 | print OUT "};\n"; |
30 | 36 | ||
31 | close(IN); | 37 | close(IN); |
32 | close(OUT); | 38 | close(OUT); |
39 | |||
40 | if ($err) { | ||
41 | unlink($out); | ||
42 | exit(1); | ||
43 | } | ||
44 | |||
45 | exit(0); | ||