# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 168867efb453d54f5decc73435965254e423bc68
# Parent  2bf7c6cb46e32eed10ffbe573381aa23400f84ea
[POWERPC][XEN] Add a WARN() facility

So easy and so useful, I could not resist.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/backtrace.c        |   17 +++++++++++++++++
 xen/arch/powerpc/usercopy.c         |    1 +
 xen/include/asm-powerpc/processor.h |    4 ++++
 3 files changed, 22 insertions(+)

diff -r 2bf7c6cb46e3 -r 168867efb453 xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c      Thu Aug 31 08:32:55 2006 -0400
+++ b/xen/arch/powerpc/backtrace.c      Thu Aug 31 09:10:36 2006 -0400
@@ -191,3 +191,20 @@ void show_backtrace(ulong sp, ulong lr, 
     backtrace(sp, lr, pc);
     console_end_sync();
 }
+
+void __warn(char *file, int line)
+{
+    ulong sp;
+    ulong lr;
+
+    console_start_sync();
+    printk("WARN at %s:%d\n", file, line);
+
+    sp = (ulong)__builtin_frame_address(0);
+    lr = (ulong)__builtin_return_address(0);
+
+    backtrace(sp, lr, lr);
+    console_end_sync();
+}
+
+    
diff -r 2bf7c6cb46e3 -r 168867efb453 xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c       Thu Aug 31 08:32:55 2006 -0400
+++ b/xen/arch/powerpc/usercopy.c       Thu Aug 31 09:10:36 2006 -0400
@@ -59,6 +59,7 @@ static unsigned long paddr_to_maddr(unsi
     case PFN_TYPE_REMOTE:
         printk("%s: Dom:%d paddr: 0x%lx type: REMOTE\n",
                __func__, d->domain_id, paddr);
+        WARN();
         break;
     default:
         panic("%s: Dom:%d paddr: 0x%lx bad type:0x%x\n",
diff -r 2bf7c6cb46e3 -r 168867efb453 xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h       Thu Aug 31 08:32:55 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h       Thu Aug 31 09:10:36 2006 -0400
@@ -52,6 +52,10 @@ extern void load_cpu_sprs(struct vcpu *)
 /* XXX this could also land us in GDB */
 #define dump_execution_state() BUG()
 
+extern void __warn(char *file, int line);
+#define WARN() __warn(__FILE__, __LINE__)
+#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
+
 #define ARCH_HAS_PREFETCH
 static inline void prefetch(const void *x) {;}
 

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to