#include <palacios/vmm_types.h>
#include <palacios/vmcs.h>
+#include <palacios/vmm.h>
+#include <palacios/vm_guest.h>
// Intel VMX Specific MSRs
#define VMX_FEATURE_CONTROL_MSR 0x0000003a
uint_t rsvd2 : 10; // Always 0
} __attribute__((packed));
+typedef enum {
+ VMXASSIST_STARTUP,
+ VMXASSIST_V8086_BIOS,
+ VMXASSIST_V8086,
+ NORMAL
+} vmx_state_t;
+
+struct tss_descriptor {
+ union {
+ ulong_t value;
+ struct {
+ uint16_t limit1;
+ uint16_t base1;
+ uint_t base2 : 8;
+ /* In IA32, type follows the form 10B1b, where B is the busy flag */
+ uint_t type : 4;
+ uint_t zero1 : 1;
+ uint_t dpl : 2;
+ uint_t present : 1;
+ uint_t limit2 : 4;
+ uint_t available : 1;
+ uint_t zero2 : 1;
+ uint_t zero3 : 1;
+ uint_t granularity : 1;
+ uint_t base3 : 8;
+#ifdef __V3_64BIT__
+ uint32_t base4;
+ uint_t rsvd1 : 8;
+ uint_t zero4 : 5;
+ uint_t rsvd2 : 19;
+#endif
+ } __attribute__((packed));
+ } __attribute__((packed));
+}__attribute__((packed));
+
+struct vmcs_host_state {
+ struct v3_segment gdtr;
+ struct v3_segment idtr;
+ struct v3_segment tr;
+};
-
-
-
-enum VMState { VM_VMXASSIST_STARTUP, VM_VMXASSIST_V8086_BIOS, VM_VMXASSIST_V8086, VM_NORMAL };
-
-
-
-
-
-
-
-struct VM {
- enum VMState state;
- struct VMXRegs registers;
- struct VMDescriptor descriptor;
- struct VMCSData vmcs;
- struct VMCS *vmcsregion;
- struct VmxOnRegion *vmxonregion;
+struct vmx_data {
+ vmx_state_t state;
+ addr_t vmcs_ptr_phys;
+ struct vmcs_host_state host_state;
+ /* VMX Control Fields */
+ uint32_t pinbased_ctrls;
+ uint32_t pri_procbased_ctrls;
+ uint32_t sec_procbased_ctrls;
+ uint32_t exit_ctrls;
+ uint32_t entry_ctrls;
};
-int is_vmx_capable();
-
-VmxOnRegion * Init_VMX();
-VmxOnRegion * CreateVmxOnRegion();
+int v3_is_vmx_capable();
+void v3_init_vmx(struct v3_ctrl_ops* vm_ops);
+int v3_update_vmcs_guest_state(struct guest_info * info);
+int v3_update_vmcs_ctrl_fields(struct guest_info * info);
+int v3_update_vmcs_host_state(struct guest_info * info);
-int VMLaunch(struct VMDescriptor *vm);
-
-
-int Do_VMM(struct VMXRegs regs);
#endif // ! __V3VEE__
#endif
+
+