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

Re: [Xen-devel] [PATCH v4 04/10] x86: Add support for STAC/CLAC instructions



>>> On 05.05.14 at 10:21, <feng.wu@xxxxxxxxx> wrote:
> +#ifdef __ASSEMBLY__
> +#define ASM_AC(op)                                       \
> +        btl $X86_FEATURE_SMAP & 31,                      \
> +        CPUINFO_FEATURE_OFFSET(X86_FEATURE_SMAP)+boot_cpu_data(%rip); \
> +        jnc 881f;                                        \
> +        __ASM_##op;                                      \
> +881:
> +#else
> +#define ASM_AC(op)                                       \
> +        "btl $" __stringify(X86_FEATURE_SMAP) "&31, "    \
> +        CPUINFO_FEATURE_OFFSET(X86_FEATURE_SMAP)         \
> +        "+ boot_cpu_data(%%rip)\n\t"                     \
> +        "jnc 881f\n\t"                                   \
> +         __stringify(__ASM_##op) "\n\t"                  \
> +"881:"

Please use something like .L##op##%= as the label name for the C
version ...

> +static inline void clac(void)
> +{
> +    asm volatile (ASM_CLAC : : : "memory");
> +}
> +
> +static inline void stac(void)
> +{
> +    asm volatile (ASM_STAC : : : "memory");
> +}

... provided it wouldn't be better anyway to do all this properly in
C, with just the raw instructions emitted via asm(). That would also
eliminate the need for the C variant of CPUINFO_FEATURE_OFFSET()
in the first patch.

Jan


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