X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmx_assist.h;h=d9fc31d8cf63ddbb8c300248551030c0d853284e;hb=HEAD;hp=31b9a37044ca40244678c02f47110c311e611c8d;hpb=61597ea2c5ccace036d8a65e429e32b8f8a7ed4a;p=palacios.git diff --git a/palacios/include/palacios/vmx_assist.h b/palacios/include/palacios/vmx_assist.h index 31b9a37..d9fc31d 100644 --- a/palacios/include/palacios/vmx_assist.h +++ b/palacios/include/palacios/vmx_assist.h @@ -26,20 +26,21 @@ #ifndef _VMX_ASSIST_H_ #define _VMX_ASSIST_H_ +#ifdef __V3VEE__ + #include #define VMXASSIST_BASE 0xD0000 #define VMXASSIST_MAGIC 0x17101966 -#define VMXASSIST_MAGIC_OFFSET (VMXASSIST_BASE+8) -#define VMXASSIST_NEW_CONTEXT (VMXASSIST_BASE + 12) -#define VMXASSIST_OLD_CONTEXT (VMXASSIST_NEW_CONTEXT + 4) -#ifndef __ASSEMBLY__ +struct vmx_assist_header { + uint64_t rsvd; // 8 bytes of nothing + uint32_t magic; + uint32_t new_ctx_gpa; + uint32_t old_ctx_gpa; +} __attribute__((packed)); -#define NR_EXCEPTION_HANDLER 32 -#define NR_INTERRUPT_HANDLERS 16 -#define NR_TRAPS (NR_EXCEPTION_HANDLER+NR_INTERRUPT_HANDLERS) union vmcs_arbytes { struct arbyte_fields { @@ -54,9 +55,16 @@ union vmcs_arbytes { g : 1, null_bit : 1, reserved2 : 15; - } fields; + } __attribute__((packed)) fields; unsigned int bytes; -}; +} __attribute__((packed)); + +struct vmx_assist_segment { + uint32_t sel; + uint32_t limit; + uint32_t base; + union vmcs_arbytes arbytes; +} __attribute__((packed)); /* * World switch state @@ -68,50 +76,32 @@ struct vmx_assist_context { uint32_t cr0; uint32_t cr3; /* page table directory */ uint32_t cr4; + uint32_t idtr_limit; /* idt */ uint32_t idtr_base; + uint32_t gdtr_limit; /* gdt */ uint32_t gdtr_base; - uint32_t cs_sel; /* cs selector */ - uint32_t cs_limit; - uint32_t cs_base; - union vmcs_arbytes cs_arbytes; - uint32_t ds_sel; /* ds selector */ - uint32_t ds_limit; - uint32_t ds_base; - union vmcs_arbytes ds_arbytes; - uint32_t es_sel; /* es selector */ - uint32_t es_limit; - uint32_t es_base; - union vmcs_arbytes es_arbytes; - uint32_t ss_sel; /* ss selector */ - uint32_t ss_limit; - uint32_t ss_base; - union vmcs_arbytes ss_arbytes; - uint32_t fs_sel; /* fs selector */ - uint32_t fs_limit; - uint32_t fs_base; - union vmcs_arbytes fs_arbytes; - uint32_t gs_sel; /* gs selector */ - uint32_t gs_limit; - uint32_t gs_base; - union vmcs_arbytes gs_arbytes; - uint32_t tr_sel; /* task selector */ - uint32_t tr_limit; - uint32_t tr_base; - union vmcs_arbytes tr_arbytes; - uint32_t ldtr_sel; /* ldtr selector */ - uint32_t ldtr_limit; - uint32_t ldtr_base; - union vmcs_arbytes ldtr_arbytes; + + struct vmx_assist_segment cs; + struct vmx_assist_segment ds; + struct vmx_assist_segment es; + struct vmx_assist_segment ss; + struct vmx_assist_segment fs; + struct vmx_assist_segment gs; + struct vmx_assist_segment tr; + struct vmx_assist_segment ldtr; + unsigned char rm_irqbase[2]; -}; +} __attribute__((packed)); + typedef struct vmx_assist_context vmx_assist_context_t; int v3_vmxassist_ctx_switch(struct guest_info * info); -#endif /* __ASSEMBLY__ */ + +#endif #endif /* _VMX_ASSIST_H_ */