]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf unwind-libunwind: Make libunwind register reading cross platform
authorIan Rogers <irogers@google.com>
Wed, 13 May 2026 23:31:48 +0000 (16:31 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 15 May 2026 19:18:36 +0000 (16:18 -0300)
commitfdf08e4b5a33e840b6c2a988cd4392b4443ca51b
tree7d048d5d4d5fe41347839a15fe75d0b1fb06e316
parent444508cd7c7b4f052553af204cc73d5ac4d19901
perf unwind-libunwind: Make libunwind register reading cross platform

Move the libunwind register to perf register mapping functions in
arch/../util/unwind-libunwind.c into a new libunwind-arch
directory. Rename the functions to
__get_perf_regnum_for_unw_regnum_<arch>. Add untested ppc32 and s390
functions. Add a get_perf_regnum_for_unw_regnum function that takes an
ELF machine as well as a register number and chooses the appropriate
architecture implementation.

Split the x86 and powerpc 32 and 64-bit implementations apart so that
a single libunwind-<arch>.h header is included.

Move the e_machine into the unwind_info struct to make it easier to
pass.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andrew Jones <andrew.jones@oss.qualcomm.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Tomas Glozar <tglozar@redhat.com>
Cc: Will Deacon <will@kernel.org>
[ Map UNW_PPC32_NIP to PERF_REG_POWERPC_NIP like done for 64-bit, pointed out by a local sashiko ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
30 files changed:
tools/perf/arch/arm/util/Build
tools/perf/arch/arm/util/unwind-libunwind.c [deleted file]
tools/perf/arch/arm64/util/Build
tools/perf/arch/arm64/util/unwind-libunwind.c [deleted file]
tools/perf/arch/loongarch/util/Build
tools/perf/arch/loongarch/util/unwind-libunwind.c [deleted file]
tools/perf/arch/mips/Build [deleted file]
tools/perf/arch/mips/util/Build [deleted file]
tools/perf/arch/mips/util/unwind-libunwind.c [deleted file]
tools/perf/arch/powerpc/util/Build
tools/perf/arch/powerpc/util/unwind-libunwind.c [deleted file]
tools/perf/arch/x86/util/Build
tools/perf/arch/x86/util/unwind-libunwind.c [deleted file]
tools/perf/util/Build
tools/perf/util/libunwind-arch/Build [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-arch.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-arch.h [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-arm.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-arm64.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-i386.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-loongarch.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-mips.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-ppc32.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-ppc64.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-s390.c [new file with mode: 0644]
tools/perf/util/libunwind-arch/libunwind-x86_64.c [new file with mode: 0644]
tools/perf/util/libunwind/arm64.c
tools/perf/util/libunwind/x86_32.c
tools/perf/util/unwind-libunwind-local.c
tools/perf/util/unwind.h