ia64/xen-unstable

changeset 19208:e6f1c66874d5

x86 hvm: Allow restore of old images with different segment attribute format.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 13 09:29:52 2009 +0000 (2009-02-13)
parents 726b56720b16
children 67d9d2a4b988
files xen/arch/x86/hvm/hvm.c
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Fri Feb 13 11:23:16 2009 +0900
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri Feb 13 09:29:52 2009 +0000
     1.3 @@ -542,6 +542,22 @@ static int hvm_load_cpu_ctxt(struct doma
     1.4          return -EINVAL;
     1.5      }
     1.6  
     1.7 +    /* Older Xen versions used to save the segment arbytes directly 
     1.8 +     * from the VMCS on Intel hosts.  Detect this and rearrange them
     1.9 +     * into the struct segment_register format. */
    1.10 +#define UNFOLD_ARBYTES(_r)                          \
    1.11 +    if ( (_r & 0xf000) && !(_r & 0x0f00) )          \
    1.12 +        _r = ((_r & 0xff) | ((_r >> 4) & 0xf00))
    1.13 +    UNFOLD_ARBYTES(ctxt.cs_arbytes);
    1.14 +    UNFOLD_ARBYTES(ctxt.ds_arbytes);
    1.15 +    UNFOLD_ARBYTES(ctxt.es_arbytes);
    1.16 +    UNFOLD_ARBYTES(ctxt.fs_arbytes);
    1.17 +    UNFOLD_ARBYTES(ctxt.gs_arbytes);
    1.18 +    UNFOLD_ARBYTES(ctxt.ss_arbytes);
    1.19 +    UNFOLD_ARBYTES(ctxt.tr_arbytes);
    1.20 +    UNFOLD_ARBYTES(ctxt.ldtr_arbytes);
    1.21 +#undef UNFOLD_ARBYTES
    1.22 +
    1.23      /* Architecture-specific vmcs/vmcb bits */
    1.24      if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 )
    1.25          return -EINVAL;