From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KV6zl-0006Zn-VU for qemu-devel@nongnu.org; Mon, 18 Aug 2008 11:50:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KV6zj-0006Z0-Dc for qemu-devel@nongnu.org; Mon, 18 Aug 2008 11:50:13 -0400 Received: from [199.232.76.173] (port=60457 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KV6zj-0006Yx-BX for qemu-devel@nongnu.org; Mon, 18 Aug 2008 11:50:11 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:52621) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KV6zi-00062o-NT for qemu-devel@nongnu.org; Mon, 18 Aug 2008 11:50:11 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate02.web.de (Postfix) with ESMTP id 2C63AE91434E for ; Mon, 18 Aug 2008 17:50:09 +0200 (CEST) Received: from [88.65.245.41] (helo=[139.25.109.167]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1KV6zg-00053M-00 for qemu-devel@nongnu.org; Mon, 18 Aug 2008 17:50:09 +0200 Message-ID: <48A99A30.5040708@web.de> Date: Mon, 18 Aug 2008 17:50:08 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <484BED67.7080007@web.de> <4869D210.80904@web.de> <4879F854.8070809@web.de> <48A9200E.4070104@web.de> <48A97FFC.3010002@codemonkey.ws> In-Reply-To: <48A97FFC.3010002@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [RESEND #3][PATCH] i386: Catch all non-present ptes in cpu_get_phys_page_debug Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Anthony Liguori wrote: > Jan Kiszka wrote: >> It helps debugging guests when yet unmapped pages are correctly reported >> as, well, unmapped. >> >> Signed-off-by: Jan Kiszka >> --- >> target-i386/helper.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> Index: b/target-i386/helper.c >> =================================================================== >> --- a/target-i386/helper.c >> +++ b/target-i386/helper.c >> @@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb >> page_size = 4096; >> pte = ldq_phys(pte_addr); >> } >> + if (!(pte & PG_PRESENT_MASK)) >> + return -1; >> } else { >> uint32_t pde; >> >> @@ -1211,10 +1213,10 @@ target_phys_addr_t cpu_get_phys_page_deb >> /* page directory entry */ >> pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) >> & env->a20_mask; >> pte = ldl_phys(pte_addr); >> - if (!(pte & PG_PRESENT_MASK)) >> - return -1; >> page_size = 4096; >> } >> + if (!(pte & PG_PRESENT_MASK)) >> + return -1; >> } >> > > This looks redundant. In the PSE=1 case, the check for pde & > PG_PRESENT_MASK takes care of it. In the PSE=0 clause, there is already > a check for pte & PG_PRESENT_MASK. True. > > The first chunk looks like a genuine fix though. Here is the stripped-down version: ----------- It helps debugging guests when yet unmapped pages are correctly reported as, well, unmapped. Signed-off-by: Jan Kiszka --- target-i386/helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Index: b/target-i386/helper.c =================================================================== --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1192,6 +1192,8 @@ target_phys_addr_t cpu_get_phys_page_deb page_size = 4096; pte = ldq_phys(pte_addr); } + if (!(pte & PG_PRESENT_MASK)) + return -1; } else { uint32_t pde;