x86emul/test: keep compiler from using {x,y,z}mm registers itself
authorJan Beulich <jbeulich@suse.com>
Thu, 23 Nov 2017 10:40:31 +0000 (11:40 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 23 Nov 2017 10:40:31 +0000 (11:40 +0100)
Since the emulator acts on the live hardware registers, we need to
prevent the compiler from using them e.g. for inlined memcpy() /
memset() (as gcc7 does). We can't, however, set this from the command
line, as otherwise the 64-bit build would face issues with functions
returning floating point values and being declared in standard headers.

As the pragma isn't available prior to gcc6, we need to invoke it
conditionally. Luckily up to gcc6 we haven't seen generated code access
SIMD registers beyond what our asm()s do.

Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
tools/tests/x86_emulator/x86-emulate.h

index b90101004febc212f5e3a011e779372c8a17d9ae..fbf2944547fd50253bc371b4b611f15441bace9b 100644 (file)
@@ -4,6 +4,11 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+
+#if __GNUC__ >= 6
+#pragma GCC target("no-sse")
+#endif
+
 #include <xen/xen.h>
 
 #include <asm/msr-index.h>