[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V2] libxc, libxenstore: make the headers C++-friendlier
>>> On 23.01.13 at 10:19, Razvan Cojocaru <rzvncj@xxxxxxxxx> wrote: > static inline int _hvm_hw_fix_cpu(void *h) { > - struct hvm_hw_cpu *new=h; > - struct hvm_hw_cpu_compat *old=h; > + struct hvm_hw_cpu *newcpu = (struct hvm_hw_cpu *)h; > + struct hvm_hw_cpu_compat *old = (struct hvm_hw_cpu_compat *)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; > + newcpu->error_code = old->error_code; > + newcpu->pending_event = old->pending_event; > + newcpu->tsc = old->tsc; > + newcpu->msr_tsc_aux = 0; > > return 0; > } Actually I think this needs to be done differently anyway, as the way it currently is it isn't even correct. In particular, I don't think there's anything keeping the compiler from re-ordering the reads and writes (gcc: without -fno-strict-aliasing), thus invalidating the purposeful backward processing. By means of using union hvm_hw_cpu_union { struct hvm_hw_cpu nat; struct hvm_hw_cpu_compat cmp; }; this can be avoided in a compatible manner (and the renaming can be done basically as a side effect). Sorry for not having noticed on the first run through. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |