WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Manual merge.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Manual merge.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Fri, 10 Jun 2005 14:38:22 +0000
Delivery-date: Fri, 10 Jun 2005 15:02:48 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1719, 2005/06/10 15:38:22+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Manual merge.



 traps.c | 1182 +++++++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 732 insertions(+), 450 deletions(-)


diff -Nru a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      2005-06-10 11:03:47 -04:00
+++ b/xen/arch/x86/traps.c      2005-06-10 11:03:47 -04:00
@@ -1,5 +1,5 @@
 /******************************************************************************
- * arch/i386/traps.c
+ * arch/x86/traps.c
  * 
  * Modifications to Linux original are copyright (c) 2002-2004, K A Fraser
  * 
@@ -39,8 +39,8 @@
 #include <xen/irq.h>
 #include <xen/perfc.h>
 #include <xen/softirq.h>
+#include <xen/domain_page.h>
 #include <asm/shadow.h>
-#include <asm/domain_page.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/atomic.h>
@@ -51,6 +51,8 @@
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/debugger.h>
+#include <asm/msr.h>
+#include <asm/x86_emulate.h>
 
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
@@ -65,45 +67,39 @@
 #endif
 string_param("nmi", opt_nmi);
 
-#if defined(__i386__)
-
-#define GUEST_FAULT(_r) (likely(VM86_MODE(_r) || !RING_0(_r)))
-
-#define DOUBLEFAULT_STACK_SIZE 1024
-static struct tss_struct doublefault_tss;
-static unsigned char doublefault_stack[DOUBLEFAULT_STACK_SIZE];
+/* Master table, used by all CPUs on x86/64, and by CPU0 on x86/32.*/
+idt_entry_t idt_table[IDT_ENTRIES];
 
-asmlinkage int hypercall(void);
+#define DECLARE_TRAP_HANDLER(_name)                     \
+asmlinkage void _name(void);                            \
+asmlinkage int do_ ## _name(struct cpu_user_regs *regs)
 
-/* Master table, and the one used by CPU0. */
-struct desc_struct idt_table[256] = { {0, 0}, };
-/* All other CPUs have their own copy. */
-struct desc_struct *idt_tables[NR_CPUS] = { 0 };
-
-asmlinkage void divide_error(void);
-asmlinkage void debug(void);
 asmlinkage void nmi(void);
-asmlinkage void int3(void);
-asmlinkage void overflow(void);
-asmlinkage void bounds(void);
-asmlinkage void invalid_op(void);
-asmlinkage void device_not_available(void);
-asmlinkage void coprocessor_segment_overrun(void);
-asmlinkage void invalid_TSS(void);
-asmlinkage void segment_not_present(void);
-asmlinkage void stack_segment(void);
-asmlinkage void general_protection(void);
-asmlinkage void page_fault(void);
-asmlinkage void coprocessor_error(void);
-asmlinkage void simd_coprocessor_error(void);
-asmlinkage void alignment_check(void);
-asmlinkage void spurious_interrupt_bug(void);
-asmlinkage void machine_check(void);
+DECLARE_TRAP_HANDLER(divide_error);
+DECLARE_TRAP_HANDLER(debug);
+DECLARE_TRAP_HANDLER(int3);
+DECLARE_TRAP_HANDLER(overflow);
+DECLARE_TRAP_HANDLER(bounds);
+DECLARE_TRAP_HANDLER(invalid_op);
+DECLARE_TRAP_HANDLER(device_not_available);
+DECLARE_TRAP_HANDLER(coprocessor_segment_overrun);
+DECLARE_TRAP_HANDLER(invalid_TSS);
+DECLARE_TRAP_HANDLER(segment_not_present);
+DECLARE_TRAP_HANDLER(stack_segment);
+DECLARE_TRAP_HANDLER(general_protection);
+DECLARE_TRAP_HANDLER(page_fault);
+DECLARE_TRAP_HANDLER(coprocessor_error);
+DECLARE_TRAP_HANDLER(simd_coprocessor_error);
+DECLARE_TRAP_HANDLER(alignment_check);
+DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
+DECLARE_TRAP_HANDLER(machine_check);
 
-int kstack_depth_to_print = 8*20;
+static int debug_stack_lines = 20;
+integer_param("debug_stack_lines", debug_stack_lines);
 
 static inline int kernel_text_address(unsigned long addr)
 {
+    extern char _stext, _etext;
     if (addr >= (unsigned long) &_stext &&
         addr <= (unsigned long) &_etext)
         return 1;
@@ -111,111 +107,91 @@
 
 }
 
