From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JE76U-0006Zh-9B for qemu-devel@nongnu.org; Sun, 13 Jan 2008 12:58:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JE76S-0006ZU-Vw for qemu-devel@nongnu.org; Sun, 13 Jan 2008 12:58:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JE76S-0006ZR-SE for qemu-devel@nongnu.org; Sun, 13 Jan 2008 12:58:36 -0500 Received: from smtp-10.smtp.ucla.edu ([169.232.46.246]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JE76S-0003EA-Au for qemu-devel@nongnu.org; Sun, 13 Jan 2008 12:58:36 -0500 Received: from mail.ucla.edu (mail.ucla.edu [169.232.47.146]) by smtp-10.smtp.ucla.edu (8.14.1/8.14.1) with ESMTP id m0DHwQY1023931 for ; Sun, 13 Jan 2008 09:58:26 -0800 Received: from mug.lcdf.org (adsl-71-141-241-76.dsl.snfc21.pacbell.net [71.141.241.76]) (authenticated bits=0) by mail.ucla.edu (8.13.8/8.13.8) with ESMTP id m0DHwPAj008084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 13 Jan 2008 09:58:26 -0800 Message-ID: <478A50F1.4050400@cs.ucla.edu> Date: Sun, 13 Jan 2008 09:57:05 -0800 From: Eddie Kohler MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030104030302070705030102" Subject: [Qemu-devel] [Patch] x86 breakpoints and memory examination 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 This is a multi-part message in MIME format. --------------030104030302070705030102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi all, The following patch is useful for whole-system mode debugging and breakpoint setting on i386 QEMU. It seems like both breakpoints and memory examination used semi-physical addresses, in that neither took account of segment translation. This patch (relative to 0.9.1) adds segment translation. I'm not sure this is the right way to do it (in fact, I'm sure that the memory examination patch is the WRONG way to do it) and would appreciate pointers or advice. Thanks, Eddie Kohler --------------030104030302070705030102 Content-Type: text/x-patch; name="qemu-0.9.1-i386-debug.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-0.9.1-i386-debug.patch" diff -ru qemu-0.9.1/target-i386/helper2.c qemu-0.9.1-p/target-i386/helper2.c --- qemu-0.9.1/target-i386/helper2.c 2008-01-06 11:38:45.000000000 -0800 +++ qemu-0.9.1-p/target-i386/helper2.c 2008-01-12 23:56:34.000000000 -0800 @@ -1081,6 +1081,7 @@ { uint32_t pde_addr, pte_addr; uint32_t pde, pte, paddr, page_offset, page_size; + addr += env->segs[R_DS].base; if (env->cr[4] & CR4_PAE_MASK) { uint32_t pdpe_addr, pde_addr, pte_addr; diff -ru qemu-0.9.1/target-i386/translate.c qemu-0.9.1-p/target-i386/translate.c --- qemu-0.9.1/target-i386/translate.c 2008-01-06 11:38:45.000000000 -0800 +++ qemu-0.9.1-p/target-i386/translate.c 2008-01-13 00:00:23.000000000 -0800 @@ -6758,7 +6758,7 @@ for(;;) { if (env->nb_breakpoints > 0) { for(j = 0; j < env->nb_breakpoints; j++) { - if (env->breakpoints[j] == pc_ptr) { + if (env->breakpoints[j] == pc_ptr - dc->cs_base) { gen_debug(dc, pc_ptr - dc->cs_base); break; } --------------030104030302070705030102--