From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qx0dK-0004n3-0c for qemu-devel@nongnu.org; Fri, 26 Aug 2011 13:55:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qx0dI-0007Jy-TK for qemu-devel@nongnu.org; Fri, 26 Aug 2011 13:55:57 -0400 Received: from david.siemens.de ([192.35.17.14]:22535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qx0dI-0007Jo-EJ for qemu-devel@nongnu.org; Fri, 26 Aug 2011 13:55:56 -0400 Message-ID: <4E57DE29.9040203@siemens.com> Date: Fri, 26 Aug 2011 19:55:53 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4E57B08E.2090304@siemens.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Physical address debugging List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: "qemu-devel@nongnu.org" , =?UTF-8?B?WmV1cyBHw7NtZXogTWFybW9sZWpv?= On 2011-08-26 19:34, Blue Swirl wrote: > 2011/8/26 Jan Kiszka : >> On 2011-08-26 16:21, Zeus G=C3=B3mez Marmolejo wrote: >>> Hi all, >>> >>> I just want to do a very simple task. I'm using QEMU for debugging a = new OS >>> and I see that there is a memory region that is being updated by an u= nknown >>> task. I don't know if it's another process or the kernel itself. >>> >>> So I would like to put a physical memory watchpoint. I don't know how= to do >>> that. As the GDB stub is operating using virtual addressing, I cannot= place >>> a watchpoint on an address as it's not stopping. >>> >>> To make it short, I want the equivalent of the Bochs command "watch w= rite >>> addr", which inserts a write watch point at physical address 'addr'. = I >>> haven't seen this is possible on the QEMU monitor... >> >> Indeed, it isn't. It's impossible with KVM (due to lacking hardware >> support) but would be feasible with TCG if you extend (or ad-hoc hack) >> QEMU code accordingly. >=20 > Why impossible? The existing watchpoints replace original physical > memory with io_mem_watch MMIO, virtual addresses are translated to > physical in exec.c:tlb_set_page(). The only missing piece is to allow > setting watchpoints with physical addresses directly. >=20 > Since KVM can handle MMIO, I think it should also be able to handle > watchpoints. KVM uses x86 debug registers for watchpoints. And the SDM states: 16.2.1 Debug Address Registers (DR0-DR3) Each of the debug-address registers (DR0 through DR3) holds the 32-bit linear address of a breakpoint (see Figure 16-1). Breakpoint comparisons are made before physical address translation occurs. [...] Jan --=20 Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux