[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [V3 PATCH 6/9] x86/hvm: pkeys, add xstate support for pkeys
>>> On 07.12.15 at 10:16, <huaitong.han@xxxxxxxxx> wrote: > --- a/xen/arch/x86/xstate.c > +++ b/xen/arch/x86/xstate.c > @@ -146,12 +146,15 @@ static void __init setup_xstate_comp(void) > } > } > > -static void *get_xsave_addr(void *xsave, unsigned int xfeature_idx) > +void *get_xsave_addr(void *xsave, unsigned int xfeature_idx) > { > if ( !((1ul << xfeature_idx) & xfeature_mask) ) > return NULL; > > - return xsave + xstate_comp_offsets[xfeature_idx]; > + if ( xsave_area_compressed(xsave) ) > + return xsave + xstate_comp_offsets[xfeature_idx]; > + else > + return xsave + xstate_offsets[xfeature_idx]; For constructs like this I'd really like to ask to avoid as much of the redundancy as possible. The most compact form would probably be return xsave + (xsave_area_compressed(xsave) ? xstate_comp_offsets : xstate_offsets)[xfeature_idx]; But at the very least the "else" should go away. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |