VMM: Fix MSR emulation (XCC)
[akaros.git] / kern / arch / x86 / ros / vmx.h
index 0f81389..40fade9 100644 (file)
@@ -411,6 +411,8 @@ enum vmcs_field {
 #define INTR_TYPE_SOFT_INTR             (4 << 8) /* software interrupt */
 #define INTR_TYPE_SOFT_EXCEPTION       (6 << 8) /* software exception */
 
 #define INTR_TYPE_SOFT_INTR             (4 << 8) /* software interrupt */
 #define INTR_TYPE_SOFT_EXCEPTION       (6 << 8) /* software exception */
 
+#define VMX_POSTED_OUTSTANDING_NOTIF           256
+
 /* GUEST_INTERRUPTIBILITY_INFO flags. */
 #define GUEST_INTR_STATE_STI           0x00000001
 #define GUEST_INTR_STATE_MOV_SS                0x00000002
 /* GUEST_INTERRUPTIBILITY_INFO flags. */
 #define GUEST_INTR_STATE_STI           0x00000001
 #define GUEST_INTR_STATE_MOV_SS                0x00000002
@@ -639,8 +641,15 @@ struct vmcs {
 
 typedef uint64_t gpa_t;
 typedef uint64_t gva_t;
 
 typedef uint64_t gpa_t;
 typedef uint64_t gva_t;
+/* TODO: remove these nasty macros */
 #define rdmsrl(msr, val) (val) = read_msr((msr))
 #define rdmsrl(msr, val) (val) = read_msr((msr))
-#define rdmsr(msr, low, high) do {uint64_t m = read_msr(msr); low = m; high = m>>32;} while (0)
+#define rdmsr(msr, low, high)                                                  \
+do {                                                                           \
+       uint64_t m = read_msr(msr);                                                \
+                                                                                  \
+       low = m & 0xffffffff;                                                      \
+       high = m >> 32;                                                            \
+} while (0)
 
 struct vmx_capability {
        uint32_t ept;
 
 struct vmx_capability {
        uint32_t ept;
@@ -690,31 +699,6 @@ struct ldttss_desc64 {
        uint32_t zero1;
 } __attribute__((packed));
 
        uint32_t zero1;
 } __attribute__((packed));
 
-struct vmx_vcpu {
-
-       int cpu;
-       int launched;
-       struct hw_trapframe regs;
-       uint8_t  fail;
-       uint64_t exit_reason;
-       uint64_t host_rsp;
-
-       uint64_t cr2;
-
-       int shutdown;
-       int ret_code;
-       struct proc *proc;
-
-       struct msr_autoload {
-               unsigned nr;
-               struct vmx_msr_entry guest[NR_AUTOLOAD_MSRS];
-               struct vmx_msr_entry host[NR_AUTOLOAD_MSRS];
-       } msr_autoload;
-
-       struct vmcs *vmcs;
-};
-
-
 static char * const VMX_EXIT_REASON_NAMES[] = {
        VMX_EXIT_REASONS
 };
 static char * const VMX_EXIT_REASON_NAMES[] = {
        VMX_EXIT_REASONS
 };