Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _ASMARM_BUG_H
 3#define _ASMARM_BUG_H
 4
 5#include <linux/linkage.h>
 6#include <linux/types.h>
 7#include <asm/opcodes.h>
 8
 9/*
10 * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling.
11 * We need to be careful not to conflict with those used by other modules and
12 * the register_undef_hook() system.
13 */
14#ifdef CONFIG_THUMB2_KERNEL
15#define BUG_INSTR_VALUE 0xde02
16#define BUG_INSTR(__value) __inst_thumb16(__value)
17#else
18#define BUG_INSTR_VALUE 0xe7f001f2
19#define BUG_INSTR(__value) __inst_arm(__value)
20#endif
21
22
23#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
24#define _BUG(file, line, value) __BUG(file, line, value)
25
26#ifdef CONFIG_DEBUG_BUGVERBOSE
27
28/*
29 * The extra indirection is to ensure that the __FILE__ string comes through
30 * OK. Many version of gcc do not support the asm %c parameter which would be
31 * preferable to this unpleasantness. We use mergeable string sections to
32 * avoid multiple copies of the string appearing in the kernel image.
33 */
34
35#define __BUG(__file, __line, __value)				\
36do {								\
37	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
38		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
39		"2:\t.asciz " #__file "\n" 			\
40		".popsection\n" 				\
41		".pushsection __bug_table,\"aw\"\n"		\
42		".align 2\n"					\
43		"3:\t.word 1b, 2b\n"				\
44		"\t.hword " #__line ", 0\n"			\
45		".popsection");					\
46	unreachable();						\
47} while (0)
48
49#else
50
51#define __BUG(__file, __line, __value)				\
52do {								\
53	asm volatile(BUG_INSTR(__value) "\n");			\
54	unreachable();						\
55} while (0)
56#endif  /* CONFIG_DEBUG_BUGVERBOSE */
57
58#define HAVE_ARCH_BUG
59
60#include <asm-generic/bug.h>
61
62struct pt_regs;
63void die(const char *msg, struct pt_regs *regs, int err);
64
65void arm_notify_die(const char *str, struct pt_regs *regs,
66		int signo, int si_code, void __user *addr,
67		unsigned long err, unsigned long trap);
68
69#ifdef CONFIG_ARM_LPAE
70#define FAULT_CODE_ALIGNMENT	33
71#define FAULT_CODE_DEBUG	34
72#else
73#define FAULT_CODE_ALIGNMENT	1
74#define FAULT_CODE_DEBUG	2
75#endif
76
77void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
78				       struct pt_regs *),
79		     int sig, int code, const char *name);
80
81void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
82				       struct pt_regs *),
83		     int sig, int code, const char *name);
84
85extern asmlinkage void c_backtrace(unsigned long fp, int pmode,
86				   const char *loglvl);
87
88struct mm_struct;
89void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr);
90extern void __show_regs(struct pt_regs *);
91extern void __show_regs_alloc_free(struct pt_regs *regs);
92
93#endif
v4.10.11
 
 1#ifndef _ASMARM_BUG_H
 2#define _ASMARM_BUG_H
 3
 4#include <linux/linkage.h>
 5#include <linux/types.h>
 6#include <asm/opcodes.h>
 7
 8/*
 9 * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling.
10 * We need to be careful not to conflict with those used by other modules and
11 * the register_undef_hook() system.
12 */
13#ifdef CONFIG_THUMB2_KERNEL
14#define BUG_INSTR_VALUE 0xde02
15#define BUG_INSTR(__value) __inst_thumb16(__value)
16#else
17#define BUG_INSTR_VALUE 0xe7f001f2
18#define BUG_INSTR(__value) __inst_arm(__value)
19#endif
20
21
22#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
23#define _BUG(file, line, value) __BUG(file, line, value)
24
25#ifdef CONFIG_DEBUG_BUGVERBOSE
26
27/*
28 * The extra indirection is to ensure that the __FILE__ string comes through
29 * OK. Many version of gcc do not support the asm %c parameter which would be
30 * preferable to this unpleasantness. We use mergeable string sections to
31 * avoid multiple copies of the string appearing in the kernel image.
32 */
33
34#define __BUG(__file, __line, __value)				\
35do {								\
36	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
37		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38		"2:\t.asciz " #__file "\n" 			\
39		".popsection\n" 				\
40		".pushsection __bug_table,\"a\"\n"		\
41		".align 2\n"					\
42		"3:\t.word 1b, 2b\n"				\
43		"\t.hword " #__line ", 0\n"			\
44		".popsection");					\
45	unreachable();						\
46} while (0)
47
48#else
49
50#define __BUG(__file, __line, __value)				\
51do {								\
52	asm volatile(BUG_INSTR(__value) "\n");			\
53	unreachable();						\
54} while (0)
55#endif  /* CONFIG_DEBUG_BUGVERBOSE */
56
57#define HAVE_ARCH_BUG
58
59#include <asm-generic/bug.h>
60
61struct pt_regs;
62void die(const char *msg, struct pt_regs *regs, int err);
63
64struct siginfo;
65void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
66		unsigned long err, unsigned long trap);
67
68#ifdef CONFIG_ARM_LPAE
69#define FAULT_CODE_ALIGNMENT	33
70#define FAULT_CODE_DEBUG	34
71#else
72#define FAULT_CODE_ALIGNMENT	1
73#define FAULT_CODE_DEBUG	2
74#endif
75
76void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
77				       struct pt_regs *),
78		     int sig, int code, const char *name);
79
80void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
81				       struct pt_regs *),
82		     int sig, int code, const char *name);
83
84extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
 
85
86struct mm_struct;
87extern void show_pte(struct mm_struct *mm, unsigned long addr);
88extern void __show_regs(struct pt_regs *);
 
89
90#endif