0001
0002
0003
0004 if [ $
0005 [ $
0006 asm_header_dir=tools/include/uapi/asm-generic
0007 arch_header_dir=tools/arch/${hostarch}/include/uapi/asm
0008 else
0009 asm_header_dir=$1
0010 arch_header_dir=$2
0011 fi
0012
0013 common_mman=${asm_header_dir}/mman-common.h
0014 arch_mman=${arch_header_dir}/mman.h
0015
0016 prefix="PROT"
0017
0018 printf "static const char *mmap_prot[] = {\n"
0019 regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+%s_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' ${prefix}`
0020 ([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+.*uapi/asm-generic/mman.*' ${arch_mman}) &&
0021 (egrep $regex ${common_mman} | \
0022 egrep -vw PROT_NONE | \
0023 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
0024 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n")
0025 [ -f ${arch_mman} ] && egrep -q $regex ${arch_mman} &&
0026 (egrep $regex ${arch_mman} | \
0027 egrep -vw PROT_NONE | \
0028 sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
0029 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef ${prefix}_%s\n#define ${prefix}_%s %s\n#endif\n")
0030 printf "};\n"