direct-io.hg

changeset 6705:a5e9a7fcade9

cleanups
author kaf24@firebug.cl.cam.ac.uk
date Fri Sep 09 16:17:17 2005 +0000 (2005-09-09)
parents 16cd990994d5
children 0c7379b702e5
files tools/python/xen/lowlevel/xc/xc.c xen/arch/x86/dom0_ops.c xen/arch/x86/setup.c xen/arch/x86/vmx.c xen/common/kernel.c xen/include/asm-x86/vmx.h xen/include/public/version.h
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Sep 09 15:52:52 2005 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri Sep 09 16:17:17 2005 +0000
     1.3 @@ -756,7 +756,7 @@ static PyObject *pyxc_xeninfo(PyObject *
     1.4                           "xen_major", xen_version >> 16,
     1.5                           "xen_minor", (xen_version & 0xffff),
     1.6                           "xen_extra", xen_extra,
     1.7 -                         "xen_caps",  xen_caps.caps,
     1.8 +                         "xen_caps",  xen_caps,
     1.9                           "xen_params", str,
    1.10                           "xen_changeset", xen_chgset,
    1.11                           "cc_compiler", xen_cc.compiler,
     2.1 --- a/xen/arch/x86/dom0_ops.c	Fri Sep 09 15:52:52 2005 +0000
     2.2 +++ b/xen/arch/x86/dom0_ops.c	Fri Sep 09 16:17:17 2005 +0000
     2.3 @@ -35,13 +35,13 @@ static unsigned long msr_hi;
     2.4  
     2.5  static void write_msr_for(void *unused)
     2.6  {
     2.7 -    if (((1 << current->processor) & msr_cpu_mask))
     2.8 +    if ( ((1 << current->processor) & msr_cpu_mask) )
     2.9          (void)wrmsr_user(msr_addr, msr_lo, msr_hi);
    2.10  }
    2.11  
    2.12  static void read_msr_for(void *unused)
    2.13  {
    2.14 -    if (((1 << current->processor) & msr_cpu_mask))
    2.15 +    if ( ((1 << current->processor) & msr_cpu_mask) )
    2.16          (void)rdmsr_user(msr_addr, msr_lo, msr_hi);
    2.17  }
    2.18  
    2.19 @@ -189,11 +189,11 @@ long arch_do_dom0_op(dom0_op_t *op, dom0
    2.20          pi->total_pages      = max_page;
    2.21          pi->free_pages       = avail_domheap_pages();
    2.22          pi->cpu_khz          = cpu_khz;
    2.23 -        memset( pi->hw_cap, 0, sizeof(pi->hw_cap) );
    2.24 -        memcpy( pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4 );
    2.25 +        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
    2.26 +        memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
    2.27          ret = 0;
    2.28 -        if( copy_to_user(u_dom0_op, op, sizeof(*op)) )
    2.29 -	    ret = -EINVAL;
    2.30 +        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
    2.31 +	    ret = -EFAULT;
    2.32      }
    2.33      break;
    2.34      
     3.1 --- a/xen/arch/x86/setup.c	Fri Sep 09 15:52:52 2005 +0000
     3.2 +++ b/xen/arch/x86/setup.c	Fri Sep 09 16:17:17 2005 +0000
     3.3 @@ -93,8 +93,6 @@ unsigned long mmu_cr4_features = X86_CR4
     3.4  #endif
     3.5  EXPORT_SYMBOL(mmu_cr4_features);
     3.6  
     3.7 -int hvm_enabled = 0; /* can we run unmodified guests */
     3.8 -
     3.9  struct vcpu *idle_task[NR_CPUS] = { &idle0_vcpu };
    3.10  
    3.11  int acpi_disabled;
    3.12 @@ -533,43 +531,44 @@ void __init __start_xen(multiboot_info_t
    3.13      startup_cpu_idle_loop();
    3.14  }
    3.15  
    3.16 -void arch_get_xen_caps(xen_capabilities_info_t *info)
    3.17 +void arch_get_xen_caps(xen_capabilities_info_t info)
    3.18  {
    3.19 -    char *p=info->caps;
    3.20 +    char *p = info;
    3.21  
    3.22 -    *p=0;
    3.23 -
    3.24 -#ifdef CONFIG_X86_32
    3.25 +#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
    3.26  
    3.27 -#ifndef CONFIG_X86_PAE       
    3.28 -    p+=sprintf(p,"xen_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);    
    3.29 -    if(hvm_enabled)
    3.30 +    p += sprintf(p, "xen_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
    3.31 +    if ( hvm_enabled )
    3.32 +        p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
    3.33 +
    3.34 +#elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
    3.35 +
    3.36 +    p += sprintf(p, "xen_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
    3.37 +    if ( hvm_enabled )
    3.38      {
    3.39 -        p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);    
    3.40 -    }
    3.41 -#else
    3.42 -    p+=sprintf(p,"xen_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
    3.43 -    if(hvm_enabled)
    3.44 -    {
    3.45 -        //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);    
    3.46 -        //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);    
    3.47 +        //p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
    3.48 +        //p += sprintf(p, "hvm_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
    3.49      }
    3.50  
    3.51 -#endif        
    3.52 +#elif defined(CONFIG_X86_64)
    3.53  
    3.54 -#else /* !CONFIG_X86_32 */
    3.55 -    p+=sprintf(p,"xen_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);
    3.56 -    if(hvm_enabled)
    3.57 +    p += sprintf(p, "xen_%d.%d_x86_64 ", XEN_VERSION, XEN_SUBVERSION);
    3.58 +    if ( hvm_enabled )
    3.59      {
    3.60 -        //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);    
    3.61 -        //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);    
    3.62 -        p+=sprintf(p,"hvm_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);    
    3.63 +        //p += sprintf(p, "hvm_%d.%d_x86_32 ", XEN_VERSION, XEN_SUBVERSION);
    3.64 +        //p += sprintf(p, "hvm_%d.%d_x86_32p ", XEN_VERSION, XEN_SUBVERSION);
    3.65 +        p += sprintf(p, "hvm_%d.%d_x86_64 ", XEN_VERSION, XEN_SUBVERSION);
    3.66      }
    3.67 +
    3.68 +#else
    3.69 +
    3.70 +    p++;
    3.71 +
    3.72  #endif
    3.73      
    3.74 -    BUG_ON((p-info->caps)>sizeof(*info));
    3.75 +    *(p-1) = 0;
    3.76  
    3.77 -    if(p>info->caps) *(p-1) = 0;
    3.78 +    BUG_ON((p - info) > sizeof(info));
    3.79  }
    3.80  
    3.81  /*
     4.1 --- a/xen/arch/x86/vmx.c	Fri Sep 09 15:52:52 2005 +0000
     4.2 +++ b/xen/arch/x86/vmx.c	Fri Sep 09 16:17:17 2005 +0000
     4.3 @@ -44,14 +44,14 @@
     4.4  
     4.5  #include <public/io/ioreq.h>
     4.6  
     4.7 +int hvm_enabled;
     4.8 +
     4.9  #ifdef CONFIG_VMX
    4.10  
    4.11  int vmcs_size;
    4.12  unsigned int opt_vmx_debug_level = 0;
    4.13  integer_param("vmx_debug", opt_vmx_debug_level);
    4.14  
    4.15 -extern int hvm_enabled;
    4.16 -
    4.17  #ifdef TRACE_BUFFER
    4.18  static unsigned long trace_values[NR_CPUS][4];
    4.19  #define TRACE_VMEXIT(index,value) trace_values[current->processor][index]=value
     5.1 --- a/xen/common/kernel.c	Fri Sep 09 15:52:52 2005 +0000
     5.2 +++ b/xen/common/kernel.c	Fri Sep 09 16:17:17 2005 +0000
     5.3 @@ -114,12 +114,12 @@ long do_xen_version(int cmd, void *arg)
     5.4      case XENVER_capabilities:
     5.5      {
     5.6          xen_capabilities_info_t info;
     5.7 -        extern void arch_get_xen_caps(xen_capabilities_info_t * info);
     5.8 -        
     5.9 -        memset(&info, 0, sizeof(info));
    5.10 -        arch_get_xen_caps(&info);
    5.11 +        extern void arch_get_xen_caps(xen_capabilities_info_t info);
    5.12  
    5.13 -        if ( copy_to_user(arg, &info, sizeof(info)) )
    5.14 +        memset(info, 0, sizeof(info));
    5.15 +        arch_get_xen_caps(info);
    5.16 +
    5.17 +        if ( copy_to_user(arg, info, sizeof(info)) )
    5.18              return -EFAULT;
    5.19          return 0;
    5.20      }
    5.21 @@ -127,7 +127,6 @@ long do_xen_version(int cmd, void *arg)
    5.22      case XENVER_parameters:
    5.23      {
    5.24          xen_parameters_info_t info = { .virt_start = HYPERVISOR_VIRT_START };
    5.25 -
    5.26          if ( copy_to_user(arg, &info, sizeof(info)) )
    5.27              return -EFAULT;
    5.28          return 0;
     6.1 --- a/xen/include/asm-x86/vmx.h	Fri Sep 09 15:52:52 2005 +0000
     6.2 +++ b/xen/include/asm-x86/vmx.h	Fri Sep 09 16:17:17 2005 +0000
     6.3 @@ -28,6 +28,8 @@
     6.4  
     6.5  #include <public/io/ioreq.h>
     6.6  
     6.7 +extern int hvm_enabled;
     6.8 +
     6.9  extern void vmx_asm_vmexit_handler(struct cpu_user_regs);
    6.10  extern void vmx_asm_do_resume(void);
    6.11  extern void vmx_asm_do_launch(void);
     7.1 --- a/xen/include/public/version.h	Fri Sep 09 15:52:52 2005 +0000
     7.2 +++ b/xen/include/public/version.h	Fri Sep 09 16:17:17 2005 +0000
     7.3 @@ -29,16 +29,14 @@ typedef struct xen_compile_info {
     7.4  } xen_compile_info_t;
     7.5  
     7.6  #define XENVER_capabilities 3
     7.7 -typedef struct xen_capabilities_info {
     7.8 -    char caps[1024];
     7.9 -} xen_capabilities_info_t;
    7.10 +typedef char xen_capabilities_info_t[1024];
    7.11  
    7.12  #define XENVER_changeset 4
    7.13  typedef char xen_changeset_info_t[64];
    7.14  
    7.15  #define XENVER_parameters 5
    7.16 -typedef struct xen_paramaters_info {
    7.17 -unsigned long virt_start;
    7.18 +typedef struct xen_parameters_info {
    7.19 +    unsigned long virt_start;
    7.20  } xen_parameters_info_t;
    7.21  
    7.22  #endif /* __XEN_PUBLIC_VERSION_H__ */