mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
perf tools powerpc: Add support for generating bpf prologue
Generalize existing macros to serve the purpose. Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Ian Munsie <imunsie@au1.ibm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Wang Nan <wangnan0@huawei.com> Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/1462461799-17518-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
03548ebf6d
commit
4679bccaa3
@ -3,4 +3,5 @@ PERF_HAVE_DWARF_REGS := 1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
HAVE_KVM_STAT_SUPPORT := 1
|
HAVE_KVM_STAT_SUPPORT := 1
|
||||||
|
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
|
||||||
PERF_HAVE_JITDUMP := 1
|
PERF_HAVE_JITDUMP := 1
|
||||||
|
@ -10,19 +10,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
#include <dwarf-regs.h>
|
#include <dwarf-regs.h>
|
||||||
|
#include <linux/ptrace.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
struct pt_regs_dwarfnum {
|
struct pt_regs_dwarfnum {
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned int dwarfnum;
|
unsigned int dwarfnum;
|
||||||
|
unsigned int ptregs_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STR(s) #s
|
#define REG_DWARFNUM_NAME(r, num) \
|
||||||
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
|
{.name = STR(%)STR(r), .dwarfnum = num, \
|
||||||
#define GPR_DWARFNUM_NAME(num) \
|
.ptregs_offset = offsetof(struct pt_regs, r)}
|
||||||
{.name = STR(%gpr##num), .dwarfnum = num}
|
#define GPR_DWARFNUM_NAME(num) \
|
||||||
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
|
{.name = STR(%gpr##num), .dwarfnum = num, \
|
||||||
|
.ptregs_offset = offsetof(struct pt_regs, gpr[num])}
|
||||||
|
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reference:
|
* Reference:
|
||||||
@ -61,12 +68,12 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
|
|||||||
GPR_DWARFNUM_NAME(29),
|
GPR_DWARFNUM_NAME(29),
|
||||||
GPR_DWARFNUM_NAME(30),
|
GPR_DWARFNUM_NAME(30),
|
||||||
GPR_DWARFNUM_NAME(31),
|
GPR_DWARFNUM_NAME(31),
|
||||||
REG_DWARFNUM_NAME("%msr", 66),
|
REG_DWARFNUM_NAME(msr, 66),
|
||||||
REG_DWARFNUM_NAME("%ctr", 109),
|
REG_DWARFNUM_NAME(ctr, 109),
|
||||||
REG_DWARFNUM_NAME("%link", 108),
|
REG_DWARFNUM_NAME(link, 108),
|
||||||
REG_DWARFNUM_NAME("%xer", 101),
|
REG_DWARFNUM_NAME(xer, 101),
|
||||||
REG_DWARFNUM_NAME("%dar", 119),
|
REG_DWARFNUM_NAME(dar, 119),
|
||||||
REG_DWARFNUM_NAME("%dsisr", 118),
|
REG_DWARFNUM_NAME(dsisr, 118),
|
||||||
REG_DWARFNUM_END,
|
REG_DWARFNUM_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,3 +93,12 @@ const char *get_arch_regstr(unsigned int n)
|
|||||||
return roff->name;
|
return roff->name;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int regs_query_register_offset(const char *name)
|
||||||
|
{
|
||||||
|
const struct pt_regs_dwarfnum *roff;
|
||||||
|
for (roff = regdwarfnum_table; roff->name != NULL; roff++)
|
||||||
|
if (!strcmp(roff->name, name))
|
||||||
|
return roff->ptregs_offset;
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user