-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf tools: Add interface to arch registers sets
Adding header files to access unified API for arch registers. util/perf_regs.h - global perf_reg declarations arch/x86/include/perf_regs.h - x86 arch specific Adding perf_reg_name function to obtain register name based on the reg ID value, and PERF_REGS_MASK macro with mask definition of all current arch registers (will be used in unwind patches). Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: "Frank Ch. Eigler" <fche@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Benjamin Redelings <benjamin.redelings@nescent.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1344345647-11536-9-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Jiri Olsa
authored and
Arnaldo Carvalho de Melo
committed
Aug 10, 2012
1 parent
239cc47
commit 2bcd355
Showing
3 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#ifndef ARCH_PERF_REGS_H | ||
#define ARCH_PERF_REGS_H | ||
|
||
#include <stdlib.h> | ||
#include "../../util/types.h" | ||
#include "../../../../../arch/x86/include/asm/perf_regs.h" | ||
|
||
#ifndef ARCH_X86_64 | ||
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) | ||
#else | ||
#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \ | ||
(1ULL << PERF_REG_X86_ES) | \ | ||
(1ULL << PERF_REG_X86_FS) | \ | ||
(1ULL << PERF_REG_X86_GS)) | ||
#define PERF_REGS_MASK (((1ULL << PERF_REG_X86_64_MAX) - 1) & ~REG_NOSUPPORT) | ||
#endif | ||
#define PERF_REG_IP PERF_REG_X86_IP | ||
#define PERF_REG_SP PERF_REG_X86_SP | ||
|
||
static inline const char *perf_reg_name(int id) | ||
{ | ||
switch (id) { | ||
case PERF_REG_X86_AX: | ||
return "AX"; | ||
case PERF_REG_X86_BX: | ||
return "BX"; | ||
case PERF_REG_X86_CX: | ||
return "CX"; | ||
case PERF_REG_X86_DX: | ||
return "DX"; | ||
case PERF_REG_X86_SI: | ||
return "SI"; | ||
case PERF_REG_X86_DI: | ||
return "DI"; | ||
case PERF_REG_X86_BP: | ||
return "BP"; | ||
case PERF_REG_X86_SP: | ||
return "SP"; | ||
case PERF_REG_X86_IP: | ||
return "IP"; | ||
case PERF_REG_X86_FLAGS: | ||
return "FLAGS"; | ||
case PERF_REG_X86_CS: | ||
return "CS"; | ||
case PERF_REG_X86_SS: | ||
return "SS"; | ||
case PERF_REG_X86_DS: | ||
return "DS"; | ||
case PERF_REG_X86_ES: | ||
return "ES"; | ||
case PERF_REG_X86_FS: | ||
return "FS"; | ||
case PERF_REG_X86_GS: | ||
return "GS"; | ||
#ifdef ARCH_X86_64 | ||
case PERF_REG_X86_R8: | ||
return "R8"; | ||
case PERF_REG_X86_R9: | ||
return "R9"; | ||
case PERF_REG_X86_R10: | ||
return "R10"; | ||
case PERF_REG_X86_R11: | ||
return "R11"; | ||
case PERF_REG_X86_R12: | ||
return "R12"; | ||
case PERF_REG_X86_R13: | ||
return "R13"; | ||
case PERF_REG_X86_R14: | ||
return "R14"; | ||
case PERF_REG_X86_R15: | ||
return "R15"; | ||
#endif /* ARCH_X86_64 */ | ||
default: | ||
return NULL; | ||
} | ||
|
||
return NULL; | ||
} | ||
|
||
#endif /* ARCH_PERF_REGS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef __PERF_REGS_H | ||
#define __PERF_REGS_H | ||
|
||
#ifndef NO_PERF_REGS | ||
#include <perf_regs.h> | ||
#else | ||
#define PERF_REGS_MASK 0 | ||
|
||
static inline const char *perf_reg_name(int id __used) | ||
{ | ||
return NULL; | ||
} | ||
#endif /* NO_PERF_REGS */ | ||
#endif /* __PERF_REGS_H */ |