40#define CR0_SYM(...) TOK_OR(X86_CR0_, ##__VA_ARGS__)
41#define CR0_MASK CR0_SYM(EM, MP, TS)
71 asm volatile (
"test %[fep], %[fep];"
104 asm volatile (
"test %[fep], %[fep];"
136 asm volatile (
"test %[fep], %[fep];"
139 "1: movq %%mm0, %%mm0; 2:"
152 asm volatile (
"test %[fep], %[fep];"
155 "1: movups %%xmm0, %%xmm0; 2:"
184 asm volatile (
"test %[fep], %[fep];"
187 "1: vmovups %%xmm0, %%xmm0; 2:"
197 unsigned int (*fn)(
bool),
bool force,
exinfo_t override)
201 for ( i = 0; i < nr; ++i )
213 snprintf(cr0str,
sizeof(cr0str),
"%s%s%s",
219 _p(exp),
_p(res), cr0str[0] ? cr0str :
" - ");
228 printk(
"Testing%s x87\n", force ?
" emulated" :
"");
231 printk(
"Testing%s x87 wait\n", force ?
" emulated" :
"");
237 printk(
"Testing%s MMX\n", force ?
" emulated" :
"");
245 printk(
"Testing%s SSE\n", force ?
" emulated" :
"");
250 printk(
"Testing%s SSE (CR4.OSFXSR)\n", force ?
" emulated" :
"");
262 printk(
"Testing%s AVX\n", force ?
" emulated" :
"");
267 printk(
"Testing%s AVX (CR4.OSXSAVE)\n", force ?
" emulated" :
"");
274 printk(
"Testing%s AVX (CR4.OSXSAVE+XCR0.YMM)\n", force ?
" emulated" :
"");
290 xtf_skip(
"FEP support not detected - some tests will be skipped\n");
#define _ASM_XEN_FEP
Xen Forced Emulation Prefix.
bool ex_record_fault_eax(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %eax.
static void write_xcr0(uint64_t xcr0)
static unsigned long read_cr4(void)
static void write_cr0(unsigned long cr0)
static void write_cr4(unsigned long cr4)
static unsigned long read_cr0(void)
static uint64_t read_xcr0(void)
bool xtf_has_fep
Boolean indicating whether generic Force Emulation Prefix support is available for the test to use.
void printk(const char *fmt,...)
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
#define EXINFO_SYM(exc, ec)
unsigned int exinfo_t
Packed exception and error code information.
static const struct test_cfg avx[]
AVX instructions.
exinfo_t probe_x87_wait(bool force)
static unsigned long default_cr0
void run_sequence(const struct test_cfg *seq, unsigned int nr, unsigned int(*fn)(bool), bool force, exinfo_t override)
void run_tests(bool force)
static const struct test_cfg mmx_sse[]
MMX and SSE instructions.
exinfo_t probe_mmx(bool force)
static const struct test_cfg x87[]
x87 coprocessor.
exinfo_t probe_x87(bool force)
static exinfo_t probe_avx(bool force)
static const struct test_cfg x87_wait[]
The x87 wait instruction.
exinfo_t probe_sse(bool force)
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
#define _p(v)
Express an abitrary integer v as void *.
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_skip(const char *fmt,...)
Report a test skip.
void xtf_success(const char *fmt,...)
Report test success.
int snprintf(char *buf, size_t size, const char *fmt,...)