From: Razvan Cojocaru Date: Thu, 24 Jan 2013 14:08:19 +0000 (+0100) Subject: x86/HVM: fixed _hvm_hw_fix_cpu() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7350 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=68c006f4e8f4bd274ab6ce00f0c415c578205a8b;p=xen.git x86/HVM: fixed _hvm_hw_fix_cpu() Prevent the compiler from re-ordering the reads and writes. Suggested by Jan Beulich. Signed-off-by: Razvan Cojocaru Acked-by: Tim Deegan Acked-by: Keir Fraser Committed-by: Jan Beulich --- diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h index a82a5ee421..3664aaf831 100644 --- a/xen/include/public/arch-x86/hvm/save.h +++ b/xen/include/public/arch-x86/hvm/save.h @@ -269,15 +269,18 @@ 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; + } *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; }