direct-io.hg

changeset 5559:16e3155f3496

bitkeeper revision 1.1741 (42ba8952xTiiA50azru9j4tKvXIVDA)

[PATCH] vmx-gdbserver-paging.patch

gdbserver should not try to convert guest physical to machine physical if
paging is not enabled.

Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author arun.sharma@intel.com[kaf24]
date Thu Jun 23 10:05:06 2005 +0000 (2005-06-23)
parents 1a568bb6c3bb
children 51d5c1d35710
files tools/libxc/xc_ptrace.c xen/arch/x86/dom0_ops.c xen/include/public/arch-x86_32.h
line diff
     1.1 --- a/tools/libxc/xc_ptrace.c	Thu Jun 23 10:02:54 2005 +0000
     1.2 +++ b/tools/libxc/xc_ptrace.c	Thu Jun 23 10:05:06 2005 +0000
     1.3 @@ -3,6 +3,8 @@
     1.4  #include "xc_private.h"
     1.5  #include <time.h>
     1.6  
     1.7 +#define X86_CR0_PE              0x00000001 /* Enable Protected Mode    (RW) */
     1.8 +#define X86_CR0_PG              0x80000000 /* Paging                   (RW) */
     1.9  
    1.10  #define BSD_PAGE_MASK	(PAGE_SIZE-1)
    1.11  #define	PG_FRAME	(~((unsigned long)BSD_PAGE_MASK)
    1.12 @@ -132,6 +134,13 @@ static int                      regs_val
    1.13  static unsigned long            cr3[MAX_VIRT_CPUS];
    1.14  static vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
    1.15  
    1.16 +static inline int paging_enabled(vcpu_guest_context_t *v)
    1.17 +{
    1.18 +    unsigned long cr0 = v->cr0;
    1.19 +
    1.20 +    return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
    1.21 +}
    1.22 +
    1.23  /* --------------------- */
    1.24  
    1.25  static void *
    1.26 @@ -179,7 +188,7 @@ map_domain_va(unsigned long domid, int c
    1.27      } 
    1.28      if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */
    1.29  	goto error_out;
    1.30 -    if (ctxt[cpu].flags & VGCF_VMX_GUEST)
    1.31 +    if ((ctxt[cpu].flags & VGCF_VMX_GUEST) && paging_enabled(&ctxt[cpu]))
    1.32          pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
    1.33      if (pde != pde_phys[cpu]) 
    1.34      {
     2.1 --- a/xen/arch/x86/dom0_ops.c	Thu Jun 23 10:02:54 2005 +0000
     2.2 +++ b/xen/arch/x86/dom0_ops.c	Thu Jun 23 10:05:06 2005 +0000
     2.3 @@ -393,8 +393,11 @@ void arch_getdomaininfo_ctxt(
     2.4  
     2.5  #ifdef __i386__
     2.6  #ifdef CONFIG_VMX
     2.7 -    if ( VMX_DOMAIN(v) )
     2.8 +    if ( VMX_DOMAIN(v) ) {
     2.9          save_vmx_cpu_user_regs(&c->user_regs);
    2.10 +        __vmread(CR0_READ_SHADOW, &c->cr0);
    2.11 +        __vmread(CR4_READ_SHADOW, &c->cr4);
    2.12 +    }
    2.13  #endif
    2.14  #endif
    2.15  
     3.1 --- a/xen/include/public/arch-x86_32.h	Thu Jun 23 10:02:54 2005 +0000
     3.2 +++ b/xen/include/public/arch-x86_32.h	Thu Jun 23 10:05:06 2005 +0000
     3.3 @@ -137,6 +137,8 @@ typedef struct vcpu_guest_context {
     3.4      unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
     3.5      unsigned long kernel_ss, kernel_sp;     /* Virtual TSS (only SS1/SP1)   */
     3.6      unsigned long pt_base;                  /* CR3 (pagetable base)         */
     3.7 +    unsigned long cr0;                      /* CR0                          */
     3.8 +    unsigned long cr4;                      /* CR4                          */
     3.9      unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
    3.10      unsigned long event_callback_cs;        /* CS:EIP of event callback     */
    3.11      unsigned long event_callback_eip;