Xen Test Framework
Loading...
Searching...
No Matches
tests
nested-vmx
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. */
42
exinfo_t
stub_vmxon
(
uint64_t
paddr);
43
exinfo_t
stub_vmptrld
(
uint64_t
paddr);
44
exinfo_t
stub_vmxon_user
(
uint64_t
paddr);
45
46
/* Test routines. */
47
void
test_msr_vmx
(
void
);
48
void
test_vmxon
(
void
);
49
50
#endif
/* VVMX_TEST_H */
exinfo_t
unsigned int exinfo_t
Packed exception and error code information.
Definition
exinfo.h:19
memset
#define memset(d, c, n)
Definition
libc.h:33
PAGE_SIZE
#define PAGE_SIZE
Definition
page.h:11
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:16
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
test_vmxon
void test_vmxon(void)
Definition
vmxon.c:171
test_msr_vmx
void test_msr_vmx(void)
Definition
msr.c:54
check
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
vmcs_revid
uint32_t vmcs_revid
Hardware VMCS Revision ID.
Definition
util.c:53
vmx_collect_data
void vmx_collect_data(void)
Collect real information about the VT-x environment, for use by test.
Definition
util.c:55
stub_vmxon_user
exinfo_t stub_vmxon_user(uint64_t paddr)
Definition
util.c:129
clear_vmcs
static void clear_vmcs(void *_vmcs, uint32_t rev)
Definition
test.h:33
vmx.h
Helpers for VT-x.
vmcs
static uint8_t vmcs[PAGE_SIZE]
Definition
vmxon.c:10
stub_vmptrld
static exinfo_t stub_vmptrld(void)
Definition
main.c:42
stub_vmxon
static exinfo_t stub_vmxon(void)
Definition
main.c:132
Generated by
1.9.8