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

Re: [Xen-devel] [PATCH] x86: properly macroize the two XRSTOR flavors



On 27/11/15 11:54, Jan Beulich wrote:
> All they differ by is the REX64 prefix. Create a single macro covering
> both, at once allowing to get rid of the disconnect between the current
> partial macro and its two use sites.
>
> No change in generated code.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -334,16 +334,6 @@ void xsave(struct vcpu *v, uint64_t mask
>          ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = word_size;
>  }
>  
> -#define XRSTOR_FIXUP   ".section .fixup,\"ax\"           \n"    \
> -                       "2: mov %[size],%%ecx             \n"    \
> -                       "   xor %[lmask_out],%[lmask_out] \n"    \
> -                       "   rep stosb                     \n"    \
> -                       "   lea %[mem],%[ptr]             \n"    \
> -                       "   mov %[lmask_in],%[lmask_out]  \n"    \
> -                       "   jmp 1b                        \n"    \
> -                       ".previous                        \n"    \
> -                       _ASM_EXTABLE(1b, 2b)
> -
>  void xrstor(struct vcpu *v, uint64_t mask)
>  {
>      uint32_t hmask = mask >> 32;
> @@ -372,29 +362,33 @@ void xrstor(struct vcpu *v, uint64_t mas
>       */
>      switch ( __builtin_expect(ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET], 8) )
>      {
> +#define XRSTOR(pfx) \
> +        alternative_io("1: .byte " pfx "0x0f,0xae,0x2f\n" \
> +                       "   .section .fixup,\"ax\"\n" \
> +                       "2: mov %[size],%%ecx\n" \
> +                       "   xor %[lmask_out],%[lmask_out]\n" \
> +                       "   rep stosb\n" \
> +                       "   lea %[mem],%[ptr]\n" \
> +                       "   mov %[lmask_in],%[lmask_out]\n" \
> +                       "   jmp 1b\n" \
> +                       "   .previous\n" \
> +                       _ASM_EXTABLE(1b, 2b), \
> +                       ".byte " pfx "0x0f,0xc7,0x1f\n", \
> +                       X86_FEATURE_XSAVES, \
> +                       ASM_OUTPUT2([ptr] "+&D" (ptr), [lmask_out] "+&a" 
> (lmask)), \
> +                       [mem] "m" (*ptr), [lmask_in] "g" (lmask), \
> +                       [hmask] "d" (hmask), [size] "m" (xsave_cntxt_size) \
> +                       : "ecx")

Please align the \'s on the RHS.  It makes the resulting blob rather
easier to read, especially given the \n's in the text.

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

_______________________________________________
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®.