qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Morrison <dmorrison@invlim.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Ethan Hunt <proljc@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] target-openrisc: bugfixes for debugging with GDB+Qemu on OpenRISC
Date: Mon, 05 Jan 2015 10:41:31 -0800	[thread overview]
Message-ID: <54AADADB.6000400@invlim.com> (raw)
In-Reply-To: <CAFEAcA9RHCGaGHk4zZWMa4BAWR0OV5sAxan3AjrR=G-NaiJ58g@mail.gmail.com>

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

  parent reply	other threads:[~2015-01-05 18:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18  0:26 [Qemu-devel] [PATCH] target-openrisc: bugfixes for debugging with GDB+Qemu on OpenRISC David Morrison
2015-01-05 17:59 ` David Morrison
2015-01-05 18:15 ` Peter Maydell
2015-01-05 18:33   ` Peter Maydell
2015-01-05 18:41   ` David Morrison [this message]
2015-01-05 18:48     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54AADADB.6000400@invlim.com \
    --to=dmorrison@invlim.com \
    --cc=peter.maydell@linaro.org \
    --cc=proljc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).