direct-io.hg

changeset 4999:9ad448e1dadd

bitkeeper revision 1.1459 (428c4c45ObcqPNCq2Ebb3M0y4qnxog)

[PATCH] vmx-gdbserver-sstep.patch

This patch enables single stepping a VMX domain using the gdbserver.

Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author arun.sharma@intel.com[kaf24]
date Thu May 19 08:20:21 2005 +0000 (2005-05-19)
parents 77586a4591eb
children ce73b866361b
files xen/arch/x86/domain.c xen/arch/x86/vmx.c xen/arch/x86/vmx_platform.c xen/include/asm-x86/vmx.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Thu May 19 08:06:04 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Thu May 19 08:20:21 2005 +0000
     1.3 @@ -425,6 +425,12 @@ int arch_set_info_guest(
     1.4  
     1.5          /* Ensure real hardware interrupts are enabled. */
     1.6          ed->arch.guest_context.user_regs.eflags |= EF_IE;
     1.7 +    } else {
     1.8 +        __vmwrite(GUEST_EFLAGS, ed->arch.guest_context.user_regs.eflags);
     1.9 +        if (ed->arch.guest_context.user_regs.eflags & EF_TF)
    1.10 +                __vm_set_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_DB);
    1.11 +        else 
    1.12 +                __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_DB);
    1.13      }
    1.14  
    1.15      if ( test_bit(_VCPUF_initialised, &ed->vcpu_flags) )
     2.1 --- a/xen/arch/x86/vmx.c	Thu May 19 08:06:04 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx.c	Thu May 19 08:20:21 2005 +0000
     2.3 @@ -166,7 +166,7 @@ static void vmx_do_no_device_fault()
     2.4          cr0 &= ~X86_CR0_TS;
     2.5          __vmwrite(GUEST_CR0, cr0);
     2.6      }
     2.7 -    __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP);
     2.8 +    __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
     2.9  }
    2.10  
    2.11  static void vmx_do_general_protection_fault(struct cpu_user_regs *regs) 
    2.12 @@ -1110,6 +1110,21 @@ asmlinkage void vmx_vmexit_handler(struc
    2.13              restore_cpu_user_regs(&regs);
    2.14              break;
    2.15          }
    2.16 +#else
    2.17 +        case TRAP_debug:
    2.18 +        {
    2.19 +            void store_cpu_user_regs(struct cpu_user_regs *regs);
    2.20 +            long do_sched_op(unsigned long op);
    2.21 +
    2.22 +
    2.23 +            store_cpu_user_regs(&regs);
    2.24 +            __vm_clear_bit(GUEST_PENDING_DBG_EXCEPTIONS, PENDING_DEBUG_EXC_BS);
    2.25 +
    2.26 +            set_bit(_VCPUF_ctrl_pause, &current->vcpu_flags);
    2.27 +            do_sched_op(SCHEDOP_yield);
    2.28 +
    2.29 +            break;
    2.30 +        }
    2.31  #endif
    2.32          case TRAP_no_device:
    2.33          {
     3.1 --- a/xen/arch/x86/vmx_platform.c	Thu May 19 08:06:04 2005 +0000
     3.2 +++ b/xen/arch/x86/vmx_platform.c	Thu May 19 08:20:21 2005 +0000
     3.3 @@ -49,7 +49,7 @@ static long get_reg_value(int size, int 
     3.4      return 0;
     3.5  }
     3.6  #elif defined (__i386__)
     3.7 -static void store_cpu_user_regs(struct cpu_user_regs *regs)
     3.8 +void store_cpu_user_regs(struct cpu_user_regs *regs)
     3.9  {
    3.10      __vmread(GUEST_SS_SELECTOR, &regs->ss);
    3.11      __vmread(GUEST_ESP, &regs->esp);
     4.1 --- a/xen/include/asm-x86/vmx.h	Thu May 19 08:06:04 2005 +0000
     4.2 +++ b/xen/include/asm-x86/vmx.h	Thu May 19 08:20:21 2005 +0000
     4.3 @@ -131,6 +131,11 @@ extern unsigned int cpu_rev;
     4.4  #define EXCEPTION_BITMAP_MC     (1 << 18)       /* Machine Check */
     4.5  #define EXCEPTION_BITMAP_XF     (1 << 19)       /* SIMD Floating-Point Exception */
     4.6  
     4.7 +/* Pending Debug exceptions */
     4.8 +
     4.9 +#define PENDING_DEBUG_EXC_BP    (1 << 12)       /* break point */
    4.10 +#define PENDING_DEBUG_EXC_BS    (1 << 14)       /* Single step */
    4.11 +
    4.12  #ifdef XEN_DEBUGGER
    4.13  #define MONITOR_DEFAULT_EXCEPTION_BITMAP        \
    4.14      ( EXCEPTION_BITMAP_PG |                     \
    4.15 @@ -231,6 +236,30 @@ static inline int __vmwrite (unsigned lo
    4.16      return 0;
    4.17  }
    4.18  
    4.19 +static inline int __vm_set_bit(unsigned long field, unsigned long mask)
    4.20 +{
    4.21 +        unsigned long tmp;
    4.22 +        int err = 0;
    4.23 +
    4.24 +        err |= __vmread(field, &tmp);
    4.25 +        tmp |= mask;
    4.26 +        err |= __vmwrite(field, tmp);
    4.27 +
    4.28 +        return err;
    4.29 +}
    4.30 +
    4.31 +static inline int __vm_clear_bit(unsigned long field, unsigned long mask)
    4.32 +{
    4.33 +        unsigned long tmp;
    4.34 +        int err = 0;
    4.35 +
    4.36 +        err |= __vmread(field, &tmp);
    4.37 +        tmp &= ~mask;
    4.38 +        err |= __vmwrite(field, tmp);
    4.39 +
    4.40 +        return err;
    4.41 +}
    4.42 +
    4.43  static inline void __vmxoff (void)
    4.44  {
    4.45      __asm__ __volatile__ ( VMXOFF_OPCODE 
    4.46 @@ -263,8 +292,7 @@ static inline void vmx_stts()
    4.47  
    4.48      __vmread(CR0_READ_SHADOW, &cr0);
    4.49      if (!(cr0 & X86_CR0_TS))
    4.50 -       __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP | 
    4.51 -                                   EXCEPTION_BITMAP_NM);
    4.52 +       __vm_set_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
    4.53  }
    4.54   
    4.55  #endif /* __ASM_X86_VMX_H__ */