3 # Generate the x86_cap_flags[] array from include/asm/cpufeature.h
9 TABS
="$(printf '\t\t\t\t\t')"
13 echo "#ifndef _ASM_X86_CPUFEATURE_H"
14 echo "#include <asm/cpufeature.h>"
17 echo "const char * const x86_cap_flags[NCAPINTS*32] = {"
19 # Iterate through any input lines starting with #define X86_FEATURE_
20 sed -n -e 's/\t/ /g' -e 's/^ *# *define *X86_FEATURE_//p' $IN |
23 # Name is everything up to the first whitespace
24 NAME
="$(echo "$i" | sed 's/ .*//')"
26 # If the /* comment */ starts with a quote string, grab that.
27 VALUE
="$(echo "$i" | sed -n 's@.*/\* *\("[^
"]*"\
).
*\
*/@\
1@p
')"
28 [ -z "$VALUE" ] && VALUE="\"$NAME\""
29 [ "$VALUE" == '""' ] && continue
31 # Name is uppercase, VALUE is all lowercase
32 VALUE="$(echo "$VALUE" | tr A-Z a-z)"
34 TABCOUNT=$(( ( 5*8 - 14 - $(echo "$NAME" | wc -c) ) / 8 ))
35 printf "\t[%s]%.*s = %s,\n" \
36 "X86_FEATURE_$NAME" "$TABCOUNT" "$TABS" "$VALUE"