Path: blob/master/arch/x86/kernel/cpu/mkcapflags.pl
10699 views
#!/usr/bin/perl1#2# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h3#45($in, $out) = @ARGV;67open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";8open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";910print OUT "#include <asm/cpufeature.h>\n\n";11print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";1213while (defined($line = <IN>)) {14if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {15$macro = $1;16$feature = $2;17$tail = $3;18if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {19$feature = $1;20}2122if ($feature ne '') {23printf OUT "\t%-32s = \"%s\",\n",24"[$macro]", "\L$feature";25}26}27}28print OUT "};\n";2930close(IN);31close(OUT);323334