|
|
|
|
|
|
|
|
|
|
xen-ppc-devel
Re: [XenPPC] [PATCH] Print backtrace on BUG
Bah, it's too early for GCC asm:
+ asm("mr %0, 1" :
"=r" (sp)); \
+ asm("mflr %0" :
"=r" (lr)); \
+ asm("mflr %0; bl 1f; 1: mflr %1; mtlr %0" : "=r" (tp),
"=r" (pc)); \
asm("bl $+4 ; mflr %0; mtlr %1" : "=r"(pc) : "r"(lr)); \
+ show_backtrace(sp, lr,
pc); \
+ __asm__ __volatile__
( "trap" ); \
+} while ( 0 )
...and the one "asm" where you put "volatile" on is the only one that
doesn't need it :-) (and no __ is needed either).
Alternatively (and preferred), you can make a single statement out
of the first three asm statements.
In fact, you _have_ to make those three into one; even "volatile asm"s
can be reordered by the compiler, if there's no data dependency.
The "trap" asm is always volatile (it has no parameters); it can still
be reordered though. You can use __builtin_trap() here instead.
Segher
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|
|
|
|
|