| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 1 | #ifndef _ASM_S390_BUG_H | 
|  | 2 | #define _ASM_S390_BUG_H | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 |  | 
|  | 4 | #include <linux/kernel.h> | 
|  | 5 |  | 
| Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 6 | #ifdef CONFIG_BUG | 
| Martin Schwidefsky | 4896cef | 2006-03-24 03:15:16 -0800 | [diff] [blame] | 7 |  | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 8 | #ifdef CONFIG_64BIT | 
|  | 9 | #define S390_LONG ".quad" | 
| Heiko Carstens | f4a10b2 | 2006-07-12 16:39:42 +0200 | [diff] [blame] | 10 | #else | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 11 | #define S390_LONG ".long" | 
| Heiko Carstens | f4a10b2 | 2006-07-12 16:39:42 +0200 | [diff] [blame] | 12 | #endif | 
| Heiko Carstens | f4a10b2 | 2006-07-12 16:39:42 +0200 | [diff] [blame] | 13 |  | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 14 | #ifdef CONFIG_DEBUG_BUGVERBOSE | 
|  | 15 |  | 
|  | 16 | #define __EMIT_BUG(x) do {					\ | 
|  | 17 | asm volatile(						\ | 
|  | 18 | "0:	j	0b+2\n"				\ | 
|  | 19 | "1:\n"						\ | 
|  | 20 | ".section .rodata.str,\"aMS\",@progbits,1\n"	\ | 
|  | 21 | "2:	.asciz	\""__FILE__"\"\n"		\ | 
|  | 22 | ".previous\n"					\ | 
|  | 23 | ".section __bug_table,\"a\"\n"			\ | 
|  | 24 | "3:\t"	S390_LONG "\t1b,2b\n"			\ | 
|  | 25 | "	.short	%0,%1\n"			\ | 
|  | 26 | "	.org	3b+%2\n"			\ | 
|  | 27 | ".previous\n"					\ | 
|  | 28 | : : "i" (__LINE__),				\ | 
|  | 29 | "i" (x),					\ | 
|  | 30 | "i" (sizeof(struct bug_entry)));		\ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | } while (0) | 
|  | 32 |  | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 33 | #else /* CONFIG_DEBUG_BUGVERBOSE */ | 
|  | 34 |  | 
|  | 35 | #define __EMIT_BUG(x) do {				\ | 
|  | 36 | asm volatile(					\ | 
|  | 37 | "0:	j	0b+2\n"			\ | 
|  | 38 | "1:\n"					\ | 
|  | 39 | ".section __bug_table,\"a\"\n"		\ | 
|  | 40 | "2:\t"	S390_LONG "\t1b\n"		\ | 
|  | 41 | "	.short	%0\n"			\ | 
|  | 42 | "	.org	2b+%1\n"		\ | 
|  | 43 | ".previous\n"				\ | 
|  | 44 | : : "i" (x),				\ | 
|  | 45 | "i" (sizeof(struct bug_entry)));	\ | 
|  | 46 | } while (0) | 
|  | 47 |  | 
|  | 48 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | 
|  | 49 |  | 
|  | 50 | #define BUG()	__EMIT_BUG(0) | 
|  | 51 |  | 
|  | 52 | #define WARN_ON(x) ({					\ | 
| Heiko Carstens | fd0cbdd | 2007-08-02 00:18:38 +0200 | [diff] [blame] | 53 | int __ret_warn_on = !!(x);			\ | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 54 | if (__builtin_constant_p(__ret_warn_on)) {	\ | 
|  | 55 | if (__ret_warn_on)			\ | 
|  | 56 | __EMIT_BUG(BUGFLAG_WARNING);	\ | 
|  | 57 | } else {					\ | 
|  | 58 | if (unlikely(__ret_warn_on))		\ | 
|  | 59 | __EMIT_BUG(BUGFLAG_WARNING);	\ | 
|  | 60 | }						\ | 
|  | 61 | unlikely(__ret_warn_on);			\ | 
|  | 62 | }) | 
|  | 63 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | #define HAVE_ARCH_BUG | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 65 | #define HAVE_ARCH_WARN_ON | 
|  | 66 | #endif /* CONFIG_BUG */ | 
| Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 67 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | #include <asm-generic/bug.h> | 
|  | 69 |  | 
| Heiko Carstens | c0007f1 | 2007-04-27 16:01:42 +0200 | [diff] [blame] | 70 | #endif /* _ASM_S390_BUG_H */ |