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

Re: [Xen-devel] [PATCH v15 06/14] x86/hvm: Introduce hvm_save_mtrr_msr_one func



>>> On 03.08.18 at 15:53, <aisaila@xxxxxxxxxxxxxxx> wrote:
> +    for ( i = 0; i < MASK_EXTR(hw_mtrr.msr_mtrr_cap, MTRRcap_VCNT); i++ )
> +    {
> +        /* save physbase */
> +        hw_mtrr.msr_mtrr_var[i * 2] = mtrr_state->var_ranges->base;
> +        /* save physmask */
> +        hw_mtrr.msr_mtrr_var[i * 2 + 1] = mtrr_state->var_ranges->mask;
> +    }

One of the intended side effects of using structure field on the rhs
was to be able to drop the (now redundant) comments.

> -        hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr);
> +    memcpy(hw_mtrr.msr_mtrr_fixed, mtrr_state->fixed_ranges, NUM_FIXED_MSR);

You want to BUILD_BUG_ON() array sizes differing, and then use
sizeof() in the call to memcpy().

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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