Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / trace / beauty / x86_arch_prctl.sh
blob7372d3cab95904942449177357df16f161be9ea6
1 #!/bin/sh
2 # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
3 # SPDX-License-Identifier: LGPL-2.1
5 [ $# -eq 1 ] && x86_header_dir=$1 || x86_header_dir=tools/arch/x86/include/uapi/asm/
7 prctl_arch_header=${x86_header_dir}/prctl.h
9 print_range () {
10 local idx=$1
11 local prefix=$2
12 local first_entry=$3
14 printf "#define x86_arch_prctl_codes_%d_offset %s\n" $idx $first_entry
15 printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx
16 regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+ARCH_([[:alnum:]_]+)[[:space:]]+(%s[[:xdigit:]]+).*' ${prefix}`
17 fmt="\t[%#x - ${first_entry}]= \"%s\",\n"
18 egrep -q $regex ${prctl_arch_header} && \
19 (egrep $regex ${prctl_arch_header} | \
20 sed -r "s/$regex/\2 \1/g" | \
21 xargs printf "$fmt")
22 printf "};\n\n"
25 print_range 1 0x1 0x1001
26 print_range 2 0x2 0x2001