Xen Test Framework
tests
rtm-check
main.c
Go to the documentation of this file.
1
12
#include <xtf.h>
13
14
const
char
test_title
[] =
"Test RTM behaviour"
;
15
16
void
test_main
(
void
)
17
{
18
printk
(
"CPUID: HLE %u, RTM %u, RTM_ALWAYS_ABORT %u\n"
,
19
cpu_has_hle
,
cpu_has_rtm
,
cpu_has_rtm_always_abort
);
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
*/
cpu_has_hle
#define cpu_has_hle
Definition:
cpuid.h:94
cpu_has_rtm_always_abort
#define cpu_has_rtm_always_abort
Definition:
cpuid.h:102
cpu_has_rtm
#define cpu_has_rtm
Definition:
cpuid.h:96
printk
void printk(const char *fmt,...)
Definition:
console.c:134
test_main
void test_main(void)
To be implemented by each test, as its entry point.
Definition:
main.c:110
test_title
const char test_title[]
The title of the test.
Definition:
main.c:24
xtf_success
void xtf_success(const char *fmt,...)
Report test success.
Definition:
report.c:38
_XBEGIN_UD
#define _XBEGIN_UD
Definition:
tsx.h:27
_xbegin_safe
static unsigned int _xbegin_safe(void)
Definition:
tsx.h:47
_xend
static void _xend(void)
Definition:
tsx.h:82
_XBEGIN_STARTED
#define _XBEGIN_STARTED
Definition:
tsx.h:26
Generated by
1.9.4