[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up show_registers().



ChangeSet 1.1685, 2005/06/06 16:17:43+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Clean up show_registers().
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 traps.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)


diff -Nru a/xen/arch/x86/x86_32/traps.c b/xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       2005-06-06 12:01:46 -04:00
+++ b/xen/arch/x86/x86_32/traps.c       2005-06-06 12:01:46 -04:00
@@ -8,10 +8,7 @@
 #include <xen/irq.h>
 #include <asm/current.h>
 #include <asm/flushtlb.h>
-
-#ifdef CONFIG_VMX
 #include <asm/vmx.h>
-#endif
 
 /* All CPUs have their own IDT to allow int80 direct trap. */
 idt_entry_t *idt_tables[NR_CPUS] = { 0 };
@@ -19,10 +16,8 @@
 void show_registers(struct cpu_user_regs *regs)
 {
     unsigned long ss, ds, es, fs, gs, cs;
-    unsigned long eip, esp, eflags;
+    unsigned long eip, esp, eflags, cr0, cr3;
     const char *context;
-#ifdef CONFIG_VMX
-    unsigned long cr0, cr3;
 
     if ( VMX_DOMAIN(current) && (regs->eflags == 0) )
     {
@@ -40,10 +35,13 @@
         context = "vmx guest";
     }
     else
-#endif
     {
-        eip = regs->eip;
+        eip    = regs->eip;
         eflags = regs->eflags;
+        cr0    = read_cr0();
+        cr3    = read_cr3();
+
+        __asm__ ( "movl %%fs,%0 ; movl %%gs,%1" : "=r" (fs), "=r" (gs) );
 
         if ( GUEST_MODE(regs) )
         {
@@ -51,21 +49,16 @@
             ss  = regs->ss & 0xffff;
             ds  = regs->ds & 0xffff;
             es  = regs->es & 0xffff;
-            fs  = regs->fs & 0xffff;
-            gs  = regs->gs & 0xffff;
             cs  = regs->cs & 0xffff;
             context = "guest";
         }
         else
         {
-            esp = (unsigned long)(&regs->esp);
+            esp = (unsigned long)&regs->esp;
             ss  = __HYPERVISOR_DS;
             ds  = __HYPERVISOR_DS;
             es  = __HYPERVISOR_DS;
-            fs  = __HYPERVISOR_DS;
-            gs  = __HYPERVISOR_DS;
             cs  = __HYPERVISOR_CS;
-            
             context = "hypervisor";
         }
     }
@@ -78,12 +71,10 @@
            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("cr0: %08lx   cr3: %08lx\n", cr0, cr3);
     printk("ds: %04lx   es: %04lx   fs: %04lx   gs: %04lx   "
            "ss: %04lx   cs: %04lx\n",
            ds, es, fs, gs, ss, cs);
-#ifdef CONFIG_VMX
-    printk("cr0: %08lx   cr3: %08lx\n", cr0, cr3);
-#endif
 
     if ( GUEST_MODE(regs) )
         show_guest_stack();

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.