18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_KDEBUG_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_KDEBUG_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/notifier.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct pt_regs;
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* Grossly misnamed. */
108c2ecf20Sopenharmony_cienum die_val {
118c2ecf20Sopenharmony_ci	DIE_OOPS = 1,
128c2ecf20Sopenharmony_ci	DIE_INT3,
138c2ecf20Sopenharmony_ci	DIE_DEBUG,
148c2ecf20Sopenharmony_ci	DIE_PANIC,
158c2ecf20Sopenharmony_ci	DIE_NMI,
168c2ecf20Sopenharmony_ci	DIE_DIE,
178c2ecf20Sopenharmony_ci	DIE_KERNELDEBUG,
188c2ecf20Sopenharmony_ci	DIE_TRAP,
198c2ecf20Sopenharmony_ci	DIE_GPF,
208c2ecf20Sopenharmony_ci	DIE_CALL,
218c2ecf20Sopenharmony_ci	DIE_PAGE_FAULT,
228c2ecf20Sopenharmony_ci	DIE_NMIUNKNOWN,
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cienum show_regs_mode {
268c2ecf20Sopenharmony_ci	SHOW_REGS_SHORT,
278c2ecf20Sopenharmony_ci	/*
288c2ecf20Sopenharmony_ci	 * For when userspace crashed, but we don't think it's our fault, and
298c2ecf20Sopenharmony_ci	 * therefore don't print kernel registers.
308c2ecf20Sopenharmony_ci	 */
318c2ecf20Sopenharmony_ci	SHOW_REGS_USER,
328c2ecf20Sopenharmony_ci	SHOW_REGS_ALL
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciextern void die(const char *, struct pt_regs *,long);
368c2ecf20Sopenharmony_civoid die_addr(const char *str, struct pt_regs *regs, long err, long gp_addr);
378c2ecf20Sopenharmony_ciextern int __must_check __die(const char *, struct pt_regs *, long);
388c2ecf20Sopenharmony_ciextern void show_stack_regs(struct pt_regs *regs);
398c2ecf20Sopenharmony_ciextern void __show_regs(struct pt_regs *regs, enum show_regs_mode,
408c2ecf20Sopenharmony_ci			const char *log_lvl);
418c2ecf20Sopenharmony_ciextern void show_iret_regs(struct pt_regs *regs, const char *log_lvl);
428c2ecf20Sopenharmony_ciextern unsigned long oops_begin(void);
438c2ecf20Sopenharmony_ciextern void oops_end(unsigned long, struct pt_regs *, int signr);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* _ASM_X86_KDEBUG_H */
46