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 (1076B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _LINUX_PERF_REGS_H
      3#define _LINUX_PERF_REGS_H
      4
      5#include <linux/sched/task_stack.h>
      6
      7struct perf_regs {
      8	__u64		abi;
      9	struct pt_regs	*regs;
     10};
     11
     12#ifdef CONFIG_HAVE_PERF_REGS
     13#include <asm/perf_regs.h>
     14
     15#ifndef PERF_REG_EXTENDED_MASK
     16#define PERF_REG_EXTENDED_MASK	0
     17#endif
     18
     19u64 perf_reg_value(struct pt_regs *regs, int idx);
     20int perf_reg_validate(u64 mask);
     21u64 perf_reg_abi(struct task_struct *task);
     22void perf_get_regs_user(struct perf_regs *regs_user,
     23			struct pt_regs *regs);
     24#else
     25
     26#define PERF_REG_EXTENDED_MASK	0
     27
     28static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
     29{
     30	return 0;
     31}
     32
     33static inline int perf_reg_validate(u64 mask)
     34{
     35	return mask ? -ENOSYS : 0;
     36}
     37
     38static inline u64 perf_reg_abi(struct task_struct *task)
     39{
     40	return PERF_SAMPLE_REGS_ABI_NONE;
     41}
     42
     43static inline void perf_get_regs_user(struct perf_regs *regs_user,
     44				      struct pt_regs *regs)
     45{
     46	regs_user->regs = task_pt_regs(current);
     47	regs_user->abi = perf_reg_abi(current);
     48}
     49#endif /* CONFIG_HAVE_PERF_REGS */
     50#endif /* _LINUX_PERF_REGS_H */