Xen Test Framework
main.c
Go to the documentation of this file.
1
30#include <xtf.h>
31
32const char test_title[] = "XSA-123 PoC";
33
34bool test_needs_fep = true;
35
36void test_main(void)
37{
38 unsigned int src = 0x1234, dest = 0;
39
40 asm volatile(_ASM_XEN_FEP
41 /* Explicit %cs segment override. */
42 ".byte 0x2e; mov %[src], %[dest]"
43 : [src] "+r" (src), [dest] "+r" (dest));
44
45 if ( dest != 0x1234 )
46 xtf_failure(" '%%cs:mov %%reg, %%reg' clobbered hypervisor memory\n");
47 else
48 xtf_success(" '%%cs:mov %%reg, %%reg' was emulated correctly\n");
49}
50
51/*
52 * Local variables:
53 * mode: C
54 * c-file-style: "BSD"
55 * c-basic-offset: 4
56 * tab-width: 4
57 * indent-tabs-mode: nil
58 * End:
59 */
#define _ASM_XEN_FEP
Xen Forced Emulation Prefix.
Definition: xen.h:150
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:110
const char test_title[]
The title of the test.
Definition: main.c:24
void xtf_failure(const char *fmt,...)
Report a test failure.
Definition: report.c:94
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
bool test_needs_fep
Boolean indicating whether the test is entirely predicated on the available of the Force Emulation Pr...
Definition: main.c:34