^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __PERF_REGS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __PERF_REGS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct regs_dump;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct sample_reg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) uint64_t mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define SMPL_REG2(n, b) { .name = #n, .mask = 3ULL << (b) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define SMPL_REG_END { .name = NULL }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) SDT_ARG_VALID = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) SDT_ARG_SKIP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int arch_sdt_arg_parse_op(char *old_op, char **new_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) uint64_t arch__intr_reg_mask(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) uint64_t arch__user_reg_mask(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifdef HAVE_PERF_REGS_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) extern const struct sample_reg sample_reg_masks[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <perf_regs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define DWARF_MINIMAL_REGS ((1ULL << PERF_REG_IP) | (1ULL << PERF_REG_SP))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline const char *perf_reg_name(int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) const char *reg_name = __perf_reg_name(id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) return reg_name ?: "unknown";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define PERF_REGS_MASK 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define PERF_REGS_MAX 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define DWARF_MINIMAL_REGS PERF_REGS_MASK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static inline const char *perf_reg_name(int id __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) return "unknown";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static inline int perf_reg_value(u64 *valp __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct regs_dump *regs __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int id __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif /* HAVE_PERF_REGS_SUPPORT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif /* __PERF_REGS_H */