Spaces:
Runtime error
Runtime error
File size: 823 Bytes
8df6da4 |
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 |
#ifndef API_IDENTITY_HH
#define API_IDENTITY_HH
#include "kvmxx.hh"
#include "memmap.hh"
#include <functional>
#include <memory>
#include <vector>
namespace identity {
struct hole {
hole();
hole(void* address, size_t size);
void* address;
size_t size;
};
class vm {
public:
vm(kvm::vm& vm, mem_map& mmap, hole address_space_hole = hole());
~vm();
private:
void *tss;
typedef std::shared_ptr<mem_slot> mem_slot_ptr;
std::vector<mem_slot_ptr> _slots;
};
class vcpu {
public:
vcpu(kvm::vcpu& vcpu, std::function<void ()> guest_func,
unsigned long stack_size = 256 * 1024);
private:
static void thunk(vcpu* vcpu);
void setup_regs();
void setup_sregs();
private:
kvm::vcpu& _vcpu;
std::function<void ()> _guest_func;
std::vector<char> _stack;
};
}
#endif
|