From patchwork Sun May 19 20:19:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164489 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4777444ili; Sun, 19 May 2019 13:36:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN/6k2jB9OrjepqQZELV7W2ZOHu0pl4OWReNO9b420UdNz+JvQydoSIaOsCImULtYOiOgO X-Received: by 2002:a50:ba6e:: with SMTP id 43mr70392557eds.201.1558298205802; Sun, 19 May 2019 13:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558298205; cv=none; d=google.com; s=arc-20160816; b=zC3OYqrAz5WmC2O9mdNw8t+6/Zo4z7m8kA/qT++tFVLSN840XwRN+mxZGc4vSikosR D2TC9BKqbBTpe+e3/YqZxin36a0SW10gY9fN70FD4q/IVrJcYEx1iIhOoyBfaJa3iQBI X7efOv8JprGI8XBVSIBpfZ63DuOLrQBJq/V98aWmb0tylUlKaa630B4po4Nfx15WmmO5 GxiG9x3umdIMPWyLHeF2El9+NOEQ8KG41o9OX6LBQ9GZirCE8S0CWM2yLml3LaM33+4/ LmLUJFXrhY4E7BBWZjMyN6CjXJdph6vnblN8IyYdLtP1lscAdXIeknxgsxp6jlQ7OnFQ V0hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=EslukgOgrXKOg9aqYU0CsDWXr7O+egog9zUh9mSRURk=; b=mecHu0kUfSk4loyBvgW50LjdgQXw564D1UCjRUyQ9GWck2Pihc+Jc/hKToI4CjIAb7 di1BSusN7SvFTvPEz+MyiaCOAuaNG0tRBWJQeJItdjxYmyg6nUBcQJc3nCG+N6mGYeWn JdM/d6a8nug1xAPwAVBkrnPDmlIv7uQgV2I0DeFGzQmnZQyp42TnFEamnsHq472XlnCP nTjc8v8kjrqPbnKFU1jhad/LCYCGJU8qd2hZkShj/1MVWt8vDGapfgmyNBYL/jK3lIEk K3cCB2XQjERsWDUIjZLhskxNRnfGlcuXRHfzq/pZh4WurHxvIjoUDHRZNoqj3flSTkx2 GkXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=spOuULvm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id se27si2886391ejb.2.2019.05.19.13.36.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 13:36:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=spOuULvm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSY0-0002Dn-PL for patch@linaro.org; Sun, 19 May 2019 16:36:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSI0-0005gT-PR for qemu-devel@nongnu.org; Sun, 19 May 2019 16:20:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSHy-0007Zc-Q8 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:20:12 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:33480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSHw-0007Vz-RC for qemu-devel@nongnu.org; Sun, 19 May 2019 16:20:10 -0400 Received: by mail-pl1-x644.google.com with SMTP id y3so5725575plp.0 for ; Sun, 19 May 2019 13:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EslukgOgrXKOg9aqYU0CsDWXr7O+egog9zUh9mSRURk=; b=spOuULvmqJdWnGZ+oymBAv8/exyZU1Oz1CqCtk0l1Cjv6ARICQX/FmE+lISMPzTh3T GdWzVEKu1aXWInJrjsUqCrYoVAsCDUWn1w8zcjlexDk64VYnAmpUzMWd7PplXPbAYzi8 EX+CjtHpjMlj36tsdNrtMQcUwn3T1HIT09g6cG0SqabZdyZ75qRBbC2ZolhkSLcniiyP jpALldhlfXNOc8yFWpFka4vwYRlo5LZcmVSnScAYOCXZz5QL/EAl370pUg4eHFfq4+Re qpVfr8NMFKvY77B4Dieib+Tx0Alk68+Lk53+KV50PBHaP9BjlMpS/fsb3Zihi+Jb/Sq6 ZaYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EslukgOgrXKOg9aqYU0CsDWXr7O+egog9zUh9mSRURk=; b=GTAxNTmnSZwgWRrOEZNy+HmrHLTj202N2ZFVUEe2Dv+8j0fi8KHIupGgGV74NJPwBr fsaM7sQTJmt+7nXCr7dUT2pLwtw3rBqlbNvEfkJgutSC08/U/tv2OZoKKnOGkb5LHEM2 7jmUvBG3tImqrZUrwzYeTklDtRl6I1hiQ4OBz8SX1rT4A7PKnrjK20z95MMKLv+c5eN/ xJNbn/EBfC99NTSoIRCRzoQkAlGKfgWmoslrx0uABS9uAKUrQ7DKaag7CG34vWlxM93q /MPc6VvvOpVOwa1Cadaal9Iiq1HyqThzEVJvVRYy5dZuTHahaT9OEEH3DgMIk78uc79V CKAw== X-Gm-Message-State: APjAAAVu+Sjla2CSQz1+JCOfj0ZSoGtUA/CdA4ftixD6KybCr6zrU4ue /aKUEvwbGwSmmXya8MUENtnAWPhqGp0= X-Received: by 2002:a17:902:8609:: with SMTP id f9mr15303251plo.252.1558297207346; Sun, 19 May 2019 13:20:07 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id e14sm18166264pff.60.2019.05.19.13.20.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:20:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:19:49 -0700 Message-Id: <20190519201953.20161-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519201953.20161-1-richard.henderson@linaro.org> References: <20190519201953.20161-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH 09/13] linux-user/sparc: Flush register windows before clone/fork/vfork X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/sparc/cpu_loop.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.17.1 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],