0001
0002 #ifndef _ASMARM_BUG_H
0003 #define _ASMARM_BUG_H
0004
0005 #include <linux/linkage.h>
0006 #include <linux/types.h>
0007 #include <asm/opcodes.h>
0008
0009
0010
0011
0012
0013
0014 #ifdef CONFIG_THUMB2_KERNEL
0015 #define BUG_INSTR_VALUE 0xde02
0016 #define BUG_INSTR(__value) __inst_thumb16(__value)
0017 #else
0018 #define BUG_INSTR_VALUE 0xe7f001f2
0019 #define BUG_INSTR(__value) __inst_arm(__value)
0020 #endif
0021
0022
0023 #define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
0024 #define _BUG(file, line, value) __BUG(file, line, value)
0025
0026 #ifdef CONFIG_DEBUG_BUGVERBOSE
0027
0028
0029
0030
0031
0032
0033
0034
0035 #define __BUG(__file, __line, __value) \
0036 do { \
0037 asm volatile("1:\t" BUG_INSTR(__value) "\n" \
0038 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
0039 "2:\t.asciz " #__file "\n" \
0040 ".popsection\n" \
0041 ".pushsection __bug_table,\"aw\"\n" \
0042 ".align 2\n" \
0043 "3:\t.word 1b, 2b\n" \
0044 "\t.hword " #__line ", 0\n" \
0045 ".popsection"); \
0046 unreachable(); \
0047 } while (0)
0048
0049 #else
0050
0051 #define __BUG(__file, __line, __value) \
0052 do { \
0053 asm volatile(BUG_INSTR(__value) "\n"); \
0054 unreachable(); \
0055 } while (0)
0056 #endif
0057
0058 #define HAVE_ARCH_BUG
0059
0060 #include <asm-generic/bug.h>
0061
0062 struct pt_regs;
0063 void die(const char *msg, struct pt_regs *regs, int err);
0064
0065 void arm_notify_die(const char *str, struct pt_regs *regs,
0066 int signo, int si_code, void __user *addr,
0067 unsigned long err, unsigned long trap);
0068
0069 #ifdef CONFIG_ARM_LPAE
0070 #define FAULT_CODE_ALIGNMENT 33
0071 #define FAULT_CODE_DEBUG 34
0072 #else
0073 #define FAULT_CODE_ALIGNMENT 1
0074 #define FAULT_CODE_DEBUG 2
0075 #endif
0076
0077 void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
0078 struct pt_regs *),
0079 int sig, int code, const char *name);
0080
0081 void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
0082 struct pt_regs *),
0083 int sig, int code, const char *name);
0084
0085 extern asmlinkage void c_backtrace(unsigned long fp, int pmode,
0086 const char *loglvl);
0087
0088 struct mm_struct;
0089 void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr);
0090 extern void __show_regs(struct pt_regs *);
0091 extern void __show_regs_alloc_free(struct pt_regs *regs);
0092
0093 #endif