Xen Test Framework
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\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 _XBEGIN_STARTED
Definition: tsx.h:26
static unsigned int _xbegin_safe(void)
Definition: tsx.h:47
#define cpu_has_rtm
Definition: cpuid.h:95
#define _XBEGIN_UD
Definition: tsx.h:27
void printk(const char *fmt,...)
Definition: console.c:134
void xtf_success(const char *fmt,...)
Report test success.
Definition: report.c:38
void test_main(void)
To be implemented by each test, as its entry point.
Definition: main.c:137
#define cpu_has_hle
Definition: cpuid.h:93
static void _xend(void)
Definition: tsx.h:82
const char test_title[]
The title of the test.
Definition: main.c:14