| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifndef _PARISC_BUG_H
 | 
					
						
							|  |  |  | #define _PARISC_BUG_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-03 01:49:32 -07:00
										 |  |  | #include <linux/kernel.h>	/* for BUGFLAG_TAINT */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Tell the user there is some problem. | 
					
						
							|  |  |  |  * The offending file and line are encoded in the __bug_table section. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-01 08:59:01 -07:00
										 |  |  | #ifdef CONFIG_BUG
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define HAVE_ARCH_BUG
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | #define HAVE_ARCH_WARN_ON
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* the break instruction is used as BUG() marker.  */ | 
					
						
							|  |  |  | #define	PARISC_BUG_BREAK_ASM	"break 0x1f, 0x1fff"
 | 
					
						
							|  |  |  | #define	PARISC_BUG_BREAK_INSN	0x03ffe01f  /* PARISC_BUG_BREAK_ASM */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-28 14:52:57 +01:00
										 |  |  | #if defined(CONFIG_64BIT)
 | 
					
						
							|  |  |  | #define ASM_WORD_INSN		".dword\t"
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2007-01-28 14:52:57 +01:00
										 |  |  | #define ASM_WORD_INSN		".word\t"
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_DEBUG_BUGVERBOSE
 | 
					
						
							|  |  |  | #define BUG()								\
 | 
					
						
							|  |  |  | 	do {								\ | 
					
						
							|  |  |  | 		asm volatile("\n"					\ | 
					
						
							|  |  |  | 			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\ | 
					
						
							|  |  |  | 			     "\t.pushsection __bug_table,\"a\"\n"	\ | 
					
						
							| 
									
										
										
										
											2007-01-28 14:52:57 +01:00
										 |  |  | 			     "2:\t" ASM_WORD_INSN "1b, %c0\n"		\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 			     "\t.short %c1, %c2\n"			\ | 
					
						
							|  |  |  | 			     "\t.org 2b+%c3\n"				\ | 
					
						
							|  |  |  | 			     "\t.popsection"				\ | 
					
						
							|  |  |  | 			     : : "i" (__FILE__), "i" (__LINE__),	\ | 
					
						
							|  |  |  | 			     "i" (0), "i" (sizeof(struct bug_entry)) ); \ | 
					
						
							| 
									
										
										
										
											2009-12-10 17:28:18 +00:00
										 |  |  | 		unreachable();						\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 	} while(0) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define BUG()								\
 | 
					
						
							|  |  |  | 	do {								\ | 
					
						
							|  |  |  | 		asm volatile(PARISC_BUG_BREAK_ASM : : );		\ | 
					
						
							| 
									
										
										
										
											2009-12-10 17:28:18 +00:00
										 |  |  | 		unreachable();						\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 	} while(0) | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-16 17:48:26 +01:00
										 |  |  | #ifdef CONFIG_DEBUG_BUGVERBOSE
 | 
					
						
							| 
									
										
										
										
											2010-04-03 19:34:56 +01:00
										 |  |  | #define __WARN_TAINT(taint)						\
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 	do {								\ | 
					
						
							|  |  |  | 		asm volatile("\n"					\ | 
					
						
							|  |  |  | 			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\ | 
					
						
							|  |  |  | 			     "\t.pushsection __bug_table,\"a\"\n"	\ | 
					
						
							| 
									
										
										
										
											2007-01-28 14:52:57 +01:00
										 |  |  | 			     "2:\t" ASM_WORD_INSN "1b, %c0\n"		\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 			     "\t.short %c1, %c2\n"			\ | 
					
						
							|  |  |  | 			     "\t.org 2b+%c3\n"				\ | 
					
						
							|  |  |  | 			     "\t.popsection"				\ | 
					
						
							|  |  |  | 			     : : "i" (__FILE__), "i" (__LINE__),	\ | 
					
						
							| 
									
										
										
										
											2010-04-03 19:34:56 +01:00
										 |  |  | 			     "i" (BUGFLAG_TAINT(taint)), 		\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 			     "i" (sizeof(struct bug_entry)) );		\ | 
					
						
							|  |  |  | 	} while(0) | 
					
						
							| 
									
										
										
										
											2006-12-16 17:48:26 +01:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-04-03 19:34:56 +01:00
										 |  |  | #define __WARN_TAINT(taint)						\
 | 
					
						
							| 
									
										
										
										
											2006-12-16 17:48:26 +01:00
										 |  |  | 	do {								\ | 
					
						
							|  |  |  | 		asm volatile("\n"					\ | 
					
						
							|  |  |  | 			     "1:\t" PARISC_BUG_BREAK_ASM "\n"		\ | 
					
						
							|  |  |  | 			     "\t.pushsection __bug_table,\"a\"\n"	\ | 
					
						
							| 
									
										
										
										
											2007-01-28 14:52:57 +01:00
										 |  |  | 			     "2:\t" ASM_WORD_INSN "1b\n"		\ | 
					
						
							| 
									
										
										
										
											2006-12-16 17:48:26 +01:00
										 |  |  | 			     "\t.short %c0\n"				\ | 
					
						
							|  |  |  | 			     "\t.org 2b+%c1\n"				\ | 
					
						
							|  |  |  | 			     "\t.popsection"				\ | 
					
						
							| 
									
										
										
										
											2010-04-03 19:34:56 +01:00
										 |  |  | 			     : : "i" (BUGFLAG_TAINT(taint)),		\ | 
					
						
							| 
									
										
										
										
											2006-12-16 17:48:26 +01:00
										 |  |  | 			     "i" (sizeof(struct bug_entry)) );		\ | 
					
						
							|  |  |  | 	} while(0) | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define WARN_ON(x) ({						\
 | 
					
						
							| 
									
										
										
										
											2007-08-02 00:18:38 +02:00
										 |  |  | 	int __ret_warn_on = !!(x);				\ | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 	if (__builtin_constant_p(__ret_warn_on)) {		\ | 
					
						
							|  |  |  | 		if (__ret_warn_on)				\ | 
					
						
							|  |  |  | 			__WARN();				\ | 
					
						
							|  |  |  | 	} else {						\ | 
					
						
							|  |  |  | 		if (unlikely(__ret_warn_on))			\ | 
					
						
							|  |  |  | 			__WARN();				\ | 
					
						
							|  |  |  | 	}							\ | 
					
						
							|  |  |  | 	unlikely(__ret_warn_on);				\ | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-01 08:59:01 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <asm-generic/bug.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-12-16 16:16:50 +01:00
										 |  |  | 
 |