X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx.c;fp=palacios%2Fsrc%2Fpalacios%2Fvmx.c;h=4a8c0213aba81335461c02891e94f2137e7dd2b2;hp=aba565635db79b294d09e4cff7f2c2338b5143c0;hb=9bc5c1ff326aa6ac111e1d3824c93770391aef23;hpb=441c2e0ff3387a82eb20ef381222e3e2ba59354f diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index aba5656..4a8c021 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -794,7 +794,7 @@ void v3_init_vmx_cpu(int cpu_id) { uint64_t ret = 0; v3_get_msr(VMX_CR4_FIXED0_MSR,&(tmp_msr.hi),&(tmp_msr.lo)); - +#ifdef __V3_64BIT__ __asm__ __volatile__ ( "movq %%cr4, %%rbx;" "orq $0x00002000, %%rbx;" @@ -823,6 +823,38 @@ void v3_init_vmx_cpu(int cpu_id) { : : "%rbx" ); +#elif __V3_32BIT__ + __asm__ __volatile__ ( + "movq %%cr4, %%ecx;" + "orq $0x00002000, %%ecx;" + "movq %%ecx, %0;" + : "=m"(ret) + : + : "%ecx" + ); + + if ((~ret & tmp_msr.value) == 0) { + __asm__ __volatile__ ( + "movq %0, %%cr4;" + : + : "q"(ret) + ); + } else { + PrintError("Invalid CR4 Settings!\n"); + return; + } + + __asm__ __volatile__ ( + "movq %%cr0, %%ecx; " + "orq $0x00000020,%%ecx; " + "movq %%ecx, %%cr0;" + : + : + : "%ecx" + ); + +#endif + // // Should check and return Error here....