Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
tools
perf
arch
x86
util
unwind.c
Go to the documentation of this file.
1
2
#include <errno.h>
3
#include <libunwind.h>
4
#include "perf_regs.h"
5
#include "../../util/unwind.h"
6
7
#ifdef ARCH_X86_64
8
int
unwind__arch_reg_id
(
int
regnum)
9
{
10
int
id
;
11
12
switch
(regnum) {
13
case
UNW_X86_64_RAX:
14
id
=
PERF_REG_X86_AX
;
15
break
;
16
case
UNW_X86_64_RDX:
17
id
=
PERF_REG_X86_DX
;
18
break
;
19
case
UNW_X86_64_RCX:
20
id
=
PERF_REG_X86_CX
;
21
break
;
22
case
UNW_X86_64_RBX:
23
id
=
PERF_REG_X86_BX
;
24
break
;
25
case
UNW_X86_64_RSI:
26
id
=
PERF_REG_X86_SI
;
27
break
;
28
case
UNW_X86_64_RDI:
29
id
=
PERF_REG_X86_DI
;
30
break
;
31
case
UNW_X86_64_RBP:
32
id
=
PERF_REG_X86_BP
;
33
break
;
34
case
UNW_X86_64_RSP:
35
id
=
PERF_REG_X86_SP
;
36
break
;
37
case
UNW_X86_64_R8:
38
id
=
PERF_REG_X86_R8
;
39
break
;
40
case
UNW_X86_64_R9:
41
id
=
PERF_REG_X86_R9
;
42
break
;
43
case
UNW_X86_64_R10:
44
id
=
PERF_REG_X86_R10
;
45
break
;
46
case
UNW_X86_64_R11:
47
id
=
PERF_REG_X86_R11
;
48
break
;
49
case
UNW_X86_64_R12:
50
id
=
PERF_REG_X86_R12
;
51
break
;
52
case
UNW_X86_64_R13:
53
id
=
PERF_REG_X86_R13
;
54
break
;
55
case
UNW_X86_64_R14:
56
id
=
PERF_REG_X86_R14
;
57
break
;
58
case
UNW_X86_64_R15:
59
id
=
PERF_REG_X86_R15
;
60
break
;
61
case
UNW_X86_64_RIP:
62
id
=
PERF_REG_X86_IP
;
63
break
;
64
default
:
65
pr_err
(
"unwind: invalid reg id %d\n"
, regnum);
66
return
-
EINVAL
;
67
}
68
69
return
id
;
70
}
71
#else
72
int
unwind__arch_reg_id
(
int
regnum)
73
{
74
int
id
;
75
76
switch
(regnum) {
77
case
UNW_X86_EAX:
78
id
=
PERF_REG_X86_AX
;
79
break
;
80
case
UNW_X86_EDX:
81
id
=
PERF_REG_X86_DX
;
82
break
;
83
case
UNW_X86_ECX:
84
id
=
PERF_REG_X86_CX
;
85
break
;
86
case
UNW_X86_EBX:
87
id
=
PERF_REG_X86_BX
;
88
break
;
89
case
UNW_X86_ESI:
90
id
=
PERF_REG_X86_SI
;
91
break
;
92
case
UNW_X86_EDI:
93
id
=
PERF_REG_X86_DI
;
94
break
;
95
case
UNW_X86_EBP:
96
id
=
PERF_REG_X86_BP
;
97
break
;
98
case
UNW_X86_ESP:
99
id
=
PERF_REG_X86_SP
;
100
break
;
101
case
UNW_X86_EIP:
102
id
=
PERF_REG_X86_IP
;
103
break
;
104
default
:
105
pr_err
(
"unwind: invalid reg id %d\n"
, regnum);
106
return
-
EINVAL
;
107
}
108
109
return
id
;
110
}
111
#endif
/* ARCH_X86_64 */
Generated on Thu Jan 10 2013 12:56:28 for Linux Kernel by
1.8.2