From patchwork Mon May 17 18:13:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 440176 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1331806jac; Mon, 17 May 2021 11:22:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPVnrPXuzPZtjLqv4TPs+kuHJuJ4ncZ8P5fVvrI62YTLWlSzClBYAoklx/9zs12ZHKD75l X-Received: by 2002:a02:688:: with SMTP id 130mr1352885jav.48.1621275736529; Mon, 17 May 2021 11:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621275736; cv=none; d=google.com; s=arc-20160816; b=YdhR97G80VHMxssdzEVVGLKpWIXA9yRYPv4VD2auE7T/aNhqleRyk66e4i+AZV4KNa kLjWxUFWGn/VsbK9djDpsGdanK5s46OFwS4dEKxwvNVVXPbnQ5rZHdcmOVeip3GhLNTD aRGTNPowWzJrIxVOsMuh51OyxpstMThXjaCPtG5W0UU1ptMwolZFBvidoeXu3IiyYR1b 4mIAeUwwBO5NqG8X0saMekTr7UtOuH7fa+xtk90qtYesdyYdfkpT1/Mn3Z0WRAyPMTJt JUf4QwECZY+ZL2GUKqm2ornTb+u5ygKlCEVYZ6VD0Zu0hsahb1eKZ0PNSjoPfjGdEoun qSmA== 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=B21OUt/81fu6DBqGxWAmFfagh4c68Y/SSrdwK2Mwu7s=; b=Ai+1iVDdXCV/pNmpaVXbCIzcUncI8caIaS8DxcZg5j/Qy7ziR7bRyekMXWK2Bq4lBo Wp8ZtgEankE7AS8LMm35Prt2GtnJv6zvB9oj/D0vJY1vYhXW6f8/xYr+Qyxulp/2etQF pHatbco1AYvWybAROqljPUVcrexFpk73+Z3W6ifx04Ii6pM+vwGNTYnvG9ScWt4+d+bK 2wUv0BU2yPTsKCj6ytZ/EqG/vQJdiqADBJy1ShG7EBIH0n5FaZdameCTWkpro2fbZOUz 3fUydbwvWUk4CU8uo0sZ/24qn4kjKvjvDYIUVmuFTIaLOaVdqqFZyHgmVf0lLyBKz//G QHwA== 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 o21si19927832jat.63.2021.05.17.11.22.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 11:22:16 -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]:41264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lihsd-00012E-Ue for patch@linaro.org; Mon, 17 May 2021 14:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihlT-0006A6-Lh for qemu-devel@nongnu.org; Mon, 17 May 2021 14:14:51 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:34337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihlL-0004RE-KF for qemu-devel@nongnu.org; Mon, 17 May 2021 14:14:51 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MCsDe-1lZs4b45Tc-008rAc; Mon, 17 May 2021 20:14:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 21/59] linux-user/sparc: Fix the stackframe structure Date: Mon, 17 May 2021 20:13:46 +0200 Message-Id: <20210517181424.8093-22-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517181424.8093-1-laurent@vivier.eu> References: <20210517181424.8093-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:hJQD0zN7sluXRTbQyMIeWsitxY/jEQnLajZroqIKubbs8rtqUAb t2yupmbD6+6+rHEYuRfLtP8Ono1ZcxsDu2bSnLnY+TsxvH3k7id1l8AZuA39hJWLuT8tzi5 KFyG6tetiUthyxjf+PYAKeJgKMYKfeQMTWSYiCpXxA4JozYzQkjHSWWLxU38Mc1GLkFYvuQ IhnOJIL0BOMBzdgjMx7zA== X-UI-Out-Filterresults: notjunk:1; V03:K0:KdQbGm/jwt4=:zevkVLPgm4p5sMnsNi5tWH M7f55QNk2LI61nOdTumMBwWXgfd1QHlOvffS1iM32TcKgs+YsbbMZLeaCH/WyFr+7XXZ5dnoO gUlPeSr1k/GslQL/nRomaD3rqo1M6Pw+4IvmEj1peJorRmnxx7m84OVLym2/24MymgKW3/knc uwD3ZS5kr2/F1t5pbxRt4Mn3xtLYOEZ9C8e90L2aa8J45Kmqt4e17nAR0Df/NamMa6M6YD3dX YVbIZn+SyhiYHR7qgLGKKx/XPLTQo6fTUtxP+8DOcpot9Q2wmw5W8k8E4ag+5a0+pn8ZaFaqU hIxaC+vMyV/z1b8P4cENJXty9VdaP/IIeSBZlHn6k/vblr5Mm3VqHO2IYB48MVLhWGnHqHaSc nRPIqrtHu2kOoV1Md8z/hk+Mg5Kcc8W2F33wolRw/E1HXSJUmQPxc6jJSAy3us7HTt0mNOURr v7s7nSl7pwNf0vWl6SlV0tBVjk8bPBZU0t2xyjNQm0cKnEth7ZdtiuOkYVxeOfpif1+smkC3r hCaZN8kvhOd4aPciQGPbRA= Received-SPF: none client-ip=217.72.192.74; 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_reg_window up and use it. Fold structptr and xxargs into xargs -- the use of a host pointer was incorrect anyway. Rename the structure to target_stackf for consistency. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 29c5e3b0c0be..3474098641a6 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -21,16 +21,26 @@ #include "signal-common.h" #include "linux-user/trace.h" -/* A Sparc stack frame */ -struct sparc_stackf { +/* A Sparc register window */ +struct target_reg_window { abi_ulong locals[8]; abi_ulong ins[8]; - /* It's simpler to treat fp and callers_pc as elements of ins[] - * since we never need to access them ourselves. - */ - char *structptr; - abi_ulong xargs[6]; - abi_ulong xxargs[1]; +}; + +/* A Sparc stack frame. */ +struct target_stackf { + /* + * Since qemu does not reference fp or callers_pc directly, + * it's simpler to treat fp and callers_pc as elements of ins[], + * and then bundle locals[] and ins[] into reg_window. + */ + struct target_reg_window win; + /* + * Similarly, bundle structptr and xxargs into xargs[]. + * This portion of the struct is part of the function call abi, + * and belongs to the callee for spilling argument registers. + */ + abi_ulong xargs[8]; }; typedef struct { @@ -56,7 +66,7 @@ typedef struct { struct target_signal_frame { - struct sparc_stackf ss; + struct target_stackf ss; __siginfo_t info; abi_ulong fpu_save; uint32_t insns[2] QEMU_ALIGNED(8); @@ -150,10 +160,10 @@ void setup_frame(int sig, struct target_sigaction *ka, } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + WREG_L0], &sf->ss.locals[i]); + __put_user(env->regwptr[i + WREG_L0], &sf->ss.win.locals[i]); } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + WREG_I0], &sf->ss.ins[i]); + __put_user(env->regwptr[i + WREG_I0], &sf->ss.win.ins[i]); } if (err) goto sigsegv; @@ -349,12 +359,6 @@ struct target_ucontext { target_mcontext_t tuc_mcontext; }; -/* A V9 register window */ -struct target_reg_window { - abi_ulong locals[8]; - abi_ulong ins[8]; -}; - /* {set, get}context() needed for 64-bit SparcLinux userland. */ void sparc64_set_context(CPUSPARCState *env) {