All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu
Subject: [Qemu-devel] [PATCH 09/13] linux-user/sparc: Flush register windows before clone/fork/vfork
Date: Sun, 19 May 2019 13:19:49 -0700	[thread overview]
Message-ID: <20190519201953.20161-10-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190519201953.20161-1-richard.henderson@linaro.org>

As seen as the very first instruction of sys_clone in the kernel.

Ideally this would be done in or before cpu_copy, and not with a
separate explicit test vs the syscall number, but this is a more
minimal solution.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/sparc/cpu_loop.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 9e357229c0..0816da6fa1 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -169,6 +169,18 @@ void cpu_loop (CPUSPARCState *env)
         case 0x110:
         case 0x16d:
 #endif
+            /*
+             * Before copying/adjusting registers for parent/child,
+             * flush the register windows to the stack.
+             */
+            switch (env->gregs[1]) {
+            case TARGET_NR_fork:
+            case TARGET_NR_vfork:
+            case TARGET_NR_clone:
+                flush_windows(env);
+                break;
+            }
+
             ret = do_syscall (env, env->gregs[1],
                               env->regwptr[0], env->regwptr[1],
                               env->regwptr[2], env->regwptr[3],
-- 
2.17.1



  parent reply	other threads:[~2019-05-19 20:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-19 20:19 [Qemu-devel] [PATCH 00/13] linux-user: path, clone, sparc, shmat fixes Richard Henderson
2019-05-19 20:19 ` [Qemu-devel] [PATCH 01/13] util/path: Do not cache all filenames at startup Richard Henderson
2019-06-13 13:40   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 02/13] linux-user: Rename cpu_clone_regs to cpu_clone_regs_child Richard Henderson
2019-06-13 16:25   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 03/13] linux-user: Introduce cpu_clone_regs_parent Richard Henderson
2019-06-13 16:26   ` Laurent Vivier
2019-06-13 19:10   ` Aleksandar Markovic
2019-05-19 20:19 ` [Qemu-devel] [PATCH 04/13] linux-user/alpha: Set r20 secondary return value Richard Henderson
2019-06-13 16:23   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 05/13] target/sparc: Define an enumeration for accessing env->regwptr Richard Henderson
2019-05-19 20:19 ` [Qemu-devel] [PATCH 06/13] linux-user/sparc: Use WREG constants in sparc/target_cpu.h Richard Henderson
2019-05-19 20:19 ` [Qemu-devel] [PATCH 07/13] linux-user/sparc: Use WREG constants in sparc/signal.c Richard Henderson
2019-06-13 21:31   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 08/13] linux-user/sparc: Fix cpu_clone_regs Richard Henderson
2019-05-19 20:19 ` Richard Henderson [this message]
2019-05-19 20:19 ` [Qemu-devel] [PATCH 10/13] scripts/qemu-binfmt-conf: Update for sparc64 Richard Henderson
2019-06-13 15:22   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 11/13] tests/tcg/multiarch/linux-test: Fix error check for shmat Richard Henderson
2019-06-13 15:08   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 12/13] linux-user: Fix shmat emulation by honoring host SHMLBA Richard Henderson
2019-05-22  9:40   ` Laurent Vivier
2019-05-19 20:19 ` [Qemu-devel] [PATCH 13/13] linux-user: Align mmap_find_vma to host page size Richard Henderson
2019-05-22  9:45   ` Laurent Vivier
2019-06-11 20:53 ` [Qemu-devel] [PATCH 00/13] linux-user: path, clone, sparc, shmat fixes Richard Henderson

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=20190519201953.20161-10-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@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 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.