qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: KONRAD Frederic <konrad@adacore.com>
To: qemu-devel@nongnu.org
Cc: rth@twiddle.net, mark.cave-ayland@ilande.co.uk,
	frederic.konrad@adacore.com
Subject: [Qemu-devel] [PATCH] sparc: fix leon3 casa instruction when MMU is disabled
Date: Fri,  2 Mar 2018 10:59:25 +0100	[thread overview]
Message-ID: <1519984765-15748-1-git-send-email-konrad@adacore.com> (raw)

From: KONRAD Frederic <frederic.konrad@adacore.com>

Since the commit af7a06bac7d3abb2da48ef3277d2a415772d2ae8:
`casa [..](10), .., ..` (and probably others alternate space instructions)
triggers a data access exception when the MMU is disabled.

When we enter get_asi(...) dc->mem_idx is set to MMU_PHYS_IDX when the MMU
is disabled. Just keep mem_idx unchanged in this case so we passthrough the
MMU when it is disabled.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---

Notes:
    Changes RFC -> V1:
     * emit the instruction with MMU_PHYS_IDX instead of checking that the MMU
       is enabled in get_physical_address(..)

 target/sparc/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 71e0853..5aa367a 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -2093,6 +2093,11 @@ static DisasASI get_asi(DisasContext *dc, int insn, TCGMemOp memop)
             type = GET_ASI_BFILL;
             break;
         }
+
+        /* MMU_PHYS_IDX is used when the MMU is disabled to passthrough the
+         * permissions check in get_physical_address(..).
+         */
+        mem_idx = (dc->mem_idx == MMU_PHYS_IDX) ? MMU_PHYS_IDX : mem_idx;
     } else {
         gen_exception(dc, TT_PRIV_INSN);
         type = GET_ASI_EXCP;
-- 
1.8.3.1

             reply	other threads:[~2018-03-02  9:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02  9:59 KONRAD Frederic [this message]
2018-03-02 19:04 ` [Qemu-devel] [PATCH] sparc: fix leon3 casa instruction when MMU is disabled Richard Henderson
2018-03-05  9:14   ` KONRAD Frederic
2018-03-05 21:56   ` Mark Cave-Ayland
2018-03-06  9:03     ` Richard Henderson
2018-03-07 18:49 ` Mark Cave-Ayland

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=1519984765-15748-1-git-send-email-konrad@adacore.com \
    --to=konrad@adacore.com \
    --cc=frederic.konrad@adacore.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).