Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / perf / arch / x86 / include / perf_regs.h
blobb7321337d10036d577f6434850ccf85b52ade003
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ARCH_PERF_REGS_H
3 #define ARCH_PERF_REGS_H
5 #include <stdlib.h>
6 #include <linux/types.h>
7 #include <asm/perf_regs.h>
9 void perf_regs_load(u64 *regs);
11 #define PERF_REGS_MAX PERF_REG_X86_XMM_MAX
12 #ifndef HAVE_ARCH_X86_64_SUPPORT
13 #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
14 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
15 #else
16 #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
17 (1ULL << PERF_REG_X86_ES) | \
18 (1ULL << PERF_REG_X86_FS) | \
19 (1ULL << PERF_REG_X86_GS))
20 #define PERF_REGS_MASK (((1ULL << PERF_REG_X86_64_MAX) - 1) & ~REG_NOSUPPORT)
21 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
22 #endif
23 #define PERF_REG_IP PERF_REG_X86_IP
24 #define PERF_REG_SP PERF_REG_X86_SP
26 static inline const char *perf_reg_name(int id)
28 switch (id) {
29 case PERF_REG_X86_AX:
30 return "AX";
31 case PERF_REG_X86_BX:
32 return "BX";
33 case PERF_REG_X86_CX:
34 return "CX";
35 case PERF_REG_X86_DX:
36 return "DX";
37 case PERF_REG_X86_SI:
38 return "SI";
39 case PERF_REG_X86_DI:
40 return "DI";
41 case PERF_REG_X86_BP:
42 return "BP";
43 case PERF_REG_X86_SP:
44 return "SP";
45 case PERF_REG_X86_IP:
46 return "IP";
47 case PERF_REG_X86_FLAGS:
48 return "FLAGS";
49 case PERF_REG_X86_CS:
50 return "CS";
51 case PERF_REG_X86_SS:
52 return "SS";
53 case PERF_REG_X86_DS:
54 return "DS";
55 case PERF_REG_X86_ES:
56 return "ES";
57 case PERF_REG_X86_FS:
58 return "FS";
59 case PERF_REG_X86_GS:
60 return "GS";
61 #ifdef HAVE_ARCH_X86_64_SUPPORT
62 case PERF_REG_X86_R8:
63 return "R8";
64 case PERF_REG_X86_R9:
65 return "R9";
66 case PERF_REG_X86_R10:
67 return "R10";
68 case PERF_REG_X86_R11:
69 return "R11";
70 case PERF_REG_X86_R12:
71 return "R12";
72 case PERF_REG_X86_R13:
73 return "R13";
74 case PERF_REG_X86_R14:
75 return "R14";
76 case PERF_REG_X86_R15:
77 return "R15";
78 #endif /* HAVE_ARCH_X86_64_SUPPORT */
80 #define XMM(x) \
81 case PERF_REG_X86_XMM ## x: \
82 case PERF_REG_X86_XMM ## x + 1: \
83 return "XMM" #x;
84 XMM(0)
85 XMM(1)
86 XMM(2)
87 XMM(3)
88 XMM(4)
89 XMM(5)
90 XMM(6)
91 XMM(7)
92 XMM(8)
93 XMM(9)
94 XMM(10)
95 XMM(11)
96 XMM(12)
97 XMM(13)
98 XMM(14)
99 XMM(15)
100 #undef XMM
101 default:
102 return NULL;
105 return NULL;
108 #endif /* ARCH_PERF_REGS_H */