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
23void check(const char *func, exinfo_t got, exinfo_t exp);
24
25extern uint32_t vmcs_revid;
30void vmx_collect_data(void);
31
32/* Clear a VMCS, and set a specific revision id. */
33static inline void clear_vmcs(void *_vmcs, uint32_t rev)
34{
35 uint32_t *vmcs = _vmcs;
36
38 vmcs[0] = rev;
39}
40
41/* VMX instruction stubs, wrapped to return exinfo_t information. */
45
46/* Test routines. */
47void test_msr_vmx(void);
48void test_vmxon(void);
49
50#endif /* VVMX_TEST_H */
unsigned int exinfo_t
Packed exception and error code information.
Definition: exinfo.h:19
#define memset(d, c, n)
Definition: libc.h:33
#define PAGE_SIZE
Definition: page.h:11
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
void test_vmxon(void)
Definition: vmxon.c:171
void test_msr_vmx(void)
Definition: msr.c:54
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
uint32_t vmcs_revid
Hardware VMCS Revision ID.
Definition: util.c:53
void vmx_collect_data(void)
Collect real information about the VT-x environment, for use by test.
Definition: util.c:55
exinfo_t stub_vmxon_user(uint64_t paddr)
Definition: util.c:129
exinfo_t stub_vmptrld(uint64_t paddr)
Definition: util.c:103
static void clear_vmcs(void *_vmcs, uint32_t rev)
Definition: test.h:33
exinfo_t stub_vmxon(uint64_t paddr)
Definition: util.c:77
Helpers for VT-x.
static uint8_t vmcs[PAGE_SIZE]
Definition: vmxon.c:10