x86/emulator: add feature checks for newer instructions
PATCH 1/2 x86/emulator: add feature checks for newer instructions
Certain instructions were introduced only after the i686 or original x86-64 architecture, so we should not try to emulate them if the guest is not seeing the respective feature enabled (or, worse, if the underlying hardware doesn't support them). This affects fisttp, movnti, and cmpxchg16b.
Also add a "run" target to the test code makefile, to simplify building and running.
tools/tests/x86_emulator/Makefile +4 -1
@@ -7,6 +7,9 @@ TARGET := test_x86_emulator .PHONY: all all: $(TARGET) +run: $(TARGET) + ./$(TARGET) + .PHONY: blowfish.h blowfish.h: rm -f blowfish.bin
@@ -38,7 +41,7 @@ x86_emulate: [ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate . x86_emulate.o: x86_emulate.c x86_emulate - $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $< + $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -imacros asm-x86/cpufeature.h -c -o $@ $< test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
tools/tests/x86_emulator/x86_emulate.c +6 -0
@@ -1,7 +1,13 @@ +#include <stdbool.h> #include <stddef.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include <public/xen.h> +typedef bool bool_t ; + +#define BUG () abort() +#include "x86_emulate/x86_emulate.h" #include "x86_emulate/x86_emulate.c"
xen/arch/x86/x86_emulate.c +1 -0
@@ -9,6 +9,7 @@* Keir Fraser <[email protected]> */ +#include <asm/cpufeature.h> #include <asm/x86_emulate.h> /* Avoid namespace pollution. */
xen/arch/x86/x86_emulate/x86_emulate.c +50 -0
86 lines not on this page · raw message
x86/emulator: add feature checks for newer instructions
Certain instructions were introduced only after the i686 or original x86-64 architecture, so we should not try to emulate them if the guest is not seeing the respective feature enabled (or, worse, if the underlying hardware doesn't support them). This affects fisttp, movnti, and cmpxchg16b.
Also add a "run" target to the test code makefile, to simplify building and running.
tools/tests/x86_emulator/Makefile +4 -1
@@ -7,6 +7,9 @@ TARGET := test_x86_emulator .PHONY: all all: $(TARGET) +run: $(TARGET) + ./$(TARGET) + .PHONY: blowfish.h blowfish.h: rm -f blowfish.bin
@@ -38,7 +41,7 @@ x86_emulate: [ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate . x86_emulate.o: x86_emulate.c x86_emulate - $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $< + $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -imacros asm-x86/cpufeature.h -c -o $@ $< test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
tools/tests/x86_emulator/x86_emulate.c +6 -0
@@ -1,7 +1,13 @@ +#include <stdbool.h> #include <stddef.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include <public/xen.h> +typedef bool bool_t ; + +#define BUG () abort() +#include "x86_emulate/x86_emulate.h" #include "x86_emulate/x86_emulate.c"
xen/arch/x86/x86_emulate.c +1 -0
@@ -9,6 +9,7 @@* Keir Fraser <[email protected]> */ +#include <asm/cpufeature.h> #include <asm/x86_emulate.h> /* Avoid namespace pollution. */
xen/arch/x86/x86_emulate/x86_emulate.c +50 -0
86 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel