cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

perf_regs.h (1366B)


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