qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabien Chouteau <chouteau@adacore.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, agraf@suse.de
Subject: [Qemu-devel] [PATCH 2/2] PPC: Fix GDB read on code area for PPC6xx
Date: Tue, 18 Jun 2013 16:53:01 +0200	[thread overview]
Message-ID: <1371567181-4917-2-git-send-email-chouteau@adacore.com> (raw)
In-Reply-To: <1371567181-4917-1-git-send-email-chouteau@adacore.com>

On PPC 6xx, data and code have separated TLBs. Until now QEMU was only
looking at data TLBs, which is not good when GDB wants to read code.

This patch adds a second call to get_physical_address() with an
ACCESS_CODE type of access when the first call with ACCESS_INT fails.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 target-ppc/mmu_helper.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index 910e022..19f0b8c 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1378,7 +1378,15 @@ hwaddr cpu_get_phys_page_debug(CPUPPCState *env, target_ulong addr)
     }
 
     if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT) != 0)) {
-        return -1;
+
+        /* Some MMUs have separate TLBs for code and data. If we only try an
+         * ACCESS_INT, we may not be able to read instructions mapped by code
+         * TLBs, so we also try a ACCESS_CODE.
+         */
+        if (unlikely(get_physical_address(env, &ctx, addr, 0,
+                                          ACCESS_CODE) != 0)) {
+            return -1;
+        }
     }
 
     return ctx.raddr & TARGET_PAGE_MASK;
-- 
1.7.9.5

  reply	other threads:[~2013-06-18 14:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 14:53 [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx Fabien Chouteau
2013-06-18 14:53 ` Fabien Chouteau [this message]
2013-06-18 15:34   ` [Qemu-devel] [PATCH 2/2] PPC: Fix GDB read on code area for PPC6xx Alexander Graf
2013-06-21 18:10     ` Jan Kiszka
2013-06-22  0:26       ` Alexander Graf
2013-06-24  8:40         ` Fabien Chouteau
2013-06-18 15:31 ` [Qemu-devel] [PATCH 1/2] PPC: Add dump_mmu() for 6xx Alexander Graf
2013-06-18 16:04   ` Fabien Chouteau
2013-06-20 11:16     ` Alexander Graf
2013-06-20 13:06       ` Fabien Chouteau

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=1371567181-4917-2-git-send-email-chouteau@adacore.com \
    --to=chouteau@adacore.com \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).