[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-w0fux1psivphhx6rve8kn3vq@git.kernel.org>
Date: Thu, 20 Dec 2018 10:27:13 -0800
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: lclaudio@...hat.com, hpa@...or.com, adrian.hunter@...el.com,
jolsa@...nel.org, tglx@...utronix.de, mingo@...nel.org,
namhyung@...nel.org, wangnan0@...wei.com,
linux-kernel@...r.kernel.org, acme@...hat.com
Subject: [tip:perf/core] perf beauty: Add a string table generator for x86's
'arch_prctl' codes
Commit-ID: ff4cb769bc2dcc9a74a1c29e403bcfaf789365ef
Gitweb: https://git.kernel.org/tip/ff4cb769bc2dcc9a74a1c29e403bcfaf789365ef
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Mon, 17 Dec 2018 16:11:37 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 18 Dec 2018 16:15:18 -0300
perf beauty: Add a string table generator for x86's 'arch_prctl' codes
$ tools/perf/trace/beauty/x86_arch_prctl.sh
#define x86_arch_prctl_codes_1_offset 0x1001
static const char *x86_arch_prctl_codes_1[] = {
[0x1001 - 0x1001]= "SET_GS",
[0x1002 - 0x1001]= "SET_FS",
[0x1003 - 0x1001]= "GET_FS",
[0x1004 - 0x1001]= "GET_GS",
[0x1011 - 0x1001]= "GET_CPUID",
[0x1012 - 0x1001]= "SET_CPUID",
};
#define x86_arch_prctl_codes_2_offset 0x2001
static const char *x86_arch_prctl_codes_2[] = {
[0x2001 - 0x2001]= "MAP_VDSO_X32",
[0x2002 - 0x2001]= "MAP_VDSO_32",
[0x2003 - 0x2001]= "MAP_VDSO_64",
};
$
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: https://lkml.kernel.org/n/tip-w0fux1psivphhx6rve8kn3vq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/trace/beauty/x86_arch_prctl.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tools/perf/trace/beauty/x86_arch_prctl.sh b/tools/perf/trace/beauty/x86_arch_prctl.sh
new file mode 100755
index 000000000000..7372d3cab959
--- /dev/null
+++ b/tools/perf/trace/beauty/x86_arch_prctl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@...hat.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
+
+print_range () {
+ local idx=$1
+ local prefix=$2
+ local first_entry=$3
+
+ 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" | \
+ xargs printf "$fmt")
+ printf "};\n\n"
+}
+
+print_range 1 0x1 0x1001
+print_range 2 0x2 0x2001
Powered by blists - more mailing lists