All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH 3/4] linux-user/sparc: Put address for data faults where linux-user expects it
Date: Mon,  6 Nov 2017 18:33:25 +0000	[thread overview]
Message-ID: <1509993206-26637-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1509993206-26637-1-git-send-email-peter.maydell@linaro.org>

In the user-mode-only version of sparc_cpu_handle_mmu_fault(),
we must save the fault address for a data fault into the CPU
state's mmu registers, because the code in linux-user/main.c
expects to find it there in order to populate the si_addr
field of the guest siginfo.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/sparc/mmu_helper.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index 126ea5e..d5b6c1e 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -30,10 +30,18 @@
 int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
                                int mmu_idx)
 {
+    SPARCCPU *cpu = SPARC_CPU(cs);
+    CPUSPARCState *env = &cpu->env;
+
     if (rw & 2) {
         cs->exception_index = TT_TFAULT;
     } else {
         cs->exception_index = TT_DFAULT;
+#ifdef TARGET_SPARC64
+        env->dmmu.mmuregs[4] = address;
+#else
+        env->mmuregs[4] = address;
+#endif
     }
     return 1;
 }
-- 
2.7.4

  parent reply	other threads:[~2017-11-06 18:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 18:33 [Qemu-devel] [PATCH 0/4] linux-user: fix various SIGSEGV delivery bugs Peter Maydell
2017-11-06 18:33 ` [Qemu-devel] [PATCH 1/4] linux-user/s390x: Mask si_addr for SIGSEGV Peter Maydell
2017-11-07  8:06   ` Laurent Vivier
2017-11-07 15:34   ` Philippe Mathieu-Daudé
2017-11-08 21:18   ` Richard Henderson
2017-11-09 11:12     ` Peter Maydell
2017-11-06 18:33 ` [Qemu-devel] [PATCH 2/4] linux-user/ppc: Report correct fault address for data faults Peter Maydell
2017-11-07  8:17   ` Laurent Vivier
2017-11-08 21:19   ` Richard Henderson
2017-11-06 18:33 ` Peter Maydell [this message]
2017-11-07  8:28   ` [Qemu-devel] [PATCH 3/4] linux-user/sparc: Put address for data faults where linux-user expects it Laurent Vivier
2017-11-07  9:20     ` Peter Maydell
2017-11-07  9:25   ` Laurent Vivier
2017-11-07 15:26   ` Philippe Mathieu-Daudé
2017-11-08 21:21   ` Richard Henderson
2017-11-06 18:33 ` [Qemu-devel] [PATCH 4/4] linux-user: Handle rt_sigaction correctly for SPARC Peter Maydell
2017-11-07 14:11   ` Laurent Vivier
2017-11-07 15:44   ` Philippe Mathieu-Daudé
2017-11-07 20:02 ` [Qemu-devel] [PATCH 0/4] linux-user: fix various SIGSEGV delivery bugs Riku Voipio

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=1509993206-26637-4-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.