Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / arch / mips / util / unwind-libunwind.c
blob0d8c99c29da61849e5c0df6a3816c68fff120913
1 // SPDX-License-Identifier: GPL-2.0
3 #include <errno.h>
4 #include <libunwind.h>
5 #include "perf_regs.h"
6 #include "../../util/unwind.h"
7 #include "util/debug.h"
9 int libunwind__arch_reg_id(int regnum)
11 switch (regnum) {
12 case UNW_MIPS_R1 ... UNW_MIPS_R25:
13 return regnum - UNW_MIPS_R1 + PERF_REG_MIPS_R1;
14 case UNW_MIPS_R28 ... UNW_MIPS_R31:
15 return regnum - UNW_MIPS_R28 + PERF_REG_MIPS_R28;
16 case UNW_MIPS_PC:
17 return PERF_REG_MIPS_PC;
18 default:
19 pr_err("unwind: invalid reg id %d\n", regnum);
20 return -EINVAL;