Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
0003 # SPDX-License-Identifier: LGPL-2.1
0004 
0005 [ $# -eq 1 ] && x86_header_dir=$1 || x86_header_dir=tools/arch/x86/include/uapi/asm/
0006 
0007 prctl_arch_header=${x86_header_dir}/prctl.h
0008 
0009 print_range () {
0010         local idx=$1
0011         local prefix=$2
0012         local first_entry=$3
0013 
0014         printf "#define x86_arch_prctl_codes_%d_offset %s\n" $idx $first_entry
0015         printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx
0016         regex=`printf '^[[:space:]]*#[[:space:]]*define[[:space:]]+ARCH_([[:alnum:]_]+)[[:space:]]+(%s[[:xdigit:]]+).*' ${prefix}`
0017         fmt="\t[%#x - ${first_entry}]= \"%s\",\n"
0018         egrep -q $regex ${prctl_arch_header} && \
0019         (egrep $regex ${prctl_arch_header} | \
0020                 sed -r "s/$regex/\2 \1/g"       | \
0021                 xargs printf "$fmt")
0022         printf "};\n\n"
0023 }
0024 
0025 print_range 1 0x1 0x1001
0026 print_range 2 0x2 0x2001