1#ifndef _ASM_POWERPC_BUG_H 2#define _ASM_POWERPC_BUG_H 3 4#include <asm/asm-compat.h> 5/* 6 * Define an illegal instr to trap on the bug. 7 * We don't use 0 because that marks the end of a function 8 * in the ELF ABI. That's "Boo Boo" in case you wonder... 9 */ 10#define BUG_OPCODE .long 0x00b00b00 /* For asm */ 11#define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */ 12 13#ifndef __ASSEMBLY__ 14 15struct bug_entry { 16 unsigned long bug_addr; 17 long line; 18 const char *file; 19 const char *function; 20}; 21 22struct bug_entry *find_bug(unsigned long bugaddr); 23 24/* 25 * If this bit is set in the line number it means that the trap 26 * is for WARN_ON rather than BUG or BUG_ON. 27 */ 28#define BUG_WARNING_TRAP 0x1000000 29 30#ifdef CONFIG_BUG 31 32#define BUG() do { \ 33 __asm__ __volatile__( \ 34 "1: twi 31,0,0\n" \ 35 ".section __bug_table,\"a\"\n" \ 36 "\t"PPC_LONG" 1b,%0,%1,%2\n" \ 37 ".previous" \ 38 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ 39} while (0) 40 41#define BUG_ON(x) do { \ 42 __asm__ __volatile__( \ 43 "1: "PPC_TLNEI" %0,0\n" \ 44 ".section __bug_table,\"a\"\n" \ 45 "\t"PPC_LONG" 1b,%1,%2,%3\n" \ 46 ".previous" \ 47 : : "r" ((long)(x)), "i" (__LINE__), \ 48 "i" (__FILE__), "i" (__FUNCTION__)); \ 49} while (0) 50 51#define WARN_ON(x) do { \ 52 __asm__ __volatile__( \ 53 "1: "PPC_TLNEI" %0,0\n" \ 54 ".section __bug_table,\"a\"\n" \ 55 "\t"PPC_LONG" 1b,%1,%2,%3\n" \ 56 ".previous" \ 57 : : "r" ((long)(x)), \ 58 "i" (__LINE__ + BUG_WARNING_TRAP), \ 59 "i" (__FILE__), "i" (__FUNCTION__)); \ 60} while (0) 61 62#define HAVE_ARCH_BUG 63#define HAVE_ARCH_BUG_ON 64#define HAVE_ARCH_WARN_ON 65#endif /* CONFIG_BUG */ 66#endif /* __ASSEMBLY __ */ 67 68#include <asm-generic/bug.h> 69 70#endif /* _ASM_POWERPC_BUG_H */