From patchwork Mon Apr 26 02:53:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 427501 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3326101jao; Sun, 25 Apr 2021 20:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZv3q79VXU3W37Q6LzeHZbO79YRldT2W/GcoF1BbrsiGr5MJ2NC/o7vKFBAGYKcVmRtJrW X-Received: by 2002:a0c:c350:: with SMTP id j16mr15605164qvi.42.1619406192335; Sun, 25 Apr 2021 20:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619406192; cv=none; d=google.com; s=arc-20160816; b=x2cf8Yem3dF4LIHlfcXmPiI0VD+ctlRkLTFcrvs/mZzUQTQ7pKLfKgPmxDo1Q4j3It nkXcVazaoquRwOoZCQEAOgQPt1L7j43z+Gbtisd8+bOc7IzIgUZqfuEpPZF6w5xGTFFl KkmWfR8pauGcpyklOYPxq72/bo5ct5QiwMV/KxbmJSHKVGT3zMqXfPj05JlRjh/CPa8w /a1kvbiVIZyl8wewcdkbI5B885E2mDFQr1iBtQy121TX1akJ3xm7DYaWOaSK3h9kt1uA rpGkEecZ6uJLvryXcN6q42oeydKikyeARe/pFzAOYeKUTCf0n8GsB8nEEw9bXvvWBmH/ 6Kjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=z0d/MHZc/lIMcXnltDdxqc+mT2qSBPZpXbhHRl412BM=; b=aStf9VPO8lp9zcXDMGtzuKg5oEj5nRsiEkLPni1EbeWlOdjT0FrBsugrxF7W18qWVG TRRqyTsHMERqZQAoqwtRw/ekHNeq1uR1vav7qgk5eCUrn4f7AqfRf7b07eK0JueZu9Um J2+cu9apBzEZO7fvsRKLRqvyqaiBqweZpJfYXKzH0j8xI5vhjgar7TMkzhYW0YyVy1M1 wIa0QsSJ38qVm+y64yfV/QGnA/9bgG3dIL4+w2vVujWWkA5s+fz85AEAwUhVK841slSG l7AToy4O9zm8DMirfeNjThnVauxHVGYVrxIbEoIKoowtCnMqrVeGZcdJJnoPlBpYm/ZA 3rcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wa8QVRrN; 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=pass (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 t81si10246406qke.372.2021.04.25.20.03.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Apr 2021 20:03:12 -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=pass header.i=@linaro.org header.s=google header.b=Wa8QVRrN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1larWh-0001rD-P0 for patch@linaro.org; Sun, 25 Apr 2021 23:03:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1larNj-0007wG-Cv for qemu-devel@nongnu.org; Sun, 25 Apr 2021 22:53:55 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:35588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1larNV-0007Xk-Om for qemu-devel@nongnu.org; Sun, 25 Apr 2021 22:53:53 -0400 Received: by mail-pj1-x1032.google.com with SMTP id h14-20020a17090aea8eb02901553e1cc649so2184034pjz.0 for ; Sun, 25 Apr 2021 19:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=z0d/MHZc/lIMcXnltDdxqc+mT2qSBPZpXbhHRl412BM=; b=Wa8QVRrNqnW273lfLJ85TO49Shejj0n/Yf/02VHMvDOe4DD/Oc2QLksGGkn87b+rfj iacynqcJjiduwAxcPtlqvo3gszLV79V5QSvRUMZuD1bXEPZlBuuqDjs+OcZnVRsfMw/x 9CutKqWznqa2uKT+hryWSM/zZ3gyqAVzCKtvP+PoPYFtYlsznkbaiez5DQqx7G/IIsJo FJkTax1H1telRorjaIWLmld/LrOimWTCggoRW/X47QmEjY1B7QbXegsaqAG7rN12781p F7K9NIQGkWmjT0zI3GH9/WTuLBYpXNrRIAGOrZRrvhnMCoX2iKYq4cyuLBiSrqSa2Qv/ qSsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z0d/MHZc/lIMcXnltDdxqc+mT2qSBPZpXbhHRl412BM=; b=Q7IoM/BKo6m0GX4uIL4QLdJqKMhCzmYZ/jadhtW2ASMrnY3iQv1MXt+2w9kExHrmZx jxTnkR8CQMONthKO2jD3yCSGTtgXtzWAwW077vRVoDuEY6a0pWkxIzYXl9ylBveGyCTK kqVYLEZBJAWBLWtaFrRdJM6eltaHF1WzJgcPRXNirm6m5iC/rgG6ejSs1rNc1OozzGb+ dY0s0i6acFpXrbbdA1W8GxFw7qnNqYT1WQ5PJCBsB266MxG5kHV6H31Zah6pcZsY2/BA umUEPEOjuFtJsplMFMb7RADFzrwSFcgcFxv50zKXOL/F3sZuIz70kVnwEZ6iJTFF9S+1 D8Ww== X-Gm-Message-State: AOAM531aMkBJiRLJOJnMZraYEdbZEtwGtvbv6s1CQClbfeAfScOEHWbf Ny4h2DJ8N3wG/EzqP/U7hFKmRD4rkoHyMg== X-Received: by 2002:a17:90b:2355:: with SMTP id ms21mr20017424pjb.226.1619405620189; Sun, 25 Apr 2021 19:53:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id e23sm9805680pgg.76.2021.04.25.19.53.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Apr 2021 19:53:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/25] linux-user/sparc: Include TARGET_STACK_BIAS in get_sp_from_cpustate Date: Sun, 25 Apr 2021 19:53:14 -0700 Message-Id: <20210426025334.1168495-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210426025334.1168495-1-richard.henderson@linaro.org> References: <20210426025334.1168495-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move TARGET_STACK_BIAS from signal.c. Generic code cares about the logical stack pointer, not the physical one that has a bias applied for sparc64. Signed-off-by: Richard Henderson --- linux-user/sparc/target_cpu.h | 9 ++++++++- linux-user/sparc/signal.c | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index 1fa1011775..1f4bed50f4 100644 --- a/linux-user/sparc/target_cpu.h +++ b/linux-user/sparc/target_cpu.h @@ -20,6 +20,12 @@ #ifndef SPARC_TARGET_CPU_H #define SPARC_TARGET_CPU_H +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) +# define TARGET_STACK_BIAS 2047 +#else +# define TARGET_STACK_BIAS 0 +#endif + static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, unsigned flags) { @@ -40,6 +46,7 @@ static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, #endif /* ??? The kernel appears to copy one stack frame to the new stack. */ /* ??? The kernel force aligns the new stack. */ + /* Userspace provides a biased stack pointer value. */ env->regwptr[WREG_SP] = newsp; } @@ -77,7 +84,7 @@ static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) { - return state->regwptr[WREG_SP]; + return state->regwptr[WREG_SP] + TARGET_STACK_BIAS; } #endif diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index d27b7a3af7..76579093a8 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -394,8 +394,6 @@ struct target_reg_window { abi_ulong ins[8]; }; -#define TARGET_STACK_BIAS 2047 - /* {set, get}context() needed for 64-bit SparcLinux userland. */ void sparc64_set_context(CPUSPARCState *env) {