2007-04-27 21:01:42 +07:00
|
|
|
#ifndef _ASM_S390_BUG_H
|
|
|
|
#define _ASM_S390_BUG_H
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
|
2005-05-01 22:59:01 +07:00
|
|
|
#ifdef CONFIG_BUG
|
2006-03-24 18:15:16 +07:00
|
|
|
|
2007-04-27 21:01:42 +07:00
|
|
|
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
|
|
|
|
|
|
|
#define __EMIT_BUG(x) do { \
|
|
|
|
asm volatile( \
|
|
|
|
"0: j 0b+2\n" \
|
|
|
|
"1:\n" \
|
|
|
|
".section .rodata.str,\"aMS\",@progbits,1\n" \
|
|
|
|
"2: .asciz \""__FILE__"\"\n" \
|
|
|
|
".previous\n" \
|
|
|
|
".section __bug_table,\"a\"\n" \
|
2010-02-27 04:37:44 +07:00
|
|
|
"3: .long 1b-3b,2b-3b\n" \
|
2007-04-27 21:01:42 +07:00
|
|
|
" .short %0,%1\n" \
|
|
|
|
" .org 3b+%2\n" \
|
|
|
|
".previous\n" \
|
|
|
|
: : "i" (__LINE__), \
|
|
|
|
"i" (x), \
|
|
|
|
"i" (sizeof(struct bug_entry))); \
|
2005-04-17 05:20:36 +07:00
|
|
|
} while (0)
|
|
|
|
|
2007-04-27 21:01:42 +07:00
|
|
|
#else /* CONFIG_DEBUG_BUGVERBOSE */
|
|
|
|
|
|
|
|
#define __EMIT_BUG(x) do { \
|
|
|
|
asm volatile( \
|
|
|
|
"0: j 0b+2\n" \
|
|
|
|
"1:\n" \
|
|
|
|
".section __bug_table,\"a\"\n" \
|
2010-02-27 04:37:44 +07:00
|
|
|
"2: .long 1b-2b\n" \
|
2007-04-27 21:01:42 +07:00
|
|
|
" .short %0\n" \
|
|
|
|
" .org 2b+%1\n" \
|
|
|
|
".previous\n" \
|
|
|
|
: : "i" (x), \
|
|
|
|
"i" (sizeof(struct bug_entry))); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#endif /* CONFIG_DEBUG_BUGVERBOSE */
|
|
|
|
|
2008-12-25 19:39:17 +07:00
|
|
|
#define BUG() do { \
|
|
|
|
__EMIT_BUG(0); \
|
2009-12-05 08:44:53 +07:00
|
|
|
unreachable(); \
|
2008-12-25 19:39:17 +07:00
|
|
|
} while (0)
|
2007-04-27 21:01:42 +07:00
|
|
|
|
2017-02-25 14:56:53 +07:00
|
|
|
#define __WARN_FLAGS(flags) do { \
|
|
|
|
__EMIT_BUG(BUGFLAG_WARNING|(flags)); \
|
2010-01-14 02:44:38 +07:00
|
|
|
} while (0)
|
|
|
|
|
2007-04-27 21:01:42 +07:00
|
|
|
#define WARN_ON(x) ({ \
|
2007-08-02 05:18:38 +07:00
|
|
|
int __ret_warn_on = !!(x); \
|
2007-04-27 21:01:42 +07:00
|
|
|
if (__builtin_constant_p(__ret_warn_on)) { \
|
|
|
|
if (__ret_warn_on) \
|
2010-04-04 01:34:56 +07:00
|
|
|
__WARN(); \
|
2007-04-27 21:01:42 +07:00
|
|
|
} else { \
|
|
|
|
if (unlikely(__ret_warn_on)) \
|
2010-04-04 01:34:56 +07:00
|
|
|
__WARN(); \
|
2007-04-27 21:01:42 +07:00
|
|
|
} \
|
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#define HAVE_ARCH_BUG
|
2007-04-27 21:01:42 +07:00
|
|
|
#define HAVE_ARCH_WARN_ON
|
|
|
|
#endif /* CONFIG_BUG */
|
2005-05-01 22:59:01 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <asm-generic/bug.h>
|
|
|
|
|
2007-04-27 21:01:42 +07:00
|
|
|
#endif /* _ASM_S390_BUG_H */
|