linux/arch/x86/kernel/perf_regs.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
#include <linux/perf_event.h>
#include <linux/bug.h>
#include <linux/stddef.h>
#include <asm/perf_regs.h>
#include <asm/ptrace.h>

#ifdef CONFIG_X86_32
#define PERF_REG_X86_MAX
#else
#define PERF_REG_X86_MAX
#endif

#define PT_REGS_OFFSET(id, r)

static unsigned int pt_regs_offset[PERF_REG_X86_MAX] =;

u64 perf_reg_value(struct pt_regs *regs, int idx)
{}

#define PERF_REG_X86_RESERVED

#ifdef CONFIG_X86_32
#define REG_NOSUPPORT

int perf_reg_validate(u64 mask)
{
	if (!mask || (mask & (REG_NOSUPPORT | PERF_REG_X86_RESERVED)))
		return -EINVAL;

	return 0;
}

u64 perf_reg_abi(struct task_struct *task)
{
	return PERF_SAMPLE_REGS_ABI_32;
}

void perf_get_regs_user(struct perf_regs *regs_user,
			struct pt_regs *regs)
{
	regs_user->regs = task_pt_regs(current);
	regs_user->abi = perf_reg_abi(current);
}
#else /* CONFIG_X86_64 */
#define REG_NOSUPPORT

int perf_reg_validate(u64 mask)
{}

u64 perf_reg_abi(struct task_struct *task)
{}

static DEFINE_PER_CPU(struct pt_regs, nmi_user_regs);

void perf_get_regs_user(struct perf_regs *regs_user,
			struct pt_regs *regs)
{}
#endif /* CONFIG_X86_32 */