arch/x86/include/asm/bug.h

Source file repositories/reference/linux-study-clean/arch/x86/include/asm/bug.h

File Facts

System
Linux kernel
Corpus path
arch/x86/include/asm/bug.h
Extension
.h
Size
5484 bytes
Lines
198
Domain
Architecture Layer
Bucket
arch/x86
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct sysv_va_list { /* from AMD64 System V ABI */
	unsigned int gp_offset;
	unsigned int fp_offset;
	void *overflow_arg_area;
	void *reg_save_area;
};
struct arch_va_list {
	unsigned long regs[6];
	struct sysv_va_list args;
};
extern void *__warn_args(struct arch_va_list *args, struct pt_regs *regs);
static __always_inline __printf(1, 2) void __WARN_validate_printf(const char *fmt, ...) { }

#define __WARN_bug_entry(flags, format) ({				\
	struct bug_entry *bug;						\
	asm_inline volatile("lea (2f)(%%rip), %[addr]\n1:\n"		\
			    _BUG_FLAGS_ASM("%c[fmt]", "%c[file]",	\
					   "%c[line]", "%c[fl]",	\
					   "%c[size]", "")		\
		   : [addr] "=r" (bug)					\
		   : [fmt] "i" (format),				\
		     [file] "i" (__FILE__),				\
		     [line] "i" (__LINE__),				\
		     [fl] "i" (flags),					\
		     [size] "i" (sizeof(struct bug_entry)));		\
	bug; })

#define __WARN_print_arg(flags, format, arg...)				\
do {									\
	int __flags = (flags) | BUGFLAG_WARNING | BUGFLAG_ARGS ;	\
	__WARN_validate_printf(format, ## arg);				\
	static_call_mod(WARN_trap)(__WARN_bug_entry(__flags, format), ## arg); \
	asm (""); /* inhibit tail-call optimization */			\
} while (0)

#define __WARN_printf(taint, fmt, arg...) \
	__WARN_print_arg(BUGFLAG_TAINT(taint), fmt, ## arg)

#define WARN_ONCE(cond, format, arg...) ({				\
	int __ret_warn_on = !!(cond);					\
	if (unlikely(__ret_warn_on)) {					\
		__WARN_print_arg(BUGFLAG_ONCE|BUGFLAG_TAINT(TAINT_WARN),\
				format, ## arg);			\
	}								\
	__ret_warn_on;							\
})
#endif /* __ASSEMBLER__ */

#endif /* HAVE_ARCH_BUG_FORMAT_ARGS */

#include <asm-generic/bug.h>

#endif /* _ASM_X86_BUG_H */

Annotation

Implementation Notes