Xen Test Framework
test.h
Go to the documentation of this file.
1 #ifndef VVMX_TEST_H
2 #define VVMX_TEST_H
3 
4 #include <xtf.h>
5 
6 #include <arch/vmx.h>
7 
8 /*
9  * Extentions on top of regular EXINFO.
10  *
11  * Use EXINFO_AVAIL{0,1} for VMFail{Invalid,Valid}. (ab)use the fact that
12  * VMFailValid means no exception occured to stash the VMX Instruction Error
13  * code in the low bits, normally used for vector/error_code information.
14  */
15 #define VMERR_SUCCESS 0
16 #define VMERR_INVALID (EXINFO_EXPECTED | EXINFO_AVAIL0)
17 #define VMERR_VALID(x) (EXINFO_EXPECTED | EXINFO_AVAIL1 | ((x) & 0xffff))
18 
23 void check(const char *func, exinfo_t got, exinfo_t exp);
24 
25 extern uint32_t vmcs_revid;
30 void vmx_collect_data(void);
31 
32 /* Clear a VMCS, and set a specific revision id. */
33 static inline void clear_vmcs(void *_vmcs, uint32_t rev)
34 {
35  uint32_t *vmcs = _vmcs;
36 
37  memset(vmcs, 0, PAGE_SIZE);
38  vmcs[0] = rev;
39 }
40 
41 /* VMX instruction stubs, wrapped to return exinfo_t information. */
45 
46 /* Test routines. */
47 void test_msr_vmx(void);
48 void test_vmxon(void);
49 
50 #endif /* VVMX_TEST_H */
unsigned int exinfo_t
Packed exception and error code information.
Definition: exinfo.h:19
void test_msr_vmx(void)
Definition: msr.c:54
void vmx_collect_data(void)
Collect real information about the VT-x environment, for use by test.
Definition: util.c:55
Helpers for VT-x.
#define memset(d, c, n)
Definition: libc.h:33
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
static uint8_t vmcs[PAGE_SIZE]
Definition: vmxon.c:10
exinfo_t stub_vmxon(uint64_t paddr)
Definition: util.c:77
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
exinfo_t stub_vmxon_user(uint64_t paddr)
Definition: util.c:129
void check(const char *func, exinfo_t got, exinfo_t exp)
Compare an expectation against what really happenend, printing human-readable information in case of ...
Definition: util.c:37
#define PAGE_SIZE
Definition: page.h:11
uint32_t vmcs_revid
Hardware VMCS Revision ID.
Definition: util.c:53
exinfo_t stub_vmptrld(uint64_t paddr)
Definition: util.c:103
static void clear_vmcs(void *_vmcs, uint32_t rev)
Definition: test.h:33
void test_vmxon(void)
Definition: vmxon.c:171