Currently it just identifies whether the Forced Emulation Prefix is available.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
setup_pv_console();
}
+/*
+ * Common test setup:
+ *
+ * xtf_has_* indicates the availabiliy of options which require runtime
+ * detection.
+ */
+bool xtf_has_fep = false;
+
+void test_setup(void)
+{
+ /*
+ * Attempt to use the forced emulation prefix to set the value of
+ * xtf_has_fep to the value of 1. Use the exception table to compensate
+ * for the #UD exception if FEP is not available.
+ */
+ asm volatile ("xor %0, %0;"
+ "1: ud2a; .ascii \"xen\";"
+ "mov $1, %0;"
+ "2:"
+ _ASM_EXTABLE(1b, 2b)
+ : "=q" (xtf_has_fep));
+}
+
/*
* Local variables:
* mode: C
printk("--- Xen Test Framework ---\n");
printk("Environment: %s\n", environment_description);
+ test_setup();
+
test_main();
xtf_report_status();
/* To be implemented by each arch */
void arch_setup(void);
+void test_setup(void);
/* Single line summary of execution environment. */
extern const char *environment_description;
#ifndef XTF_TEST_H
#define XTF_TEST_H
+#include <xtf/types.h>
+
/**
* To be implemented by each test, as its entry point.
*/
void test_main(void);
+/**
+ * Boolean indicating whether generic Force Emulation Prefix support is
+ * available for the test to use.
+ */
+extern const bool xtf_has_fep;
+
#endif /* XTF_TEST_H */
/*