]> xenbits.xensource.com Git - xen.git/commitdiff
xen: Extra %esp tracing on double fault.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 2 Apr 2007 10:50:06 +0000 (11:50 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 2 Apr 2007 10:50:06 +0000 (11:50 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/traps.c
xen/arch/x86/x86_32/traps.c
xen/arch/x86/x86_64/traps.c
xen/include/asm-x86/processor.h

index 99a332b874c69b4cac3296266a5d470bb67a58da..45dbed485dca8e3d06e999c5e31d3d0575ff4a72 100644 (file)
@@ -285,23 +285,32 @@ void show_xen_trace()
     show_trace(&regs);
 }
 
-void show_stack_overflow(unsigned long esp)
+void show_stack_overflow(unsigned int cpu, unsigned long esp)
 {
 #ifdef MEMORY_GUARD
-    unsigned long esp_top;
+    unsigned long esp_top, esp_bottom;
     unsigned long *stack, addr;
 
-    esp_top = (esp | (STACK_SIZE - 1)) - (DEBUG_STACK_SIZE - 1);
+    esp_bottom = (esp | (STACK_SIZE - 1)) + 1;
+    esp_top    = esp_bottom - DEBUG_STACK_SIZE;
+
+    printk("Valid stack range: %p-%p, sp=%p, tss.esp0=%p\n",
+           (void *)esp_top, (void *)esp_bottom, (void *)esp,
+           (void *)init_tss[cpu].esp0);
 
     /* Trigger overflow trace if %esp is within 512 bytes of the guard page. */
     if ( ((unsigned long)(esp - esp_top) > 512) &&
          ((unsigned long)(esp_top - esp) > 512) )
+    {
+        printk("No stack overflow detected. Skipping stack trace.\n");
         return;
+    }
 
     if ( esp < esp_top )
         esp = esp_top;
 
-    printk("Xen stack overflow:\n   ");
+    printk("Xen stack overflow (dumping trace %p-%p):\n   ",
+           (void *)esp, (void *)esp_bottom);
 
     stack = (unsigned long *)esp;
     while ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) != 0 )
index da8ca6bf5c1bf5d85ed9532b4e405538351a7e65..c0f1473737c4064289a1596fb7b2f54f23c7ce0d 100644 (file)
@@ -167,7 +167,7 @@ asmlinkage void do_double_fault(void)
            tss->esi, tss->edi, tss->ebp, tss->esp);
     printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
            tss->ds, tss->es, tss->fs, tss->gs, tss->ss);
-    show_stack_overflow(tss->esp);
+    show_stack_overflow(cpu, tss->esp);
 
     panic("DOUBLE FAULT -- system shutdown\n");
 }
index 9e4502e93499cc1cfbf30dde77076500492f7bf6..af1429ac564a1daff570c4c13e9b4b51369853f5 100644 (file)
@@ -171,7 +171,7 @@ asmlinkage void do_double_fault(struct cpu_user_regs *regs)
     printk("r12: %016lx   r13: %016lx   r14: %016lx\n",
            regs->r12, regs->r13, regs->r14);
     printk("r15: %016lx\n", regs->r15);
-    show_stack_overflow(regs->rsp);
+    show_stack_overflow(cpu, regs->rsp);
 
     panic("DOUBLE FAULT -- system shutdown\n");
 }
index a878d86303c1b6cbab41b72c1297aa719e3af1a8..4c28e48414ca6795b2db657a57e6d9c44cb10b15 100644 (file)
@@ -553,7 +553,7 @@ extern always_inline void prefetchw(const void *x)
 
 void show_stack(struct cpu_user_regs *regs);
 void show_xen_trace(void);
-void show_stack_overflow(unsigned long esp);
+void show_stack_overflow(unsigned int cpu, unsigned long esp);
 void show_registers(struct cpu_user_regs *regs);
 void show_execution_state(struct cpu_user_regs *regs);
 void show_page_walk(unsigned long addr);