ia64/xen-unstable

changeset 9942:8761333499ae

SVM patch for 64bit hv, to reset the ss, es, ds host selectors to NULL
during a context switch to the SVM domain's vcpu. This patch also
initializes the tlb_control to 1 for the initial do_launch().
Signed-off-by: Tom Woller <thomas.woller@amd.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 04 21:24:39 2006 +0100 (2006-05-04)
parents ad5b833122a8
children 5afb14264629
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Thu May 04 17:44:14 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu May 04 21:24:39 2006 +0100
     1.3 @@ -61,6 +61,9 @@ static unsigned long trace_values[NR_CPU
     1.4  /* Useful define */
     1.5  #define MAX_INST_SIZE  15
     1.6  
     1.7 +#define set_segment_register(name, value)  \
     1.8 +       __asm__ __volatile__ ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
     1.9 +
    1.10  /* 
    1.11   * External functions, etc. We should move these to some suitable header file(s) */
    1.12  
    1.13 @@ -681,6 +684,17 @@ static void svm_ctxt_switch_from(struct 
    1.14  
    1.15  static void svm_ctxt_switch_to(struct vcpu *v)
    1.16  {
    1.17 +#if __x86_64__
    1.18 +    /* 
    1.19 +     * This is required, because VMRUN does consistency check
    1.20 +     * and some of the DOM0 selectors are pointing to 
    1.21 +     * invalid GDT locations, and cause AMD processors
    1.22 +     * to shutdown.
    1.23 +     */
    1.24 +    set_segment_register(ds, 0);
    1.25 +    set_segment_register(es, 0);
    1.26 +    set_segment_register(ss, 0);
    1.27 +#endif
    1.28  }
    1.29  
    1.30  void svm_final_setup_guest(struct vcpu *v)
     2.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Thu May 04 17:44:14 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Thu May 04 21:24:39 2006 +0100
     2.3 @@ -428,6 +428,8 @@ void svm_do_launch(struct vcpu *v)
     2.4  	
     2.5      if (svm_dbg_on)
     2.6          svm_dump_vmcb(__func__, vmcb);
     2.7 +
     2.8 +    vmcb->tlb_control = 1;
     2.9  }
    2.10  
    2.11