Xen Test Framework
main.c
Go to the documentation of this file.
1
12#include <xtf.h>
13
14const char test_title[] = "Test RTM behaviour";
15
16void test_main(void)
17{
18 printk("CPUID: HLE %u, RTM %u, RTM_ALWAYS_ABORT %u\n",
20
21 for ( int i = 0; i < 1000; ++i )
22 {
23 unsigned int xstatus = _xbegin_safe();
24
25 if ( xstatus == _XBEGIN_STARTED )
26 {
27 _xend();
28 return xtf_success("RTM usable\n");
29 }
30 else if ( xstatus == _XBEGIN_UD )
31 return xtf_success("RTM unavailable\n");
32 }
33
34 xtf_success("RTM always aborting\n");
35}
36
37/*
38 * Local variables:
39 * mode: C
40 * c-file-style: "BSD"
41 * c-basic-offset: 4
42 * tab-width: 4
43 * indent-tabs-mode: nil
44 * End:
45 */
#define cpu_has_hle
Definition: cpuid.h:94
#define cpu_has_rtm_always_abort
Definition: cpuid.h:102
#define cpu_has_rtm
Definition: cpuid.h:96
void printk(const char *fmt,...)
Definition: console.c:134
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_success(const char *fmt,...)
Report test success.
Definition: report.c:38
#define _XBEGIN_UD
Definition: tsx.h:27
static unsigned int _xbegin_safe(void)
Definition: tsx.h:47
static void _xend(void)
Definition: tsx.h:82
#define _XBEGIN_STARTED
Definition: tsx.h:26