-void show_guest_stack()
+void show_guest_stack(void)
 {
     int i;
-    execution_context_t *ec = get_execution_context();
-    unsigned long *stack = (unsigned long *)ec->esp;
-    printk("Guest EIP is %lx\n",ec->eip);
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    unsigned long *stack = (unsigned long *)regs->esp, addr;
+
+    printk("Guest stack trace from "__OP"sp=%p:\n   ", stack);
 
-    for ( i = 0; i < kstack_depth_to_print; i++ )
+    for ( i = 0; i < (debug_stack_lines*8); i++ )
     {
         if ( ((long)stack & (STACK_SIZE-1)) == 0 )
             break;
-        if ( i && ((i % 8) == 0) )
-            printk("\n       ");
-            printk("%08lx ", *stack++);            
+        if ( get_user(addr, stack) )
+        {
+            if ( i != 0 )
+                printk("\n    ");
+            printk("Fault while accessing guest memory.");
+            i = 1;
+            break;
+        }
+        if ( (i != 0) && ((i % 8) == 0) )
+            printk("\n   ");
+        printk("%p ", _p(addr));
+        stack++;
     }
+    if ( i == 0 )
+        printk("Stack empty.");
     printk("\n");
-    
 }
 
 void show_trace(unsigned long *esp)
 {
-    unsigned long *stack, addr;
-    int i;
+    unsigned long *stack = esp, addr;
+    int i = 0;
+
+    printk("Xen call trace from "__OP"sp=%p:\n   ", stack);
 
-    printk("Call Trace from ESP=%p: ", esp);
-    stack = esp;
-    i = 0;
-    while (((long) stack & (STACK_SIZE-1)) != 0) {
+    while ( ((long) stack & (STACK_SIZE-1)) != 0 )
+    {
         addr = *stack++;
-        if (kernel_text_address(addr)) {
-            if (i && ((i % 6) == 0))
+        if ( kernel_text_address(addr) )
+        {
+            if ( (i != 0) && ((i % 6) == 0) )
                 printk("\n   ");
-            printk("[<%08lx>] ", addr);
+            printk("[<%p>] ", _p(addr));
             i++;
         }
     }
+    if ( i == 0 )
+        printk("Trace empty.");
     printk("\n");
 }
 
 void show_stack(unsigned long *esp)
 {
-    unsigned long *stack;
+    unsigned long *stack = esp, addr;
     int i;
 
-    printk("Stack trace from ESP=%p:\n", esp);
+    printk("Xen stack trace from "__OP"sp=%p:\n   ", stack);
 
-    stack = esp;
-    for ( i = 0; i < kstack_depth_to_print; i++ )
+    for ( i = 0; i < (debug_stack_lines*8); i++ )
     {
         if ( ((long)stack & (STACK_SIZE-1)) == 0 )
             break;
-        if ( i && ((i % 8) == 0) )
-            printk("\n       ");
-        if ( kernel_text_address(*stack) )
-            printk("[%08lx] ", *stack++);
+        if ( (i != 0) && ((i % 8) == 0) )
+            printk("\n   ");
+        addr = *stack++;
+        if ( kernel_text_address(addr) )
+            printk("[%p] ", _p(addr));
         else
-            printk("%08lx ", *stack++);            
+            printk("%p ", _p(addr));
     }
+    if ( i == 0 )
+        printk("Stack empty.");
     printk("\n");
 
-    show_trace( esp );
+    show_trace(esp);
 }
 
-void show_registers(struct xen_regs *regs)
-{
-    unsigned long esp;
-    unsigned short ss, ds, es, fs, gs;
-
-    if ( GUEST_FAULT(regs) )
-    {
-        esp = regs->esp;
-        ss  = regs->ss & 0xffff;
-        ds  = regs->ds & 0xffff;
-        es  = regs->es & 0xffff;
-        fs  = regs->fs & 0xffff;
-        gs  = regs->gs & 0xffff;
-    }
-    else
-    {
-        esp = (unsigned long)(&regs->esp);
-        ss  = __HYPERVISOR_DS;
-        ds  = __HYPERVISOR_DS;
-        es  = __HYPERVISOR_DS;
-        fs  = __HYPERVISOR_DS;
-        gs  = __HYPERVISOR_DS;
-    }
-
-    printk("CPU:    %d\nEIP:    %04x:[<%08x>]      \nEFLAGS: %08x\n",
-           smp_processor_id(), 0xffff & regs->cs, regs->eip, regs->eflags);
-    printk("eax: %08x   ebx: %08x   ecx: %08x   edx: %08x\n",
-           regs->eax, regs->ebx, regs->ecx, regs->edx);
-    printk("esi: %08x   edi: %08x   ebp: %08x   esp: %08lx\n",
-           regs->esi, regs->edi, regs->ebp, esp);
-    printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
-           ds, es, fs, gs, ss);
-
-    show_stack((unsigned long *)&regs->esp);
-} 
-
 /*
  * This is called for faults at very unexpected times (e.g., when interrupts

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>