ia64/xen-unstable

changeset 5341:4221215e1366

bitkeeper revision 1.1685 (42a46917Mo_RODMmBbBtgwKKV-2YLg)

Clean up show_registers().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jun 06 15:17:43 2005 +0000 (2005-06-06)
parents 095b99f7c9c6
children 03616508a241
files xen/arch/x86/x86_32/traps.c
line diff
     1.1 --- a/xen/arch/x86/x86_32/traps.c	Mon Jun 06 15:17:08 2005 +0000
     1.2 +++ b/xen/arch/x86/x86_32/traps.c	Mon Jun 06 15:17:43 2005 +0000
     1.3 @@ -8,10 +8,7 @@
     1.4  #include <xen/irq.h>
     1.5  #include <asm/current.h>
     1.6  #include <asm/flushtlb.h>
     1.7 -
     1.8 -#ifdef CONFIG_VMX
     1.9  #include <asm/vmx.h>
    1.10 -#endif
    1.11  
    1.12  /* All CPUs have their own IDT to allow int80 direct trap. */
    1.13  idt_entry_t *idt_tables[NR_CPUS] = { 0 };
    1.14 @@ -19,10 +16,8 @@ idt_entry_t *idt_tables[NR_CPUS] = { 0 }
    1.15  void show_registers(struct cpu_user_regs *regs)
    1.16  {
    1.17      unsigned long ss, ds, es, fs, gs, cs;
    1.18 -    unsigned long eip, esp, eflags;
    1.19 +    unsigned long eip, esp, eflags, cr0, cr3;
    1.20      const char *context;
    1.21 -#ifdef CONFIG_VMX
    1.22 -    unsigned long cr0, cr3;
    1.23  
    1.24      if ( VMX_DOMAIN(current) && (regs->eflags == 0) )
    1.25      {
    1.26 @@ -40,10 +35,13 @@ void show_registers(struct cpu_user_regs
    1.27          context = "vmx guest";
    1.28      }
    1.29      else
    1.30 -#endif
    1.31      {
    1.32 -        eip = regs->eip;
    1.33 +        eip    = regs->eip;
    1.34          eflags = regs->eflags;
    1.35 +        cr0    = read_cr0();
    1.36 +        cr3    = read_cr3();
    1.37 +
    1.38 +        __asm__ ( "movl %%fs,%0 ; movl %%gs,%1" : "=r" (fs), "=r" (gs) );
    1.39  
    1.40          if ( GUEST_MODE(regs) )
    1.41          {
    1.42 @@ -51,21 +49,16 @@ void show_registers(struct cpu_user_regs
    1.43              ss  = regs->ss & 0xffff;
    1.44              ds  = regs->ds & 0xffff;
    1.45              es  = regs->es & 0xffff;
    1.46 -            fs  = regs->fs & 0xffff;
    1.47 -            gs  = regs->gs & 0xffff;
    1.48              cs  = regs->cs & 0xffff;
    1.49              context = "guest";
    1.50          }
    1.51          else
    1.52          {
    1.53 -            esp = (unsigned long)(&regs->esp);
    1.54 +            esp = (unsigned long)&regs->esp;
    1.55              ss  = __HYPERVISOR_DS;
    1.56              ds  = __HYPERVISOR_DS;
    1.57              es  = __HYPERVISOR_DS;
    1.58 -            fs  = __HYPERVISOR_DS;
    1.59 -            gs  = __HYPERVISOR_DS;
    1.60              cs  = __HYPERVISOR_CS;
    1.61 -            
    1.62              context = "hypervisor";
    1.63          }
    1.64      }
    1.65 @@ -78,12 +71,10 @@ void show_registers(struct cpu_user_regs
    1.66             regs->eax, regs->ebx, regs->ecx, regs->edx);
    1.67      printk("esi: %08x   edi: %08x   ebp: %08x   esp: %08lx\n",
    1.68             regs->esi, regs->edi, regs->ebp, esp);
    1.69 +    printk("cr0: %08lx   cr3: %08lx\n", cr0, cr3);
    1.70      printk("ds: %04lx   es: %04lx   fs: %04lx   gs: %04lx   "
    1.71             "ss: %04lx   cs: %04lx\n",
    1.72             ds, es, fs, gs, ss, cs);
    1.73 -#ifdef CONFIG_VMX
    1.74 -    printk("cr0: %08lx   cr3: %08lx\n", cr0, cr3);
    1.75 -#endif
    1.76  
    1.77      if ( GUEST_MODE(regs) )
    1.78          show_guest_stack();