direct-io.hg

changeset 10967:82230c3273e3

[HVM][VMX] Move hvm interface init_hypercall_page initialization into vmx_setup_hvm_funcs.
Signed-off-by: Xin Li <xin.b.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Aug 08 09:59:47 2006 +0100 (2006-08-08)
parents 46df563bf1b8
children 51c227428166
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Aug 08 09:57:24 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Aug 08 09:59:47 2006 +0100
     1.3 @@ -671,6 +671,28 @@ static int check_vmx_controls(u32 ctrls,
     1.4      return 1;
     1.5  }
     1.6  
     1.7 +static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page)
     1.8 +{
     1.9 +    char *p;
    1.10 +    int i;
    1.11 +
    1.12 +    memset(hypercall_page, 0, PAGE_SIZE);
    1.13 +
    1.14 +    for ( i = 0; i < (PAGE_SIZE / 32); i++ )
    1.15 +    {
    1.16 +        p = (char *)(hypercall_page + (i * 32));
    1.17 +        *(u8  *)(p + 0) = 0xb8; /* mov imm32, %eax */
    1.18 +        *(u32 *)(p + 1) = i;
    1.19 +        *(u8  *)(p + 5) = 0x0f; /* vmcall */
    1.20 +        *(u8  *)(p + 6) = 0x01;
    1.21 +        *(u8  *)(p + 7) = 0xc1;
    1.22 +        *(u8  *)(p + 8) = 0xc3; /* ret */
    1.23 +    }
    1.24 +
    1.25 +    /* Don't support HYPERVISOR_iret at the moment */
    1.26 +    *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
    1.27 +}
    1.28 +
    1.29  /* Setup HVM interfaces */
    1.30  static void vmx_setup_hvm_funcs(void)
    1.31  {
    1.32 @@ -691,28 +713,8 @@ static void vmx_setup_hvm_funcs(void)
    1.33      hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg;
    1.34  
    1.35      hvm_funcs.init_ap_context = vmx_init_ap_context;
    1.36 -}
    1.37  
    1.38 -static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page)
    1.39 -{
    1.40 -    char *p;
    1.41 -    int i;
    1.42 -
    1.43 -    memset(hypercall_page, 0, PAGE_SIZE);
    1.44 -
    1.45 -    for ( i = 0; i < (PAGE_SIZE / 32); i++ )
    1.46 -    {
    1.47 -        p = (char *)(hypercall_page + (i * 32));
    1.48 -        *(u8  *)(p + 0) = 0xb8; /* mov imm32, %eax */
    1.49 -        *(u32 *)(p + 1) = i;
    1.50 -        *(u8  *)(p + 5) = 0x0f; /* vmcall */
    1.51 -        *(u8  *)(p + 6) = 0x01;
    1.52 -        *(u8  *)(p + 7) = 0xc1;
    1.53 -        *(u8  *)(p + 8) = 0xc3; /* ret */
    1.54 -    }
    1.55 -
    1.56 -    /* Don't support HYPERVISOR_iret at the moment */
    1.57 -    *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
    1.58 +    hvm_funcs.init_hypercall_page = vmx_init_hypercall_page;
    1.59  }
    1.60  
    1.61  int start_vmx(void)
    1.62 @@ -781,8 +783,6 @@ int start_vmx(void)
    1.63  
    1.64      vmx_setup_hvm_funcs();
    1.65  
    1.66 -    hvm_funcs.init_hypercall_page = vmx_init_hypercall_page;
    1.67 -
    1.68      hvm_enabled = 1;
    1.69  
    1.70      return 1;