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