linux/arch/x86/include/asm/debugreg.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_DEBUGREG_H
#define _ASM_X86_DEBUGREG_H

#include <linux/bug.h>
#include <linux/percpu.h>
#include <uapi/asm/debugreg.h>

#include <asm/cpufeature.h>
#include <asm/msr.h>

DECLARE_PER_CPU(unsigned long, cpu_dr7);

#ifndef CONFIG_PARAVIRT_XXL
/*
 * These special macros can be used to get or set a debugging register
 */
#define get_debugreg
#define set_debugreg
#endif

static __always_inline unsigned long native_get_debugreg(int regno)
{}

static __always_inline void native_set_debugreg(int regno, unsigned long value)
{}

static inline void hw_breakpoint_disable(void)
{}

static __always_inline bool hw_breakpoint_active(void)
{}

extern void hw_breakpoint_restore(void);

static __always_inline unsigned long local_db_save(void)
{}

static __always_inline void local_db_restore(unsigned long dr7)
{}

#ifdef CONFIG_CPU_SUP_AMD
extern void amd_set_dr_addr_mask(unsigned long mask, unsigned int dr);
extern unsigned long amd_get_dr_addr_mask(unsigned int dr);
#else
static inline void amd_set_dr_addr_mask(unsigned long mask, unsigned int dr) { }
static inline unsigned long amd_get_dr_addr_mask(unsigned int dr)
{
	return 0;
}
#endif

static inline unsigned long get_debugctlmsr(void)
{}

static inline void update_debugctlmsr(unsigned long debugctlmsr)
{}

#endif /* _ASM_X86_DEBUGREG_H */