| # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> |
| # SPDX-License-Identifier: LGPL-2.1 |
| [ $# -eq 1 ] && x86_header_dir=$1 || x86_header_dir=tools/arch/x86/include/uapi/asm/ |
| prctl_arch_header=${x86_header_dir}/prctl.h |
| printf "#define x86_arch_prctl_codes_%d_offset %s\n" $idx $first_entry |
| printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx |
| regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+ARCH_([[:alnum:]_]+)[[:space:]]+(%s[[:xdigit:]]+).*' ${prefix}` |
| fmt="\t[%#x - ${first_entry}]= \"%s\",\n" |
| egrep -q $regex ${prctl_arch_header} && \ |
| (egrep $regex ${prctl_arch_header} | \ |
| sed -r "s/$regex/\2 \1/g" | \ |