• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #include <errno.h>
3 #include <libunwind.h>
4 #include "perf_regs.h"
5 #include "../../util/unwind.h"
6 #include "../../util/debug.h"
7 
libunwind__arch_reg_id(int regnum)8 int libunwind__arch_reg_id(int regnum)
9 {
10 	switch (regnum) {
11 	case UNW_ARM_R0:
12 		return PERF_REG_ARM_R0;
13 	case UNW_ARM_R1:
14 		return PERF_REG_ARM_R1;
15 	case UNW_ARM_R2:
16 		return PERF_REG_ARM_R2;
17 	case UNW_ARM_R3:
18 		return PERF_REG_ARM_R3;
19 	case UNW_ARM_R4:
20 		return PERF_REG_ARM_R4;
21 	case UNW_ARM_R5:
22 		return PERF_REG_ARM_R5;
23 	case UNW_ARM_R6:
24 		return PERF_REG_ARM_R6;
25 	case UNW_ARM_R7:
26 		return PERF_REG_ARM_R7;
27 	case UNW_ARM_R8:
28 		return PERF_REG_ARM_R8;
29 	case UNW_ARM_R9:
30 		return PERF_REG_ARM_R9;
31 	case UNW_ARM_R10:
32 		return PERF_REG_ARM_R10;
33 	case UNW_ARM_R11:
34 		return PERF_REG_ARM_FP;
35 	case UNW_ARM_R12:
36 		return PERF_REG_ARM_IP;
37 	case UNW_ARM_R13:
38 		return PERF_REG_ARM_SP;
39 	case UNW_ARM_R14:
40 		return PERF_REG_ARM_LR;
41 	case UNW_ARM_R15:
42 		return PERF_REG_ARM_PC;
43 	default:
44 		pr_err("unwind: invalid reg id %d\n", regnum);
45 		return -EINVAL;
46 	}
47 
48 	return -EINVAL;
49 }
50