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

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

#include <linux/stringify.h>
#include <linux/instrumentation.h>
#include <linux/objtool.h>

/*
 * Despite that some emulators terminate on UD2, we use it for WARN().
 */
#define ASM_UD2
#define INSN_UD2
#define LEN_UD2

#ifdef CONFIG_GENERIC_BUG

#ifdef CONFIG_X86_32
#define __BUG_REL
#else
#define __BUG_REL(val)
#endif

#ifdef CONFIG_DEBUG_BUGVERBOSE

#define _BUG_FLAGS(ins, flags, extra)

#else /* !CONFIG_DEBUG_BUGVERBOSE */

#define _BUG_FLAGS

#endif /* CONFIG_DEBUG_BUGVERBOSE */

#else

#define _BUG_FLAGS

#endif /* CONFIG_GENERIC_BUG */

#define HAVE_ARCH_BUG
#define BUG()

/*
 * This instrumentation_begin() is strictly speaking incorrect; but it
 * suppresses the complaints from WARN()s in noinstr code. If such a WARN()
 * were to trigger, we'd rather wreck the machine in an attempt to get the
 * message out than not know about it.
 */
#define __WARN_FLAGS(flags)

#include <asm-generic/bug.h>

#endif /* _ASM_X86_BUG_H */