[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2 of 2 V4] x86/HVM: fixed _hvm_hw_fix_cpu()



At 17:46 +0200 on 23 Jan (1358963209), Razvan Cojocaru wrote:
> Prevent the compiler from re-ordering the reads and writes.
> Suggested by Jan Beulich.
> 
> Signed-off-by: Razvan Cojocaru <rzvncj@xxxxxxxxx>

Acked-by: Tim Deegan <tim@xxxxxxx>

> diff -r 3a9979cf50f3 -r 550e437674c7 xen/include/public/arch-x86/hvm/save.h
> --- a/xen/include/public/arch-x86/hvm/save.h  Wed Jan 23 17:27:20 2013 +0200
> +++ b/xen/include/public/arch-x86/hvm/save.h  Wed Jan 23 17:44:20 2013 +0200
> @@ -269,15 +269,20 @@ struct hvm_hw_cpu_compat {
>  };
>  
>  static inline int _hvm_hw_fix_cpu(void *h) {
> -    struct hvm_hw_cpu *new=h;
> -    struct hvm_hw_cpu_compat *old=h;
> +
> +    union hvm_hw_cpu_union {
> +        struct hvm_hw_cpu nat;
> +        struct hvm_hw_cpu_compat cmp;
> +    };
> +
> +    union hvm_hw_cpu_union *ucpu = (union hvm_hw_cpu_union *)h;;
>  
>      /* If we copy from the end backwards, we should
>       * be able to do the modification in-place */
> -    new->error_code=old->error_code;
> -    new->pending_event=old->pending_event;
> -    new->tsc=old->tsc;
> -    new->msr_tsc_aux=0;
> +    ucpu->nat.error_code = ucpu->cmp.error_code;
> +    ucpu->nat.pending_event = ucpu->cmp.pending_event;
> +    ucpu->nat.tsc = ucpu->cmp.tsc;
> +    ucpu->nat.msr_tsc_aux = 0;
>  
>      return 0;
>  }
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.