-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathVm.hpp
More file actions
48 lines (37 loc) · 789 Bytes
/
Copy pathVm.hpp
File metadata and controls
48 lines (37 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "Flag.hpp"
#include <cstdint>
#include <vector>
#include <memory>
#include <WinHvPlatform.h>
class Vcpu;
class Vm
{
public:
typedef uint64_t gpa_t;
enum prot_t : uint64_t {
PROT_NONE = 0,
PROT_READ = WHvMapGpaRangeFlagRead,
PROT_WRITE = WHvMapGpaRangeFlagWrite,
PROT_EXEC = WHvMapGpaRangeFlagExecute,
};
private:
static const int MAX_VCPU = 8;
WHV_PARTITION_HANDLE m_handle;
std::array<std::unique_ptr<Vcpu>, MAX_VCPU> m_vcpu;
public:
// CREATORS
Vm();
~Vm();
// MANIPULATORS
void
map(gpa_t gpa, void *hva, size_t size, prot_t prot);
Vcpu&
createVcpu();
void
deleteVcpu(UINT32 id);
// ACCESSORS
const WHV_PARTITION_HANDLE
getHandle() { return m_handle; }
};
ENUM_FLAG(Vm::prot_t);