Xen Test Framework
Data Structures | Macros | Functions | Variables
main.c File Reference

FPU Exception Emulation - Emulation of FPU exceptions More...

#include <xtf.h>
+ Include dependency graph for main.c:

Go to the source code of this file.

Data Structures

struct  test_cfg
 

Macros

#define CR0_SYM(...)   TOK_OR(X86_CR0_, ##__VA_ARGS__)
 
#define CR0_MASK   CR0_SYM(EM, MP, TS)
 

Functions

exinfo_t probe_x87 (bool force)
 
exinfo_t probe_x87_wait (bool force)
 
exinfo_t probe_mmx (bool force)
 
exinfo_t probe_sse (bool force)
 
static exinfo_t probe_avx (bool force)
 
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)
 
void test_main (void)
 To be implemented by each test, as its entry point. More...
 

Variables

const char test_title [] = "FPU Exception Emulation"
 The title of the test. More...
 
static unsigned long default_cr0
 
static const struct test_cfg x87 []
 x87 coprocessor. More...
 
static const struct test_cfg x87_wait []
 The x87 wait instruction. More...
 
static const struct test_cfg mmx_sse []
 MMX and SSE instructions. More...
 
static const struct test_cfg avx []
 AVX instructions. More...
 

Detailed Description

FPU Exception Emulation - Emulation of FPU exceptions

Definition in file main.c.

Macro Definition Documentation

◆ CR0_SYM

#define CR0_SYM (   ...)    TOK_OR(X86_CR0_, ##__VA_ARGS__)

Definition at line 40 of file main.c.

◆ CR0_MASK

#define CR0_MASK   CR0_SYM(EM, MP, TS)

Definition at line 41 of file main.c.

Function Documentation

◆ probe_x87()

exinfo_t probe_x87 ( bool  force)

Definition at line 67 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ probe_x87_wait()

exinfo_t probe_x87_wait ( bool  force)

Definition at line 100 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ probe_mmx()

exinfo_t probe_mmx ( bool  force)

Definition at line 132 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ probe_sse()

exinfo_t probe_sse ( bool  force)

Definition at line 148 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ probe_avx()

static exinfo_t probe_avx ( bool  force)
static

Definition at line 180 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_sequence()

void run_sequence ( const struct test_cfg seq,
unsigned int  nr,
unsigned int(*)(bool fn,
bool  force,
exinfo_t  override 
)

Definition at line 196 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_tests()

void run_tests ( bool  force)

Definition at line 224 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_main()

void test_main ( void  )

To be implemented by each test, as its entry point.

Definition at line 283 of file main.c.

+ Here is the call graph for this function:

Variable Documentation

◆ test_title

const char test_title[] = "FPU Exception Emulation"

The title of the test.

Definition at line 38 of file main.c.

◆ default_cr0

unsigned long default_cr0
static

Definition at line 49 of file main.c.

◆ x87

const struct test_cfg x87[]
static
Initial value:
=
{
{ CR0_SYM( ), 0 },
{ CR0_SYM( TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM( MP ), 0 },
{ CR0_SYM( MP, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM ), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM, MP ), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM, MP, TS), EXINFO_SYM(NM, 0) },
}
#define EXINFO_SYM(exc, ec)
Definition: exinfo.h:29
#define CR0_SYM(...)
Definition: main.c:40

x87 coprocessor.

Should raise #NM if emulation is enabled (no coprocessor available) or if the task has switched.

Definition at line 55 of file main.c.

◆ x87_wait

const struct test_cfg x87_wait[]
static
Initial value:
=
{
{ CR0_SYM( ), 0 },
{ CR0_SYM( TS), 0 },
{ CR0_SYM( MP ), 0 },
{ CR0_SYM( MP, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM ), 0 },
{ CR0_SYM(EM, TS), 0 },
{ CR0_SYM(EM, MP ), 0 },
{ CR0_SYM(EM, MP, TS), EXINFO_SYM(NM, 0) },
}

The x87 wait instruction.

This instruction behaves differently, and should only raise #NM when monitoring the coprocessor and the task has switched.

Definition at line 88 of file main.c.

◆ mmx_sse

const struct test_cfg mmx_sse[]
static
Initial value:
=
{
{ CR0_SYM( ), 0 },
{ CR0_SYM( TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM( MP ), 0 },
{ CR0_SYM( MP, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM ), EXINFO_SYM(UD, 0) },
{ CR0_SYM(EM, TS), EXINFO_SYM(UD, 0) },
{ CR0_SYM(EM, MP ), EXINFO_SYM(UD, 0) },
{ CR0_SYM(EM, MP, TS), EXINFO_SYM(UD, 0) },
}

MMX and SSE instructions.

Emulation is unsupported (thus raising #UD), but #NM should be raised if the task has been switched.

Definition at line 120 of file main.c.

◆ avx

const struct test_cfg avx[]
static
Initial value:
=
{
{ CR0_SYM( ), 0 },
{ CR0_SYM( TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM( MP ), 0 },
{ CR0_SYM( MP, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM ), 0 },
{ CR0_SYM(EM, TS), EXINFO_SYM(NM, 0) },
{ CR0_SYM(EM, MP ), 0 },
{ CR0_SYM(EM, MP, TS), EXINFO_SYM(NM, 0) },
}

AVX instructions.

The emulation flag is meaningless, but #NM should be raised if the task has been switched.

Definition at line 168 of file main.c.