2 * arch/ubicom32/include/asm/bug.h
3 * Generic bug.h for Ubicom32 architecture.
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
28 #ifndef _ASM_UBICOM32_BUG_H
29 #define _ASM_UBICOM32_BUG_H
31 #include <linux/kernel.h>
32 #include <asm/thread.h>
34 #if defined(CONFIG_BUG) && defined(CONFIG_STOP_ON_BUG)
38 * Ubicom specific version of the BUG() macro.
40 * This implementation performs a THREAD_STALL stopping all threads before
41 * calling panic. This enables a developer to see the "real" state of the
42 * machine (since panic alters the system state). We do the printf first
43 * because while it is slow, it does not alter system state (like
46 * TODO: Implement the trap sequence used by other architectures.
49 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
57 * WARN() using printk() for now.
59 * TODO: Implement the trap sequence used by other architectures.
63 printk("WARN: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
68 * Ubicom specific version of the WARN_ON macro.
70 * This implementation performs a printk for the WARN_ON() instead
71 * of faulting into the kernel and using report_bug().
73 * TODO: Implement the trap sequence used by other architectures.
75 #define WARN_ON(x) ({ \
76 int __ret_warn_on = !!(x); \
77 if (__builtin_constant_p(__ret_warn_on)) { \
81 if (unlikely(__ret_warn_on)) \
84 unlikely(__ret_warn_on); \
89 #define HAVE_ARCH_WARN_ON
93 #include <asm-generic/bug.h>
95 #endif /* _ASM_UBICOM32_BUG_H */