ia64/xen-unstable

changeset 18300:a189e68441fe

x86: also show event upcall mask when dumping guest state

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Aug 08 15:00:01 2008 +0100 (2008-08-08)
parents c386106f9638
children 4e3316ed1af5
files xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/traps.c
line diff
     1.1 --- a/xen/arch/x86/x86_32/traps.c	Fri Aug 08 12:08:09 2008 +0100
     1.2 +++ b/xen/arch/x86/x86_32/traps.c	Fri Aug 08 15:00:01 2008 +0100
     1.3 @@ -32,14 +32,26 @@ static void print_xen_info(void)
     1.4             arch, debug, print_tainted(taint_str));
     1.5  }
     1.6  
     1.7 -static void _show_registers(const struct cpu_user_regs *regs,
     1.8 -                            unsigned long crs[8], int guest_mode,
     1.9 -                            const char *context)
    1.10 +enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest };
    1.11 +
    1.12 +static void _show_registers(
    1.13 +    const struct cpu_user_regs *regs, unsigned long crs[8],
    1.14 +    enum context context, const struct vcpu *v)
    1.15  {
    1.16 +    const static char *context_names[] = {
    1.17 +        [CTXT_hypervisor] = "hypervisor",
    1.18 +        [CTXT_pv_guest]   = "pv guest",
    1.19 +        [CTXT_hvm_guest]  = "hvm guest"
    1.20 +    };
    1.21 +
    1.22      printk("EIP:    %04x:[<%08x>]", regs->cs, regs->eip);
    1.23 -    if ( !guest_mode )
    1.24 +    if ( context == CTXT_hypervisor )
    1.25          print_symbol(" %s", regs->eip);
    1.26 -    printk("\nEFLAGS: %08x   CONTEXT: %s\n", regs->eflags, context);
    1.27 +    printk("\nEFLAGS: %08x   ", regs->eflags);
    1.28 +    if ( (context == CTXT_pv_guest) && v && v->vcpu_info )
    1.29 +        printk("EM: %d   ", !!v->vcpu_info->evtchn_upcall_mask);
    1.30 +    printk("CONTEXT: %s\n", context_names[context]);
    1.31 +
    1.32      printk("eax: %08x   ebx: %08x   ecx: %08x   edx: %08x\n",
    1.33             regs->eax, regs->ebx, regs->ecx, regs->edx);
    1.34      printk("esi: %08x   edi: %08x   ebp: %08x   esp: %08x\n",
    1.35 @@ -56,13 +68,13 @@ void show_registers(struct cpu_user_regs
    1.36  {
    1.37      struct cpu_user_regs fault_regs = *regs;
    1.38      unsigned long fault_crs[8];
    1.39 -    const char *context;
    1.40 +    enum context context;
    1.41      struct vcpu *v = current;
    1.42  
    1.43      if ( is_hvm_vcpu(v) && guest_mode(regs) )
    1.44      {
    1.45          struct segment_register sreg;
    1.46 -        context = "hvm";
    1.47 +        context = CTXT_hvm_guest;
    1.48          fault_crs[0] = v->arch.hvm_vcpu.guest_cr[0];
    1.49          fault_crs[2] = v->arch.hvm_vcpu.guest_cr[2];
    1.50          fault_crs[3] = v->arch.hvm_vcpu.guest_cr[3];
    1.51 @@ -84,7 +96,7 @@ void show_registers(struct cpu_user_regs
    1.52      {
    1.53          if ( !guest_mode(regs) )
    1.54          {
    1.55 -            context = "hypervisor";
    1.56 +            context = CTXT_hypervisor;
    1.57              fault_regs.esp = (unsigned long)&regs->esp;
    1.58              fault_regs.ss = read_segment_register(ss);
    1.59              fault_regs.ds = read_segment_register(ds);
    1.60 @@ -95,7 +107,7 @@ void show_registers(struct cpu_user_regs
    1.61          }
    1.62          else
    1.63          {
    1.64 -            context = "guest";
    1.65 +            context = CTXT_pv_guest;
    1.66              fault_crs[2] = v->vcpu_info->arch.cr2;
    1.67          }
    1.68  
    1.69 @@ -106,7 +118,7 @@ void show_registers(struct cpu_user_regs
    1.70  
    1.71      print_xen_info();
    1.72      printk("CPU:    %d\n", smp_processor_id());
    1.73 -    _show_registers(&fault_regs, fault_crs, guest_mode(regs), context);
    1.74 +    _show_registers(&fault_regs, fault_crs, context, v);
    1.75  
    1.76      if ( this_cpu(ler_msr) && !guest_mode(regs) )
    1.77      {
    1.78 @@ -130,7 +142,7 @@ void vcpu_show_registers(const struct vc
    1.79      crs[3] = pagetable_get_paddr(v->arch.guest_table);
    1.80      crs[4] = v->arch.guest_context.ctrlreg[4];
    1.81  
    1.82 -    _show_registers(&v->arch.guest_context.user_regs, crs, 1, "guest");
    1.83 +    _show_registers(&v->arch.guest_context.user_regs, crs, CTXT_pv_guest, v);
    1.84  }
    1.85  
    1.86  void show_page_walk(unsigned long addr)
     2.1 --- a/xen/arch/x86/x86_64/traps.c	Fri Aug 08 12:08:09 2008 +0100
     2.2 +++ b/xen/arch/x86/x86_64/traps.c	Fri Aug 08 15:00:01 2008 +0100
     2.3 @@ -40,14 +40,26 @@ static void print_xen_info(void)
     2.4             debug, print_tainted(taint_str));
     2.5  }
     2.6  
     2.7 -static void _show_registers(const struct cpu_user_regs *regs,
     2.8 -                            unsigned long crs[8], int guest_mode,
     2.9 -                            const char *context)
    2.10 +enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest };
    2.11 +
    2.12 +static void _show_registers(
    2.13 +    const struct cpu_user_regs *regs, unsigned long crs[8],
    2.14 +    enum context context, const struct vcpu *v)
    2.15  {
    2.16 +    const static char *context_names[] = {
    2.17 +        [CTXT_hypervisor] = "hypervisor",
    2.18 +        [CTXT_pv_guest]   = "pv guest",
    2.19 +        [CTXT_hvm_guest]  = "hvm guest"
    2.20 +    };
    2.21 +
    2.22      printk("RIP:    %04x:[<%016lx>]", regs->cs, regs->rip);
    2.23 -    if ( !guest_mode )
    2.24 +    if ( context == CTXT_hypervisor )
    2.25          print_symbol(" %s", regs->rip);
    2.26 -    printk("\nRFLAGS: %016lx   CONTEXT: %s\n", regs->rflags, context);
    2.27 +    printk("\nRFLAGS: %016lx   ", regs->rflags);
    2.28 +    if ( (context == CTXT_pv_guest) && v && v->vcpu_info )
    2.29 +        printk("EM: %d   ", !!vcpu_info(v, evtchn_upcall_mask));
    2.30 +    printk("CONTEXT: %s\n", context_names[context]);
    2.31 +
    2.32      printk("rax: %016lx   rbx: %016lx   rcx: %016lx\n",
    2.33             regs->rax, regs->rbx, regs->rcx);
    2.34      printk("rdx: %016lx   rsi: %016lx   rdi: %016lx\n",
    2.35 @@ -71,13 +83,13 @@ void show_registers(struct cpu_user_regs
    2.36  {
    2.37      struct cpu_user_regs fault_regs = *regs;
    2.38      unsigned long fault_crs[8];
    2.39 -    const char *context;
    2.40 +    enum context context;
    2.41      struct vcpu *v = current;
    2.42  
    2.43      if ( is_hvm_vcpu(v) && guest_mode(regs) )
    2.44      {
    2.45          struct segment_register sreg;
    2.46 -        context = "hvm";
    2.47 +        context = CTXT_hvm_guest;
    2.48          fault_crs[0] = v->arch.hvm_vcpu.guest_cr[0];
    2.49          fault_crs[2] = v->arch.hvm_vcpu.guest_cr[2];
    2.50          fault_crs[3] = v->arch.hvm_vcpu.guest_cr[3];
    2.51 @@ -99,12 +111,12 @@ void show_registers(struct cpu_user_regs
    2.52      {
    2.53          if ( guest_mode(regs) )
    2.54          {
    2.55 -            context = "guest";
    2.56 +            context = CTXT_pv_guest;
    2.57              fault_crs[2] = arch_get_cr2(v);
    2.58          }
    2.59          else
    2.60          {
    2.61 -            context = "hypervisor";
    2.62 +            context = CTXT_hypervisor;
    2.63              fault_crs[2] = read_cr2();
    2.64          }
    2.65  
    2.66 @@ -119,7 +131,7 @@ void show_registers(struct cpu_user_regs
    2.67  
    2.68      print_xen_info();
    2.69      printk("CPU:    %d\n", smp_processor_id());
    2.70 -    _show_registers(&fault_regs, fault_crs, guest_mode(regs), context);
    2.71 +    _show_registers(&fault_regs, fault_crs, context, v);
    2.72  
    2.73      if ( this_cpu(ler_msr) && !guest_mode(regs) )
    2.74      {
    2.75 @@ -146,7 +158,7 @@ void vcpu_show_registers(const struct vc
    2.76                                   v->arch.guest_table_user);
    2.77      crs[4] = v->arch.guest_context.ctrlreg[4];
    2.78  
    2.79 -    _show_registers(regs, crs, 1, "guest");
    2.80 +    _show_registers(regs, crs, CTXT_pv_guest, v);
    2.81  }
    2.82  
    2.83  void show_page_walk(unsigned long addr)