From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8CbD-0005mv-9X for qemu-devel@nongnu.org; Mon, 05 Jan 2015 13:41:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y8Cb9-00078r-3E for qemu-devel@nongnu.org; Mon, 05 Jan 2015 13:41:55 -0500 Message-ID: <54AADADB.6000400@invlim.com> Date: Mon, 05 Jan 2015 10:41:31 -0800 From: David Morrison MIME-Version: 1.0 References: <1418862393-10691-1-git-send-email-dmorrison@invlim.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-openrisc: bugfixes for debugging with GDB+Qemu on OpenRISC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Trivial , QEMU Developers , Ethan Hunt Hi, Peter, Thanks for the response. I'll split out the changes into separate commits and resubmit. I do have one question here: > >> diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c >> index 750a936..bbd05f1 100644 >> --- a/target-openrisc/mmu.c >> +++ b/target-openrisc/mmu.c >> @@ -219,7 +219,7 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) >> hwaddr phys_addr; >> int prot; >> >> - if (cpu_openrisc_get_phys_addr(cpu, &phys_addr, &prot, addr, 0)) { >> + if (cpu_openrisc_get_phys_nommu(cpu, &phys_addr, &prot, addr, 0)) { > > This looks wrong -- we won't do the virtual-to-physical > translation on the addresses provided by the debugger if > we use the _nommu() function. You definitely need to be > doing a v-to-p translation here somehow. > I was similarly puzzled by this. However, I've been comparing Qemu to or1ksim, which does not appear to do translation for the debugger; see the following code excerpt from the or1ksim source: https://github.com/openrisc/or1ksim/blob/or1k-master/debug/rsp-server.c#L1546 rsp_read_mem (struct rsp_buf *buf) { ... for (off = 0; off < len; off++) { unsigned char ch; /* The byte at the address */ /* Check memory area is valid */ ... // Get the memory direct - no translation. ch = eval_direct8 (addr + off, 0, 0); buf->data[off * 2] = hexchars[ch >> 4]; buf->data[off * 2 + 1] = hexchars[ch & 0xf]; } buf->data[off * 2] = 0; /* End of string */ buf->len = strlen (buf->data); put_packet (buf); } /* rsp_read_mem () */ Moreover, in Qemu if you perform the translation and use GDB to debug, it returns bogus values for the memory read, whereas not performing the translation appears to work correctly. Am I doing something wrong here, or is this possibly a bug in the or1k toolchain instead? Thanks for your help! David -- David R. Morrison, PhD Inverse Limit dmorrison@invlim.com +1-217-417-9445