VMM: Fixes vmmcp freezes
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 20 Mar 2015 21:20:30 +0000 (17:20 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 7 Apr 2015 19:06:59 +0000 (15:06 -0400)
The Host's TSS was set wrong.  Not sure why exactly 8* works for Linux.

The TSS and GS probably should be set in the per-cpu area.

kern/arch/x86/vmm/intel/vmx.c

index 8f82292..b409bbe 100644 (file)
@@ -659,7 +659,7 @@ static void vmx_setup_constant_host_state(void)
        vmcs_write16(HOST_DS_SELECTOR, GD_KD);  /* 22.2.4 */
        vmcs_write16(HOST_ES_SELECTOR, GD_KD);  /* 22.2.4 */
        vmcs_write16(HOST_SS_SELECTOR, GD_KD);  /* 22.2.4 */
-       vmcs_write16(HOST_TR_SELECTOR, GD_TSS*8);  /* 22.2.4 */
+       vmcs_write16(HOST_TR_SELECTOR, GD_TSS);  /* 22.2.4 */
 
        native_store_idt(&dt);
        vmcs_writel(HOST_IDTR_BASE, dt.pd_base);   /* 22.2.4 */
@@ -683,6 +683,7 @@ static void vmx_setup_constant_host_state(void)
        vmcs_write16(HOST_FS_SELECTOR, 0);            /* 22.2.4 */
        vmcs_write16(HOST_GS_SELECTOR, 0);            /* 22.2.4 */
 
+       /* TODO: This (at least gs) is per cpu */
 #ifdef CONFIG_X86_64
        rdmsrl(MSR_FS_BASE, tmpl);
        vmcs_writel(HOST_FS_BASE, tmpl); /* 22.2.4 */