162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_GENERIC_KPROBES_H
362306a36Sopenharmony_ci#define _ASM_GENERIC_KPROBES_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
662306a36Sopenharmony_ci#ifdef CONFIG_KPROBES
762306a36Sopenharmony_ci/*
862306a36Sopenharmony_ci * Blacklist ganerating macro. Specify functions which is not probed
962306a36Sopenharmony_ci * by using this macro.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci# define __NOKPROBE_SYMBOL(fname)				\
1262306a36Sopenharmony_cistatic unsigned long __used					\
1362306a36Sopenharmony_ci	__section("_kprobe_blacklist")				\
1462306a36Sopenharmony_ci	_kbl_addr_##fname = (unsigned long)fname;
1562306a36Sopenharmony_ci# define NOKPROBE_SYMBOL(fname)	__NOKPROBE_SYMBOL(fname)
1662306a36Sopenharmony_ci/* Use this to forbid a kprobes attach on very low level functions */
1762306a36Sopenharmony_ci# define __kprobes	__section(".kprobes.text")
1862306a36Sopenharmony_ci# define nokprobe_inline	__always_inline
1962306a36Sopenharmony_ci#else
2062306a36Sopenharmony_ci# define NOKPROBE_SYMBOL(fname)
2162306a36Sopenharmony_ci# define __kprobes
2262306a36Sopenharmony_ci# define nokprobe_inline	inline
2362306a36Sopenharmony_ci#endif
2462306a36Sopenharmony_ci#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#endif /* _ASM_GENERIC_KPROBES_H */
27