Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / perf / arch / powerpc / util / unwind-libunwind.c
blob90a6beda20ded73a4001e0862b5fbe228da4256c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright 2016 Chandan Kumar, IBM Corporation.
4 */
6 #include <errno.h>
7 #include <libunwind.h>
8 #include <asm/perf_regs.h>
9 #include "../../util/unwind.h"
10 #include "../../util/debug.h"
12 int libunwind__arch_reg_id(int regnum)
14 switch (regnum) {
15 case UNW_PPC64_R0:
16 return PERF_REG_POWERPC_R0;
17 case UNW_PPC64_R1:
18 return PERF_REG_POWERPC_R1;
19 case UNW_PPC64_R2:
20 return PERF_REG_POWERPC_R2;
21 case UNW_PPC64_R3:
22 return PERF_REG_POWERPC_R3;
23 case UNW_PPC64_R4:
24 return PERF_REG_POWERPC_R4;
25 case UNW_PPC64_R5:
26 return PERF_REG_POWERPC_R5;
27 case UNW_PPC64_R6:
28 return PERF_REG_POWERPC_R6;
29 case UNW_PPC64_R7:
30 return PERF_REG_POWERPC_R7;
31 case UNW_PPC64_R8:
32 return PERF_REG_POWERPC_R8;
33 case UNW_PPC64_R9:
34 return PERF_REG_POWERPC_R9;
35 case UNW_PPC64_R10:
36 return PERF_REG_POWERPC_R10;
37 case UNW_PPC64_R11:
38 return PERF_REG_POWERPC_R11;
39 case UNW_PPC64_R12:
40 return PERF_REG_POWERPC_R12;
41 case UNW_PPC64_R13:
42 return PERF_REG_POWERPC_R13;
43 case UNW_PPC64_R14:
44 return PERF_REG_POWERPC_R14;
45 case UNW_PPC64_R15:
46 return PERF_REG_POWERPC_R15;
47 case UNW_PPC64_R16:
48 return PERF_REG_POWERPC_R16;
49 case UNW_PPC64_R17:
50 return PERF_REG_POWERPC_R17;
51 case UNW_PPC64_R18:
52 return PERF_REG_POWERPC_R18;
53 case UNW_PPC64_R19:
54 return PERF_REG_POWERPC_R19;
55 case UNW_PPC64_R20:
56 return PERF_REG_POWERPC_R20;
57 case UNW_PPC64_R21:
58 return PERF_REG_POWERPC_R21;
59 case UNW_PPC64_R22:
60 return PERF_REG_POWERPC_R22;
61 case UNW_PPC64_R23:
62 return PERF_REG_POWERPC_R23;
63 case UNW_PPC64_R24:
64 return PERF_REG_POWERPC_R24;
65 case UNW_PPC64_R25:
66 return PERF_REG_POWERPC_R25;
67 case UNW_PPC64_R26:
68 return PERF_REG_POWERPC_R26;
69 case UNW_PPC64_R27:
70 return PERF_REG_POWERPC_R27;
71 case UNW_PPC64_R28:
72 return PERF_REG_POWERPC_R28;
73 case UNW_PPC64_R29:
74 return PERF_REG_POWERPC_R29;
75 case UNW_PPC64_R30:
76 return PERF_REG_POWERPC_R30;
77 case UNW_PPC64_R31:
78 return PERF_REG_POWERPC_R31;
79 case UNW_PPC64_LR:
80 return PERF_REG_POWERPC_LINK;
81 case UNW_PPC64_CTR:
82 return PERF_REG_POWERPC_CTR;
83 case UNW_PPC64_XER:
84 return PERF_REG_POWERPC_XER;
85 case UNW_PPC64_NIP:
86 return PERF_REG_POWERPC_NIP;
87 default:
88 pr_err("unwind: invalid reg id %d\n", regnum);
89 return -EINVAL;
91 return -EINVAL;