From patchwork Tue May 18 05:30:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441129 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1781575jac; Mon, 17 May 2021 22:46:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt7MNLCoaUaJJ10ZsZAhqMXYFkPxVExhdfeFnfMc3TLB0IEcq81GcC8J5U3snQ76q7EHA9 X-Received: by 2002:a67:bb19:: with SMTP id m25mr4321291vsn.20.1621316791799; Mon, 17 May 2021 22:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316791; cv=none; d=google.com; s=arc-20160816; b=szIghYUMPdIYspqGQtGdQkwNntFVPQCoaDhoA+ELFeULQ/yRZmjfki1JwVtK+ACik0 0hel3wZRQ2RuXzaas2t/Ki/Y29K7clP3c/GgjxaaecjVG+VEjmiqNqx2QftOSUBh1aWw /VyvTaY44YppAP1AKrKtjr8PaD8qlupckB8NfQaLaH0lV3md1oGKCKvX5M+rFnUO6fDa jelMIYyVdNQwvvbRXQX6r1A+Q9n7M3MDOSuHlcYKRenGMlE3HNUhi7r3yxC6CR8fEpy7 Lg0dmhHsMxP7+vBQiO7Y3HlGopjmnX4kwPWh27gs0Lo6Ov6k+PNMlf/xlllnDZeC1t9s AmXQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=lmBK7zyqk3ylGczsALndLJqVjWyb/57GyLpftSij1OU=; b=d57jBtv3HR/wbTuK2KAYUIBI4BifvPCwzV8ojUIvP9jy0zt9tYdjpFet/nquVKPy0G BenmcLpUkPRxDiffG1nt/9pIGoQN6nkzbsuVMgimsa3WxA6ZNJ+9YLRapwlZ6lqvBrOs O17SOx/txy4746Km2fO37XFJ6mXRsYfNVf9azfKOKGusRINWZPLmX0rSfr4eKmv6jBmH hyBxS25GMGohBZlAnUxgc9qhwiSnjrKygaRHPihZ2CXUXhqgkSnnYTdwVaEYwIAfp5ms TKI/uzAL5g8cbCy0lnSaI3nhfTXWKUhCC53gBsmFHVvp7rMDyOeKXcKmwowdz4603JMk RiDg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b18si9728362uad.161.2021.05.17.22.46.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:46:31 -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; 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" Received: from localhost ([::1]:53852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisYp-0001qg-5T for patch@linaro.org; Tue, 18 May 2021 01:46:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKX-0006zl-8u for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:45 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:47683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKS-0006us-IO for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:44 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mc0Er-1lCIvl1fOZ-00dV9a; Tue, 18 May 2021 07:31:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 12/59] linux-user/sparc: Include TARGET_STACK_BIAS in get_sp_from_cpustate Date: Tue, 18 May 2021 07:30:44 +0200 Message-Id: <20210518053131.87212-13-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210518053131.87212-1-laurent@vivier.eu> References: <20210518053131.87212-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:5i6JqPuL/+DAcO2iyI5Pv5ldXfdukbb8nXjZG1RQljMFd+QqnXj C/6ylvmExsNTYJVYmaAGG/h0Xd2FuIKZrwLUMwe/gl2bjOE5j1EHmVamNhuWwj0YOsihoAr 0HaBTCSLXWG+l0OsmqBMYvUiWhr1i2W45/+zdkHLQz00pyOhr3hJjNDUt6SS7kgFXFF2rbu ZXXoF6LOufwiFnCNzSReA== X-UI-Out-Filterresults: notjunk:1; V03:K0:Xy/tL6hw5/M=:k6PHLG2M8y83ry+ax8bCrw CFinO+4BjBKovrudbPnyiE6H28L3A0ILXmudlEo12NUiRv0BNFlnXxBH12/nF+PNmDkdacA/2 XlDOD89R5CkMT1xgukSv+OqfRxga2dM4ZVbdwoq0tE4dhhiX8dazc8zp2hx03kPZKChMm4cpM 1TkEs9fMGmPOwLx0S+7z5lhWO5TL9zqbaZLp05yQc4tWk345QWGJgsiTaOTaxXM3YcNA8jtSg j/OGgqg9zaDd9KbrN67h4LuDCYsy1Yf0mT/zhTXO0XgN6vKa628Lcd8lNPec0ys47w3ZTPVd7 DVJYdosKGB2rS/pq4FxESXaKLfT3a7v/fDNQcushRNnWi9NqUUmuapLru5HHRNeqwTvJDIOKh g+r5WslS9BQWWahMAm9GiFQjrcAqMHzf1IpalhkQfdGo9278bQp33GVBz1AparbxIZ/sjxY9E mIGh0SKFt89It8shslvmJH6sl7493h06MnDnJxLeWk8/xuBYNsn96vIdFF1uKWmRL/goEQ0ei RlvFpLZ6u0stkhUnqxrf50= Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham 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: , Cc: Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20210426025334.1168495-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 2 -- linux-user/sparc/target_cpu.h | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index d27b7a3af79d..76579093a88c 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) { diff --git a/linux-user/sparc/target_cpu.h b/linux-user/sparc/target_cpu.h index 1fa1011775a1..1f4bed50f476 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