From patchwork Tue May 18 05:30:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441130 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1784385jac; Mon, 17 May 2021 22:51:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSsnoUlu1L5SAFf5HeMm9mP/vGlDtZPC/WZzTpDpvNaNnMNzagDAvXluyJ18jD/CCLvtYk X-Received: by 2002:ab0:1385:: with SMTP id m5mr4497961uae.55.1621317076262; Mon, 17 May 2021 22:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317076; cv=none; d=google.com; s=arc-20160816; b=z46h5pxtfm3yfEmrQ8sPTuW8Nwp9q66qdyI3tQ0XbAXTvLyZPb44e2lmqyA+LCvx/P aH9h4sKtKkNGoo+i3Jr3/MAh/PO4vR8rKNlq798GpHgV2WTwKKfOmfJ0zDYdlHXsiZ41 uDF9Jx20bm9GVm/e434n2jyeTvIUJdvFeOcijkzUvQI85ANJU0xFpS9PpIdRqcmqOvHE XV/wedaak/AJXIMHirCq06mZEYyzd1LyF+vqYAr3ACLkjl6PnLDyt5iYywqJqax+L7IF z7NCon9pyzDmFTh9mb2iCYiifyItBiYJ5+GtDsSjSnvmeirxEzCy91NeMtnlv9P536lq ax+A== 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=LmZ8m/0cw6kdI0k06A39ncKHZZZPrIX+m8aY4kplE7M63pK2SsZd9aAmVJMw6Pii2y uyZAp2J8IquEpdxtPEQbmjDwC/QZg8DMXqynuxZ6YGzLBc6ua9KllHH11XvOl15n8Lhf IHk/Ds0H03GQV6PidXtwEoSEwtdPIWRgySO4mcm297feiM2dknn8rVkgg3QrqYxCipcz b/d1FMWOKypkFYa/yPB+6o1gv4453W3UE4g01Ur8tolitinXe/oGON5eSVO4lBm+r3+b dJ4uEDkReO9cKfPR7V4+C+sJ9820GPXrIsW4sX4eA63PcwdQg7QuSr1fyM+qNaL/+aK0 18wQ== 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 y20si1318577vkl.20.2021.05.17.22.51.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:51: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]:37460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisdP-0001Ph-M0 for patch@linaro.org; Tue, 18 May 2021 01:51:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKb-0007IS-PJ for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:49 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:58975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKY-00072y-2h for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:49 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N4Qbu-1lJ8Z73ego-011O5a; Tue, 18 May 2021 07:31:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 21/59] linux-user/sparc: Fix the stackframe structure Date: Tue, 18 May 2021 07:30:53 +0200 Message-Id: <20210518053131.87212-22-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:MB8TZn1JvmotdVuY4Vs1YvdS3+Jt2ru8wETuXRzGeOrUASHQa9T 2LIQQvIEbu2LSdGJu5r7rr2J66/4DybFGU6PWMt5JCQXvRzH4rorfFYfI5UlV4M7+ZdOYUL 3gchfatSgMArrq+N9MjblS4T7D5W5Occ5ss6d3q56HwZURN1w/44bzTFISFfCT0Z/qdkEvS xGR3Tqz5WcLzT9Ot0JY1g== X-UI-Out-Filterresults: notjunk:1; V03:K0:C1oN28GB6XY=:6s4HCu6cZy5gAfGSWBdyPK 5yc61zOSzWlIZ1G0LojMcoh48CdF5OPJcEin2kPBRuyEY2gFhHevjLUyQwntH0+3ynejlzcbQ 4FGBrPHanIiSXmxzuzRj1vM1L05URVX4HGfOje5GxZoOmB7JSoepwPehSz5ibGwcc1LsnEDgN wEioOBROg6CvnDHKmVFU73UF5ksVgSy56ueGsd713CWKnT/AKDr49owmhHqZvA8tEM6EBXUBp bMR/0gpMXNAmhL2TSUyaDJDp37Oqrj0r1W6S6DTWBBCn0nqsJmz6+GOLUk6v/HT6yYerdeAa9 JW2/TOFXxP5DlDNwWws1KWuv9MyuFPlv3WBa/BloVUry3LG9Nt2+eBpZO8Pw1Hav4AmJNcyv5 GdlwLmpv3mnVDylKGveqEB2nHit6eIvKZeFTNQ1RXeC9Md/RSPafvaWl6uDIYrlDfTd7yErdh OpMaN4D1lyCjSgjH64ix+G+PdkGmUvY06/P01OD4aZ4cNpaKh1WJDbNhGpztd4VzuRTtPTvWv xhfGRVihmQ9JkdrQGKEJ+4= Received-SPF: none client-ip=212.227.126.134; 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) {