Blame view

kernel/linux-rt-4.4.41/arch/avr32/include/asm/bug.h 1.79 KB
5113f6f70   김현기   kernel add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  /*
   * Copyright (C) 2006 Atmel Corporation
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
  #ifndef __ASM_AVR32_BUG_H
  #define __ASM_AVR32_BUG_H
  
  #ifdef CONFIG_BUG
  
  /*
   * According to our Chief Architect, this compact opcode is very
   * unlikely to ever be implemented.
   */
  #define AVR32_BUG_OPCODE	0x5df0
  
  #ifdef CONFIG_DEBUG_BUGVERBOSE
  
  #define _BUG_OR_WARN(flags)						\
  	asm volatile(							\
  		"1:	.hword	%0
  "					\
  		"	.section __bug_table,\"a\",@progbits
  "		\
  		"2:	.long	1b
  "					\
  		"	.long	%1
  "					\
  		"	.short	%2
  "					\
  		"	.short	%3
  "					\
  		"	.org	2b + %4
  "				\
  		"	.previous"					\
  		:							\
  		: "i"(AVR32_BUG_OPCODE), "i"(__FILE__),			\
  		  "i"(__LINE__), "i"(flags),				\
  		  "i"(sizeof(struct bug_entry)))
  
  #else
  
  #define _BUG_OR_WARN(flags)						\
  	asm volatile(							\
  		"1:	.hword	%0
  "					\
  		"	.section __bug_table,\"a\",@progbits
  "		\
  		"2:	.long	1b
  "					\
  		"	.short	%1
  "					\
  		"	.org	2b + %2
  "				\
  		"	.previous"					\
  		:							\
  		: "i"(AVR32_BUG_OPCODE), "i"(flags),			\
  		  "i"(sizeof(struct bug_entry)))
  
  #endif /* CONFIG_DEBUG_BUGVERBOSE */
  
  #define BUG()								\
  	do {								\
  		_BUG_OR_WARN(0);					\
  		unreachable();						\
  	} while (0)
  
  #define WARN_ON(condition)							\
  	({								\
  		int __ret_warn_on = !!(condition);			\
  		if (unlikely(__ret_warn_on))				\
  			_BUG_OR_WARN(BUGFLAG_WARNING);			\
  		unlikely(__ret_warn_on);				\
  	})
  
  #define HAVE_ARCH_BUG
  #define HAVE_ARCH_WARN_ON
  
  #endif /* CONFIG_BUG */
  
  #include <asm-generic/bug.h>
  
  struct pt_regs;
  void die(const char *str, struct pt_regs *regs, long err);
  void _exception(long signr, struct pt_regs *regs, int code,
  		unsigned long addr);
  
  #endif /* __ASM_AVR32_BUG_H */