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

Re: [Xen-devel] [PATCH v2] fuzz, test x86_emulator: disable sse before including always_inline fns



>>> On 25.09.18 at 01:22, <christopher.w.clark@xxxxxxxxx> wrote:
> --- a/tools/tests/x86_emulator/wrappers.c
> +++ b/tools/tests/x86_emulator/wrappers.c
> @@ -1,5 +1,4 @@
>  #include <stdarg.h>
> -#include <stdio.h>
>  
>  #define WRAP(x) typeof(x) emul_##x
>  #include "x86-emulate.h"

Ah, I see now why you can't take care of the inclusion here.

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

with one cosmetic remark (which I may take care of while committing):

> --- a/tools/tests/x86_emulator/x86-emulate.h
> +++ b/tools/tests/x86_emulator/x86-emulate.h
> @@ -3,11 +3,35 @@
>  #include <stddef.h>
>  #include <stdint.h>
>  #include <stdlib.h>
> -#include <string.h>
> -
> +/*
> + * Use of sse registers must be disabled prior to the definition of
> + * always_inline functions that would use them (memcpy, memset, etc),
> + * so do this as early as possible, aiming to be before any always_inline
> + * functions that are used are declared.
> + * Unfortunately, this cannot be done prior to inclusion of <stdlib.h>
> + * due to functions such as 'atof' that have SSE register return declared,
> + * so do so here, immediately after that.
> + */
>  #if __GNUC__ >= 6
>  #pragma GCC target("no-sse")
>  #endif
> + /*
> + * Attempt detection of unwanted prior inclusion of some headers known to use
> + * always_inline with SSE registers in some library / compiler / optimization
> + * combinations.
> + */
> +#ifdef _STRING_H
> +# error "Must not include <string.h> before x86-emulate.h"
> +#endif
> +#include <string.h>
> +
> +/* EOF is a standard macro defined in <stdio.h> so use it for detection */
> +#ifdef EOF
> +# error "Must not include <stdio.h> before x86-emulate.h"
> +#endif
> +#ifdef WRAP
> +#include <stdio.h>
> +#endif

There's some inconsistency with directive indentation: The two "error"
ones you indent, but the "include" you leave unindented (matching the
pre-existing "pragma"). At least all your additions should be consistent
with one another.

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