Received: from eggs.gnu.org ([208.118.235.92]:43559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3imv-0008Kb-17 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:22:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3imV-0005u7-Ke for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:22:08 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:16332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3imV-0005rw-40 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:21:43 -0400 Received: from csmailer.cs.nctu.edu.tw (localhost [127.0.0.1]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id 379E67A for ; Tue, 21 Aug 2012 15:21:35 +0800 (CST) Received: from alumni.cs.nctu.edu.tw (alumni.cs.nctu.edu.tw [140.113.235.116]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id 24BDA79 for ; Tue, 21 Aug 2012 15:21:35 +0800 (CST) Received: (from chenwj@localhost) by alumni.cs.nctu.edu.tw (8.14.4/8.14.4/Submit) id q7L7LYtS082188 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 15:21:34 +0800 (CST) (envelope-from chenwj) Date: Tue, 21 Aug 2012 15:21:34 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20120821072134.GA81486@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Dump guest page table inside QEMU makes system hang List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi all, I want to dump guest page table when guest writes to cr3, the code snipt below, --- uint32_t pgd[1024][1024]; // guest page table static void dump_guest_pgtable(target_ulong cr3) { int i, j; uint32_t phyaddr =3D cr3; uint32_t val; for (i =3D 0; i < NUM_ENTRY; ++i) { phyaddr +=3D i * 4; for (j =3D 0; j < NUM_ENTRY; ++j) { cpu_physical_memory_read(phyaddr, &val, 4); pgd[i][j] =3D val; } } } void cpu_x86_update_cr3(CPUX86State *env, target_ulong new_cr3) { env->cr[3] =3D new_cr3; // guest cr3 if (env->cr[0] & CR0_PG_MASK) { tlb_flush(env, 0); // dump guest page table by using guest cr3 dump_guest_pgtable(new_cr3); } } --- The system will hang while booting. However, if I comment=20 cpu_physical_memory_read in function dump_guest_pgtable, there is no problem. What I am missing here? Thanks. 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 Homepage: http://people.cs.nctu.edu.tw/~chenwj