From: henanwxr Subject: Is the Guest OS in non-paging protected mode when VM first execute vmlaunch? Date: Sat, 21 May 2011 09:08:47 -0700 (PDT) Message-ID: <1305994127711-4415142.post@n5.nabble.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 1=E3=80=81Is the Guest OS in non-paging protected mode when VM first execut= e vmlaunch? If it is so, why not set it in paging protected mode, could I do this? 2=E3=80=81I found guest os was set in paging and protected mode in function= of construct_vmcs(). The flow is: //Xen-4.0/arch/x86/hvm/vmx/vmcs.c construct_vmcs() { =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6.. //here set CR0.PE v->arch.hvm_vcpu.guest_cr[0] =3D X86_CR0_PE | X86_CR0_ET; hvm_update_guest_cr(v, 0); =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6 } // Then it calls function of hvm_update_guest_cr() in /xen/include/asm-x86/hvm.h static inline void hvm_update_guest_cr(struct vcpu *v, unsigned int cr) { hvm_funcs.update_guest_cr(v, cr); } //hvm_funcs.update_guest_cr calls function of vmx_updata_guest_cr()=20 //in /arch/x86/hvm/vmx/vmx.c static struct hvm_function_table __read_mostly vmx_function_table =3D { .name =3D "VMX", =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80= =A6=E2=80=A6=E2=80=A6 .update_host_cr3 =3D vmx_update_host_cr3, .update_guest_cr =3D vmx_update_guest_cr, =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6= .. } static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr) { vmx_vmcs_enter(v); switch ( cr ) { case 0: { int realmode; unsigned long hw_cr0_mask =3D X86_CR0_NE; =20 //here set CR0.PG and CR0.PE if ( !vmx_unrestricted_guest(v) ) hw_cr0_mask |=3D X86_CR0_PG | X86_CR0_PE;=20 =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6= =E2=80=A6=E2=80=A6=E2=80=A6.. =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6= =E2=80=A6=E2=80=A6=E2=80=A6.. v->arch.hvm_vcpu.hw_cr[0] =3D v->arch.hvm_vcpu.guest_cr[0] | hw_cr0_mask; //here write GUEST_CR0, is it in paging and protected mode ?? =20 __vmwrite(GUEST_CR0, v->arch.hvm_vcpu.hw_cr[0]); __vmwrite(CR0_READ_SHADOW, v->arch.hvm_vcpu.guest_cr[0]); =E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6. =20 } -- View this message in context: http://xen.1045712.n5.nabble.com/Is-the-Guest= -OS-in-non-paging-protected-mode-when-VM-first-execute-vmlaunch-tp4415142p4= 415142.html Sent from the Xen - Dev mailing list archive at Nabble.com.