diff --git a/proto/vcpu/vcpu.c b/proto/vcpu/vcpu.c new file mode 100644 index 0000000000000000000000000000000000000000..140f3550783089318dc29e1cbac7b7c7103cd256 --- /dev/null +++ b/proto/vcpu/vcpu.c @@ -0,0 +1,20 @@ +#include "vcpu.h" +#include "../debug/debug.h" +#include "../region/vxmon.h" +#include <linux/errno.h> + +int init_vcpu(struct vcpu_t *vcpu, struct vmxon_t *vmxon) { + if (!vcpu) { + DEBUG_FMT("vcpu isn't allocated\n"); + return -EFAULT; + } + + if (!vmxon) { + DEBUG_FMT("vmxon region isn't allocated\n"); + return -EFAULT; + } + + vcpu->vmxon = vmxon; + + return 0; +} diff --git a/proto/vcpu/vcpu.h b/proto/vcpu/vcpu.h new file mode 100644 index 0000000000000000000000000000000000000000..0c17cc06e722d4388981486bf1359a1e2367322e --- /dev/null +++ b/proto/vcpu/vcpu.h @@ -0,0 +1,12 @@ +#pragma once + +#include "../region/vxmon.h" + +struct vcpu_t { + struct vmxon_t *vmxon; + /*NOTE: prolly should store the PAs of pointers to avoid unnecessary + * address translations, although they should reside in the TLB by that + * point*/ +}; + +int init_vcpu(struct vcpu_t *vcpu);