From mboxrd@z Thu Jan 1 00:00:00 1970 From: henanwxr Subject: Confused by address translation when running guest os Date: Sun, 22 May 2011 04:58:44 -0700 (PDT) Message-ID: <1306065524652-4416590.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=81Before do vmlaunch at the first time, CR0 in guest-state area is = to paging protect mode, and this is actual state of guest os, as follow: GUEST_CR0=3Dv->arch.hvm_vcpu.hw_cr[0]=20 which with vaule CR0.PE=3D1,CR0.PG=3D1 but in the view of guest its CR0 is set to non paging protect mode, as follow: v->arch.hvm_vcpu.guest_cr[0] which with vaule CR0.PE=3D1,CR0.PG=3D0 my question is: Initially, when executing the codes of guest os(such as hvmloader), address translate in which mode in hell? Is it in actual state of paging protect mode? Or in view of guest os that non paging protect mode ? And why? =20 =EF=81=AC=09(1)If it is in actual state of paging protect mode, then the ad= dress translation must walk through the page table, but we don not construct a page table in advance? =EF=81=AC=09(2)If it is in view of guest os that non paging protect mode, t= hen it need not a page table, I find the address translation is emulated within VMM, liner address=3Dphysical address, as follow: /arch/x86/hvm/emulate.c static int hvmemul_linear_to_phys(=E2=80=A6.. { /* With no paging it's easy: linear =3D=3D physical. */ if ( !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG) ) { *paddr =3D addr; return X86EMUL_OKAY; } =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.. But every time when guest os access memory and fetch the instruction, does the address translation should through the emulation of VMM? And should generate VM exit? Which I am sure is that when VMM process I/O request of= =20 guest os it should generate VM exit and call this function. 2=E3=80=81=09How does EPT(Extended-Page-Table) work in question 1 above ? 3=E3=80=81When execute hvmloader, it will switch the processor to V86 mode,= how implement address translation since then? 4=E3=80=81=09when virtual Bios load the guest os kernel, guest os will swit= ch the=20 processor mode to non paging protect mode again, does the process of addres= s translation same as question 1? 5=E3=80=81=09When guest os running normally, it is in paging protect mod, t= he process of address translation is:=20 guest os liner address --> guest os physical address ( translate by guest page table) guest os physical address --> machine address (translate by EPT) right ? -- View this message in context: http://xen.1045712.n5.nabble.com/Confused-by-= address-translation-when-running-guest-os-tp4416590p4416590.html Sent from the Xen - Dev mailing list archive at Nabble.com.