]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/testkext/testvmx.cpp
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tools / tests / testkext / testvmx.cpp
CommitLineData
b0d623f7
A
1/*
2 * testvmx.cpp
3 * testkext
4 *
b0d623f7
A
5 */
6
7#include "testvmx.h"
8
9#if !(defined(__i386__) || defined(__x86_64__))
10#error VMX only supported on i386/x86_64
11#endif
12
13#include <mach/boolean.h>
14#include <i386/vmx.h>
15
16
17#define super IOService
18OSDefineMetaClassAndStructors(testvmx, super);
19
20bool
21testvmx::start( IOService * provider )
22{
0a7de745
A
23 int ret;
24
25 IOLog("%s\n", __PRETTY_FUNCTION__);
26
27 if (!super::start(provider)) {
28 return false;
29 }
30
31 IOLog("Attempting host_vmxon\n");
32 ret = host_vmxon(FALSE);
33 IOLog("host_vmxon: %d\n", ret);
34
35 return true;
b0d623f7
A
36}
37
38void
39testvmx::stop( IOService * provider )
40{
0a7de745
A
41 IOLog("%s\n", __PRETTY_FUNCTION__);
42
43 super::stop(provider);
44
45 IOLog("Attempting host_vmxoff\n");
46 host_vmxoff();
47 IOLog("host_vmxoff called\n");
b0d623f7 48}