Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24598
b: refs/heads/master
c: e3f94b8
h: refs/heads/master
v: v3
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Mar 27, 2006
1 parent 8d054b1 commit 9867f95
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af308377e204e25f1f58627d05fe0f483703b514
refs/heads/master: e3f94b85f98a346c5eb0ac0d9539b71cb7057143
30 changes: 28 additions & 2 deletions trunk/include/asm-powerpc/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ struct bug_entry *find_bug(unsigned long bugaddr);

#ifdef CONFIG_BUG

/*
* BUG_ON() and WARN_ON() do their best to cooperate with compile-time
* optimisations. However depending on the complexity of the condition
* some compiler versions may not produce optimal results.
*/

#define BUG() do { \
__asm__ __volatile__( \
"1: twi 31,0,0\n" \
Expand All @@ -40,24 +46,44 @@ struct bug_entry *find_bug(unsigned long bugaddr);
} while (0)

#define BUG_ON(x) do { \
__asm__ __volatile__( \
if (__builtin_constant_p(x)) { \
if (x) \
BUG(); \
} else { \
__asm__ __volatile__( \
"1: "PPC_TLNEI" %0,0\n" \
".section __bug_table,\"a\"\n" \
"\t"PPC_LONG" 1b,%1,%2,%3\n" \
".previous" \
: : "r" ((long)(x)), "i" (__LINE__), \
"i" (__FILE__), "i" (__FUNCTION__)); \
} \
} while (0)

#define WARN_ON(x) do { \
#define WARN() do { \
__asm__ __volatile__( \
"1: twi 31,0,0\n" \
".section __bug_table,\"a\"\n" \
"\t"PPC_LONG" 1b,%0,%1,%2\n" \
".previous" \
: : "i" (__LINE__ + BUG_WARNING_TRAP), \
"i" (__FILE__), "i" (__FUNCTION__)); \
} while (0)

#define WARN_ON(x) do { \
if (__builtin_constant_p(x)) { \
if (x) \
WARN(); \
} else { \
__asm__ __volatile__( \
"1: "PPC_TLNEI" %0,0\n" \
".section __bug_table,\"a\"\n" \
"\t"PPC_LONG" 1b,%1,%2,%3\n" \
".previous" \
: : "r" ((long)(x)), \
"i" (__LINE__ + BUG_WARNING_TRAP), \
"i" (__FILE__), "i" (__FUNCTION__)); \
} \
} while (0)

#define HAVE_ARCH_BUG
Expand Down

0 comments on commit 9867f95

Please sign in to comment.