Received: from eggs.gnu.org ([140.186.70.92]:45388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8NbU-0005B2-GV for qemu-devel@nongnu.org; Mon, 26 Sep 2011 22:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8NbT-000510-Bx for qemu-devel@nongnu.org; Mon, 26 Sep 2011 22:41:04 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:33347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8NbS-00050m-G3 for qemu-devel@nongnu.org; Mon, 26 Sep 2011 22:41:03 -0400 Date: Tue, 27 Sep 2011 10:40:53 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7?= Message-ID: <20110927024053.GB67470@cs.nctu.edu.tw> References: <20110818063338.GA69924@cs.nctu.edu.tw> <20110924070021.GA18146@cs.nctu.edu.tw> <201109260147.37212.jcmvbkbc@gmail.com> <20110926104930.GA5762@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] The reason behind block linking constraint? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7?= O.K., now I have to make sure it's guest virtual or guest physical. Correct me if I am wrong. > >> - now you change the mapping of the code page that contains second p= iece of code; > > > > ?change the mapping of the guest page which contains second piece of > > guest binary. Mapping guest page to what? Host virtual address? >=20 > Mapping of guest physical memory to guest virtual memory. Change in > the guest TLB. If we're talking about i386 guest that's change in the > page table + TLB flush, for the changed page or for the whole TLB. guest OS might swap out a guest physical page, then it have to change the guest page table (mapping between guest virtual and guest physical). Here, guest TLB means env->tlb_table, right? So, how page table is change= d is left to the guest OS, and QEMU takes care of the guest TLB (env->tlb_t= able). =20 > >> - after that there's another code (or no code at all) at the place w= here the second piece of code used to be; > >> - but the jump to tb2 still remains in tb1. > > > > =E6=85=AFhere's another code (or no code at all) at the guest page wh= ich > > used to contain second piece of guest binary. >=20 > At the virtual addresses of that guest page, right. Let's assume there is only (guest) page table first, no TLB (env->tlb_t= able). When we use the virtual address of that guest page index the page table, there should be a (guest) page fault since the (guest) physical page is swapped out. Then here comes the TLB (env->tlb_table). After tracing the code, I think the TLB is used to do GVA (guest virtual address) -> HVA (host virt= ual address) translation. We'll use the virtual address of that guest page index the TLB first, but since the guest page table change comes along with TLB flush, it'll try to walk the guest page table then raise a (guest) page fault. =20 > > =E4=92=B7o if we execute tb2, it might have wrong memory access throu= gh > > the mapping of guest page. Am I right? >=20 > If we execute tb2, it's not what guest would expect us to do at least. At least it should trigger a (guest) page fault. =20 Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667