From patchwork Tue May 18 05:30:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441112 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1773940jac; Mon, 17 May 2021 22:33:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwjV+K3hjVzuDe3ZuhNbjmTOg6dMJiIYFiN6aU7T9yfZiApcVESwyFqhZYyUG7v1FzBl7r X-Received: by 2002:a05:6102:392:: with SMTP id m18mr4404665vsq.40.1621316037814; Mon, 17 May 2021 22:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316037; cv=none; d=google.com; s=arc-20160816; b=ALDgbln3IZ2rkfv2Z378XulUPFX85Opay5teD24/GXvktlS4DEMkqrSF48W17iABYO MxLuIsQyM732fhSoe8NnQHBqlgCUwsYBeyrqfa0TYYbbLSZn1yilXmTh71WRiNqET6LT zNltH70ekfNcKfgxRcg4Z+99ZisH+fcJdEDstEaHVbYb8R81Sak3KbapHCjLJJ/bI6xy WHuwBMTAI7vQNSno5xUedRCMBcbNyX9KS9sCXn78I2wSKRoOHSL99c6ndZTuDXqs6ETi Xjl+n+uYB63u6vnVhdpNj/uMvjJlG81CGcd9WCrnLPrOXZXd09kMku8P4D90CuFaFHvB 0EDA== 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=/KbYqd4K0GAHMMhBrbt93yPgJkMVyahSLQQqbjpDtyQ=; b=PpCsGab3uN+AViOUldxPv5eBlZpfy5C/R3xXfSM40hxxRtrDH+X3ZvLoPzoGMD1DjM Ny1ucn/7aFmQOEPINfdDJLrZYJIvWlzF+4C6YfW8oDe2LhmuShv8p9GoZ8jnuTiCulWe L81JuZklfIUvnxxx5Er3gEBnGeDbKLvjDirW7J+H/fxkFOVWwG/KemIRFsix7TtbXCse /0GQFtg/a4Rg9ifYGlMfZ+liXIYpc90RqQ7nLceHV03YQ09f8Is7H+xCqcFWpeFjH/cR TBzbBufwxdTKDvQm0V2no/xgULU0onwHt9wSJr6oYWb9dYtpf6MUJTlEOMtflA6fBZyy mUwA== 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 p68si1744709vke.6.2021.05.17.22.33.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:33:57 -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]:47956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisMf-0004At-4t for patch@linaro.org; Tue, 18 May 2021 01:33:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKR-0006eJ-0H for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:39 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:42215) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKO-0006pm-0S for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:38 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mk178-1l3G6n3jnk-00kKmn; Tue, 18 May 2021 07:31:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 03/59] linux-user/arm: Split out emulate_arm_fpa11 Date: Tue, 18 May 2021 07:30:35 +0200 Message-Id: <20210518053131.87212-4-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:1Tw5RwhX65xUtanJL7lMepIhmcLRDc4JczHhiGsOnKOMeKKNJdH gzn4zkFqwcx//io4O41vkee2DlYSrxL5VieQGpLWUjO5Vc5p7bqAIM85HxY5gJq5mlEvhBa 8zONab+u2ZLTpK6scAjOs7yW4HgKwvj0VlKE5vS+sB3wT9r7ZzkFaQkp8v7VzKFCUoivaHb xUetbFqctBtiMHYEyf34w== X-UI-Out-Filterresults: notjunk:1; V03:K0:ijddHn25e7c=:Vsvgtw+7w4TXA+e86U2Avp tAJQPFS43083PwZOLOOaQR6E3RhCoYZpJavZ61VjJiXPh5cIU/TSiGL2a//kME9UGSDXDpcIg siTWnhiF1hVuh9V9njZXqSEavyBBG6yXE3sMcon56tLXcKvjHzVQQYtAuJR9UhHy1bauNkhJV oTokT8iuA1ioLzMnHjTZMwFtJhNfsWtxIeobAxSDs5VsYSuVRTqH1MZYX+dCUiQTWvD1d4GE4 RnE0SqYP58Y2m1pRgS+hWgivjyvI8elTAZKuxUySFXKigZK4DQKuL5fX7ajZJrMkjPWnNAQZ/ uqwzghrhKVe1ubrQ7m+uMDO87jXXgPUiL9nvI2KrmrqjfKInoABrssQQ1Ca1sXBY8oDzJ8oiA smoJxS7jdW+pJ7AGKGA/lpT6OTcVjvslNKwx6gvsWw7K3EKTmiJjuHAWiILudx/gWAXpi0Emr ypfUOrG9JWJhnAhw6rQ971yRZb6VT2AWfRLWUBhDG7SKp29zfZheH58LCCFcCI6OvKyOYTQ/t ZdTLrO6tA2EOrg8O5Q07To= Received-SPF: none client-ip=217.72.192.75; 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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Pull out the fpa11 emulation to a helper function. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20210423165413.338259-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 153 +++++++++++++++++++++++--------------- 1 file changed, 94 insertions(+), 59 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 989d03cd89d8..106909c7d880 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -224,6 +224,92 @@ static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb) } } +static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) +{ + TaskState *ts = env_cpu(env)->opaque; + int rc = EmulateAll(opcode, &ts->fpa, env); + + if (rc == 0) { + /* Illegal instruction */ + return false; + } + if (rc > 0) { + /* Everything ok. */ + env->regs[15] += 4; + return true; + } + + /* FP exception */ + int arm_fpe = 0; + + /* Translate softfloat flags to FPSR flags */ + if (-rc & float_flag_invalid) { + arm_fpe |= BIT_IOC; + } + if (-rc & float_flag_divbyzero) { + arm_fpe |= BIT_DZC; + } + if (-rc & float_flag_overflow) { + arm_fpe |= BIT_OFC; + } + if (-rc & float_flag_underflow) { + arm_fpe |= BIT_UFC; + } + if (-rc & float_flag_inexact) { + arm_fpe |= BIT_IXC; + } + + /* Exception enabled? */ + FPSR fpsr = ts->fpa.fpsr; + if (fpsr & (arm_fpe << 16)) { + target_siginfo_t info; + + info.si_signo = TARGET_SIGFPE; + info.si_errno = 0; + + /* ordered by priority, least first */ + if (arm_fpe & BIT_IXC) { + info.si_code = TARGET_FPE_FLTRES; + } + if (arm_fpe & BIT_UFC) { + info.si_code = TARGET_FPE_FLTUND; + } + if (arm_fpe & BIT_OFC) { + info.si_code = TARGET_FPE_FLTOVF; + } + if (arm_fpe & BIT_DZC) { + info.si_code = TARGET_FPE_FLTDIV; + } + if (arm_fpe & BIT_IOC) { + info.si_code = TARGET_FPE_FLTINV; + } + + info._sifields._sigfault._addr = env->regs[15]; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + } else { + env->regs[15] += 4; + } + + /* Accumulate unenabled exceptions */ + if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) { + fpsr |= BIT_IXC; + } + if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) { + fpsr |= BIT_UFC; + } + if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) { + fpsr |= BIT_OFC; + } + if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) { + fpsr |= BIT_DZC; + } + if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) { + fpsr |= BIT_IOC; + } + ts->fpa.fpsr = fpsr; + return true; +} + void cpu_loop(CPUARMState *env) { CPUState *cs = env_cpu(env); @@ -244,9 +330,7 @@ void cpu_loop(CPUARMState *env) case EXCP_NOCP: case EXCP_INVSTATE: { - TaskState *ts = cs->opaque; uint32_t opcode; - int rc; /* we handle the FPU emulation here, as Linux */ /* we get the opcode */ @@ -263,64 +347,15 @@ void cpu_loop(CPUARMState *env) goto excp_debug; } - rc = EmulateAll(opcode, &ts->fpa, env); - if (rc == 0) { /* illegal instruction */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } else if (rc < 0) { /* FP exception */ - int arm_fpe=0; - - /* translate softfloat flags to FPSR flags */ - if (-rc & float_flag_invalid) - arm_fpe |= BIT_IOC; - if (-rc & float_flag_divbyzero) - arm_fpe |= BIT_DZC; - if (-rc & float_flag_overflow) - arm_fpe |= BIT_OFC; - if (-rc & float_flag_underflow) - arm_fpe |= BIT_UFC; - if (-rc & float_flag_inexact) - arm_fpe |= BIT_IXC; - - FPSR fpsr = ts->fpa.fpsr; - //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe); - - if (fpsr & (arm_fpe << 16)) { /* exception enabled? */ - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - - /* ordered by priority, least first */ - if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES; - if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND; - if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF; - if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV; - if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV; - - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } else { - env->regs[15] += 4; - } - - /* accumulate unenabled exceptions */ - if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) - fpsr |= BIT_IXC; - if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) - fpsr |= BIT_UFC; - if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) - fpsr |= BIT_OFC; - if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) - fpsr |= BIT_DZC; - if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) - fpsr |= BIT_IOC; - ts->fpa.fpsr=fpsr; - } else { /* everything OK */ - /* increment PC */ - env->regs[15] += 4; + if (emulate_arm_fpa11(env, opcode)) { + break; } + + info.si_signo = TARGET_SIGILL; + info.si_errno = 0; + info.si_code = TARGET_ILL_ILLOPN; + info._sifields._sigfault._addr = env->regs[15]; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); } break; case EXCP_SWI: From patchwork Tue May 18 05:30:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441109 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1773100jac; Mon, 17 May 2021 22:32:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpKPTIhxQ7x7iSYLFWRP81Cq4J6ZTqvSjDMjD5//jh1QJPReDFSl+WVZEilzGRqKQ0Heul X-Received: by 2002:a67:b919:: with SMTP id q25mr4549228vsn.17.1621315953092; Mon, 17 May 2021 22:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621315953; cv=none; d=google.com; s=arc-20160816; b=k4E6721fhLKNTOOvvZq6D6sDtX4BJZIKuGgk14HvSUqd+g13B00y6C6ZeD5v/GU5lb GFgQK1SiORDhF0TW1JtorVy41/v5eoaFzLOOAfqj886T9FkdYIS50HJtjNtCk4IROBth 9hAYe9JB/4r4OF+tMiLoFo/v4rlKotCJsySXVieZvhQRIfWfOXTXZZyR386KjgutCmZd 4TcXUunwU2CTgt7IQI2C8Q92j9PN46HcgLWKJ0bTnDgN55HU5To4SgAJr5BlU7LAfldx 6FTQgETyXECZrNybn6RYcve+uz+tQ6MYFJ3w62lSfpy0atXX31uj8vXTFvzTp6cSJGwL wQiw== 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=EUyuP9k8Q3Q3Q42KyC1NZZ/MAhyG0Df1OfgfvPgi4+k=; b=E5qsOR1XsIk015M0HCEK8szITpJTXJS7NF6Gh1VSubNGiE2mvnpJ4LQFsrKHF/vx7i Jg+c440LC4+06T7UEbgX4ms+6dppZubYuKq9im4q6Lbpq53DyttLn6LPiPNt1irZsFzB Tfh8relYL9XEjrx/ivQIe011Z6zlUrd2eXacm2hnfJzUZM4WHNrWzxUIkjO++F/P0MsA mP90WoI0Tv8JgrMpF+PgRkZz8duU7CgUbJ+Dtfd2ki8fyaQnqolQ/76BECiEKPILbvHl Sq4HLpaOFzMvaGNLNko79K6ZDNiLvfmr0lzDCyRyC4qETgXRJqJurYsnYZ/LVu0EUlvu lGPA== 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 o15si9887438vsh.377.2021.05.17.22.32.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:32:33 -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]:39570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisLI-0006gN-Ca for patch@linaro.org; Tue, 18 May 2021 01:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKQ-0006dx-EG for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:38 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:46965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKO-0006qC-QV for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:38 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M5xDJ-1lodsz1hQh-007TiU; Tue, 18 May 2021 07:31:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 04/59] linux-user/arm: Do not emulate fpa11 in thumb mode Date: Tue, 18 May 2021 07:30:36 +0200 Message-Id: <20210518053131.87212-5-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:/UzUKa42WJDV8CABAfIcmjoBrnLxVJyvB4NSCtycYEbpsVwVhqM Zc0MWUdsk51xpHsIlaeC3a2VaPcZuQVk9mG7nO1ka06Yp1Ydn2PnELWz1Dje1XIzJa9ANCz RG+PxdGHfqp5+0q0JlEqcaysMI/S1cfnnOj1gehx2AM9chJvS90fWQ+JtqouvWQ2viOXpAQ MwstO16PUwDt57Lyj73FA== X-UI-Out-Filterresults: notjunk:1; V03:K0:Rk2P157s19Y=:U5BSHc2T/biMOQpEdAf0pa K6MbBJqdzyloxyrl6prLXSHW5nR8KHHt6r0E4BuxGXaz10JfVFvoQLlnbngluxzb8iqd0mv5O zcGRhmWXuqRl/oo5wAuMSY2b1AqwmNmbQriqQn3Vngt0VK4wqfnwOzXBF5SGvCWem8D+Wudqr 75mdcjqP1phsFms/KZ95kh3TU1hCAuVwzZrTtKu6vbB+eOQTfmEThqXXka/wn8kTDWOxqwTNi xUr0elv4oDaF6Uxr9fuqyOJ+fpZsOHt3Bu8IrsEHwj3afMojwIXNmesyLhrS9Vz3a6EFiSvz0 CMlQVdKn2CDoyAxKCcBOVGWHkXFcw7dMTMOl9xbyFaLOODspGmiT6rcgvAI+j6WSx3kc/dxdP fnfsoUU5SKwjO8G+y3SL3mCqsptw4KerieQuPHRJatssaXnDvodiGuxF9T24/MTX4hL7j0l7R MHB2nhcEtSscmybbt2FZaL6xYLKff9SxStIQ6Kcq+Xs4E+hczQcoIu4Pe9jOLcxGHCD9XXIMt dXrJ4jW/eefwedW90G5SnQ= Received-SPF: none client-ip=217.72.192.75; 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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These antiquated instructions are arm-mode only. Buglink: https://bugs.launchpad.net/bugs/1925512 Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20210423165413.338259-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 106909c7d880..e2a1496b9fe7 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -347,7 +347,7 @@ void cpu_loop(CPUARMState *env) goto excp_debug; } - if (emulate_arm_fpa11(env, opcode)) { + if (!env->thumb && emulate_arm_fpa11(env, opcode)) { break; } From patchwork Tue May 18 05:30:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441110 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1773121jac; Mon, 17 May 2021 22:32:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlcQJod9kz9zkYXW6yDU580w0Egwk/r9civ477EJEsAfIvyhUTAL5uhaIryHzbBbRJLEwc X-Received: by 2002:a05:6102:124d:: with SMTP id p13mr4256783vsg.58.1621315954166; Mon, 17 May 2021 22:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621315954; cv=none; d=google.com; s=arc-20160816; b=cuEOWKTkffyLwvocYCjQjtUSn0TaJOGTzcIwUcZ6nMy70/H5tn8pYtdIbD863iuHxQ bNzDHJkev8MIujl6Nr2HKQZC+Gt4AY94ABEUaPhnGr8x3Yq8bv37onZ5VxI/GKjZBdhZ TBgRo6LAmUhltGTyNO/NhnfipsJzOY7Zhippm47i1DfaVG1SgbVHoCgJ6RBaVEEwY8zx uSQtljyY2KQdt0rO1OMde2X2SfSTbGWlQEm8DumCJ+JjbMNs9aIoVkB7/LGUKyZiPQ3b HZs0BKlqk8lFxMlMFamaQ2c4imz80e8KGs+5au4JBI9xAJdgmsW5ZB8xRNJZzmSByxig IAlw== 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=Gwtu2bwOjeV8nx3q69g5zVj7qdW0SsuFeyNbW1BIYQo=; b=XoxsR2blLN/f9RvLQL/I31Ye1u8D9dGCzrBXO0tpeDWFlJh+L7UlVhP+DpmY4HEDbC IgwIRs4guOIG5MFqkBiuBDZ8o621mq044/rtP5JyFjqVrm7zxAUbG9a5IFlq4BnD9dcL XKiA/89/6hCzmcw3Zr4qVhqOimq0e8KKYFhyCkE5GFhioKFQa9Xz0OyZXolTHPOuCJd+ cOHzE7gtkw9bn3/9PfB2mPMkoz92S6qTrY2Su6KcY01kiUgq9IYxiq5MnId4Z/he3iRG B+eUs7yyAB3NEQ7/NDOKF48jR2mNHyxz5gCCoWH61tp4L2DalIGK0Q8bs8F1MaOTqQMz wlKg== 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 h14si3742043uap.213.2021.05.17.22.32.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:32:34 -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]:39644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisLJ-0006jF-Ii for patch@linaro.org; Tue, 18 May 2021 01:32:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKR-0006fL-Kl for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:39 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:38281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKP-0006rY-85 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:39 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M27ix-1lko8d3fxp-002Vdo; Tue, 18 May 2021 07:31:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 05/59] linux-user/arm: Do not fill in si_code for fpa11 exceptions Date: Tue, 18 May 2021 07:30:37 +0200 Message-Id: <20210518053131.87212-6-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:5D98tTpusNVYKwgF/UlPpY4Q7yRnTsGkIxu0I/TyQXiSoN6Vqan M3pXP2zd+Fn+s6PLdCoINwpfYtB4QikbU/NUioGAAlEmfhAaplq+icpkJSkwPucRYsOkEwC 7Bd60NVvYqZFj6BWWg3fphjsU6Of2FhILwjJ2f+2VVDJDSm8kvq5pZJmLpz14emWai53dVR Uwk27wUbx6+pp+ejddy3A== X-UI-Out-Filterresults: notjunk:1; V03:K0:wK/v6X9ir5k=:apC3rRfzW1AL9gpKZniGYg tH4SXtAQjUJpwH7gn4xm5PtzRp8E6/HWeHC4eFLiLNEJASk087wrg9EHNo+Vk82jhWwICZoQk tvP7v1lCr26sSxwQjmgsNEby4BYpAltq0PqltLKx39mPGEiBtoLXpSRqEEUH2KuQI5ACcMYwL En6K7E/TLqdZG1eI47oDAC/WfQTeHUiKtJ2MityP2HFb4LtLQ0Ye4ZcIIeMqo/7S2Wrzf+3n8 vC27kuIhYRTQ1bKFhdZZ1/WLB6zdO2ch1f84c5qc6PJwm4gfDOLGYs0Kty9BsV9lhN4N4h+y8 0sbEbKW0OrsOQZDHvX4rajR8doX0MQreGdUyW5LI4OZtYgLTWoIBJb2eGryZQ49VJNSDl/GMn KJJsp+bFDzRHBcSVg+3TtFBu/l7JrVV2JVDuLqCJ4hlDB4s35UOSHZ8WuljpCop27GwOfy0jS F8d+t9UxCHucR3XepF/JpJIC4IWc3M02f4b8ZVa2omPYvIApfPGlLmTS5Wfxq1Jq9Bd2FI9/l alELUjnKOrfSM2XD5esgew= 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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There is no such decoding in linux/arch/arm/nwfpe/fpmodule.c. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20210423165413.338259-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index e2a1496b9fe7..5f61d25717c3 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -262,29 +262,15 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) /* Exception enabled? */ FPSR fpsr = ts->fpa.fpsr; if (fpsr & (arm_fpe << 16)) { - target_siginfo_t info; + target_siginfo_t info = { }; + /* + * The kernel's nwfpe emulator does not pass a real si_code. + * It merely uses send_sig(SIGFPE, current, 1). + */ info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - - /* ordered by priority, least first */ - if (arm_fpe & BIT_IXC) { - info.si_code = TARGET_FPE_FLTRES; - } - if (arm_fpe & BIT_UFC) { - info.si_code = TARGET_FPE_FLTUND; - } - if (arm_fpe & BIT_OFC) { - info.si_code = TARGET_FPE_FLTOVF; - } - if (arm_fpe & BIT_DZC) { - info.si_code = TARGET_FPE_FLTDIV; - } - if (arm_fpe & BIT_IOC) { - info.si_code = TARGET_FPE_FLTINV; - } + info.si_code = TARGET_SI_KERNEL; - info._sifields._sigfault._addr = env->regs[15]; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); } else { env->regs[15] += 4; From patchwork Tue May 18 05:30:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441115 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1775090jac; Mon, 17 May 2021 22:35:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjmGqhGlCjuFILdcyYDezFjw0fhzz62Xtk/RxHrQIfXIUVNPnQvk30b8hf+EQlnm3iqDVQ X-Received: by 2002:ab0:4588:: with SMTP id u8mr4641416uau.111.1621316151141; Mon, 17 May 2021 22:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316151; cv=none; d=google.com; s=arc-20160816; b=y/v5Q68DI5OfozrOWxfuboyChNthvmwWgYlbUWJqud6FRWOpUkNGimTUIAkpfONxcz 3jzbMDRkEULVSnA7OOhti1q2PQVEBTLeasdEPrzs3knYwE/QQRH49Av72Q53CEEdenHD 7sIMOtstrtW4CkcCx7GZDfgbKbwsXafzHlCfGkMJRoCZCYIrBHaRXgVi8BXi2PyWxNdK xYChOB4BnRzU+02wJyiJ+Eu9gv05TKNr8ZHExWdpnlJomiRclPv80DP6VyGHfRCJrs/b PilX+4KmS2jsoWnhNyxaiLDTGjibk2FrmRT9bVlVySWOcE8NCcTeHnRksidQ2XJK6hG9 Jx/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=jbdI/CHaHgWq/cOVm0TK8wMMliI9NiY7E7zqifqtDpU=; b=m0ffB/ANHXMnqGC0HMZmy+6XWIrwHgzzG8HbNydvi/LdLRKdu5jOAwKRBVM7x+xZT7 AfEqSh4oSoU9Dog52DAmqhXKbiOMqz+oJAV/3X5ro3cxPIPQTs2NJ1ifRC1uPi5gK30E 1B/M82UAHm0OxkZ9KuuWWTVKWTuOF1SvHe+PL1W22XjVZDA4MD6AYcx5sG8f3ENOyrev BUeNV+voIePnt+Vd6bWGDPPNQwP8p6YU3eg6aA+X5oqAUnWaXOgirmNlSNSGNDXRyO5y 5Eh0IynoOhvIJvWTGJKtlTd+ft8FWDDyrG8+jUOfIYmvFiUcABcA6H5dDAWvqS2CcJ/g RQAg== 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 c67si8010493vkh.92.2021.05.17.22.35.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:35:51 -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]:56820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisOU-0001fB-Ig for patch@linaro.org; Tue, 18 May 2021 01:35:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKU-0006mg-5j for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:42 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:58825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKP-0006re-C6 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:41 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MNLVU-1m6Rsz1av4-00Os0h; Tue, 18 May 2021 07:31:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 06/59] linux-user/arm: Simplify accumulating and raising fpa11 exceptions Date: Tue, 18 May 2021 07:30:38 +0200 Message-Id: <20210518053131.87212-7-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:hPsgTGe4wD6egtnSMmt+wXOoApQ3tO5BCWo5A7PBwoYdqj+E2TL JpsDNYzain8Lk7UX/3LUJ0cFVO4c2g8qK+ADKLwBh9oSspISQjdgesU08WKeIdEYHo7PEzX uV/+DxcPj61Fu0NLJje/FQuC+QlTar26kPiu5xjl/Tb2LzZPb3vyhpIC55CSQOmQj5cKYTe oZryk2diDDH5zMU1TNb4g== X-UI-Out-Filterresults: notjunk:1; V03:K0:g0lQq33wMK8=:tr9ja6j6Cbg5Tl0tc05Sn3 6Cmyun+gra9MPkfaNIVBaaciuUy30dtL9ZUKWEIOH4uEYYuBoJHhpQN7OXFTCIpRjPawJipJp Nq/NAxl7KTcbeUfvg8EDdCYGOfntFmYUCN5oxqaGtkzTOKIrIzdpJDyMoQNLPACLi85O7tR+c rirj01TzF+mybadITyFpRb5eVB7T7hyZ5Zw61r+dBfAcmEU9UsmDDjHW+hxNy7otuVIds3RUh HGpaO1v6roSI7p6n54SGOwlj7HjaUmZUp2J1QxvXlDljzT2MlTh8UBrzN/Snvae2ndhagebLG klbTgTdnhEQijB+QPqtEchntbi3jIB4pB9vDY9mD51ruLYKab4BidTasgKhOXhR2RnPtcdVH2 wNq+YpJyD3w74/evoSwCKX8P28m83AF85Z2u/xl3p00qk+fpMJKWYcMpw6icSskZKeDpIZbj3 q37lpZkJ3pZGx2djvrzhW5hwT8b57nIG/PSfgZDJflaUM5lTehM3KMJXR6S+4smFhPjpILOaj gdHWcS3I+HYHvZSBT4tKAs= Received-SPF: none client-ip=217.72.192.75; 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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use bit masking instead of an if tree. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20210423165413.338259-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/cpu_loop.c | 50 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 5f61d25717c3..69632d15be18 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -228,6 +228,7 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) { TaskState *ts = env_cpu(env)->opaque; int rc = EmulateAll(opcode, &ts->fpa, env); + int raise, enabled; if (rc == 0) { /* Illegal instruction */ @@ -240,28 +241,31 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) } /* FP exception */ - int arm_fpe = 0; + rc = -rc; + raise = 0; /* Translate softfloat flags to FPSR flags */ - if (-rc & float_flag_invalid) { - arm_fpe |= BIT_IOC; + if (rc & float_flag_invalid) { + raise |= BIT_IOC; } - if (-rc & float_flag_divbyzero) { - arm_fpe |= BIT_DZC; + if (rc & float_flag_divbyzero) { + raise |= BIT_DZC; } - if (-rc & float_flag_overflow) { - arm_fpe |= BIT_OFC; + if (rc & float_flag_overflow) { + raise |= BIT_OFC; } - if (-rc & float_flag_underflow) { - arm_fpe |= BIT_UFC; + if (rc & float_flag_underflow) { + raise |= BIT_UFC; } - if (-rc & float_flag_inexact) { - arm_fpe |= BIT_IXC; + if (rc & float_flag_inexact) { + raise |= BIT_IXC; } - /* Exception enabled? */ - FPSR fpsr = ts->fpa.fpsr; - if (fpsr & (arm_fpe << 16)) { + /* Accumulate unenabled exceptions */ + enabled = ts->fpa.fpsr >> 16; + ts->fpa.fpsr |= raise & ~enabled; + + if (raise & enabled) { target_siginfo_t info = { }; /* @@ -275,24 +279,6 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) } else { env->regs[15] += 4; } - - /* Accumulate unenabled exceptions */ - if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) { - fpsr |= BIT_IXC; - } - if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) { - fpsr |= BIT_UFC; - } - if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) { - fpsr |= BIT_OFC; - } - if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) { - fpsr |= BIT_DZC; - } - if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) { - fpsr |= BIT_IOC; - } - ts->fpa.fpsr = fpsr; return true; } From patchwork Tue May 18 05:30:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441123 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1778352jac; Mon, 17 May 2021 22:41:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8/nf2dq9fFa9IMCogGRj/07cB/LP//97+d03uQtBEuhKYj5ywt03+Hb2wjPYXme0fz0od X-Received: by 2002:ab0:1c4e:: with SMTP id o14mr4656344uaj.142.1621316480086; Mon, 17 May 2021 22:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316480; cv=none; d=google.com; s=arc-20160816; b=TD4rsR1E7XcR1gkybjOpJuwxgLvNdk5voK4e7KYuZIkypZ6xbgdcIyoK6gTLr1kh2w NdfxAZQ/a8PG2XHkU3X72sIRPwZLWusITJddi01vQhRyWaILXZ9fi3U83KsEx4sGoKwJ ivrw7ZbQ89GDn29gAlcy3PUwcFPHftUSFuI9v+7l6fe8914Q70Ftbbb8BSaagOLQRBHY 15A04tw7PKIUKKdlNHshz+AGq7DCRGsFmp3pvEfJ0Xfvfh0ombluNh2dihiG3usEnE6M cRZjUw8UXNYU2sw5pSiz5y+Xo41ri6n4flIzx9lLf4UPErzjc+IKwU6XGTVvzUET8F2c 9+lw== 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=wZoLARSpdvqVLNjjpLNZp9I6FDFZTQJ9G7VRoh3dCdc=; b=wdlye+q7bVJA9n5KvnbGNCsKixnkcrIYqmk7D89sElJ6hxzbmZkbAgTWbc3X+jDkgU fNGrTTEPOsfXcLC9TXVqInq2rT6/T3hZWObjQRcp5bJSe5LMwtua78A2EwJMHdp3xEde jBQxadX7ucf8SHBbUo5iFTRyVIoWt4gao0pjb+dQwmaf4XDgIXcDx4kva1QDCk9lOcMg sF9oh1HqLWV5UgIr0nA5ZmxXhNLKN53PyPVPCgd957Azf+rthkxNxM4LQtwmoxT3T8Zd 1d5MHePPBqOLhSE6BSY4MXik7WabZ+Hz4Kb/QCwpAtr9ANuyQIk2++wT4o0IWCdqIFCq OT8w== 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 v9si9905592uaq.191.2021.05.17.22.41.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:41:20 -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]:45698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisTk-0004hj-BP for patch@linaro.org; Tue, 18 May 2021 01:41:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKV-0006rH-98 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:43 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKQ-0006sZ-Lg for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:42 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MS4ab-1lt1c319gZ-00TUiw; Tue, 18 May 2021 07:31:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 08/59] linux-user: Split out target_restore_altstack Date: Tue, 18 May 2021 07:30:40 +0200 Message-Id: <20210518053131.87212-9-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:TyP3aaOU60R0iEsbpHWQwOBOwhTaHmDdeKiaPCaIRcpfJbf2gUj yfi1kX2KEgVQcSe25TNbPfBKLZEI19xb+vykmW4KlcSuzVSPtah138iMZ9PsY0SI+s0zjBZ Bj/pC4I8XNAp0VSvI/UrHwJUNdyQSKPYR+Z5XslbNiRnG8wQBm758WKWMDkOR0saivs43EQ +69YqfuIc2sUVi9DqOLkg== X-UI-Out-Filterresults: notjunk:1; V03:K0:QzHqGHPNqh4=:eU5UW7lC9JSaEkWbsW1Ryf pm/YI5uIYw42do2+MxIJuxDtEPtG1hSvtpRO9LCrhjldz3w4osDRWkhfCm1uWIY3q6o4iaoDp yI2sY7H9LOzo/w0l+V66qbBZdzfqe0VvEVQuPbdWMG0I72FHL58hmTGOABWj21T7sWbXusvM0 jiW81GQMzh6d4LuyHz96ngaCiP8LOCwZUHSrFccqK0EuKIy/uDzWPIOThRFB+Dc6CGEEkrW0A lBedx7C08azbblqBw58BsauPdFAmSp4S72eDo4aGSGUdFXUsgpIWu47H5z2/DVtd3zYvijPPS UHHcLi+0YCfRNu9qf1zjSKO64QTR4HIqf4gBfvW2a5OjNSLOnlKdpBYDTcX4uimqPd9Hpg3o2 Y7gHY26cGD6ghEmSFuq8un25nG5vU6Y9jZStHw0pBtxRCPPFZoS5fd/4CdPByXrsAv4VpGIIT 6wimN9JLWCd6fRyEudi84bCwDUzOVeue8xgaducAr7giMTRX4f27K8iISSrq34Qfib6tsKL2Y 8wjm83T1x1m+uY1Fl1sIFg= Received-SPF: none client-ip=212.227.17.13; 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, 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 Create a function to match target_save_altstack. Fix some style and unlock issues in do_sigaltstack. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/signal-common.h | 1 + linux-user/signal.c | 115 +++++++++++++++++++++---------------- 2 files changed, 66 insertions(+), 50 deletions(-) -- 2.31.1 diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 1df1068552fb..34b963af9abc 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -24,6 +24,7 @@ int on_sig_stack(unsigned long sp); int sas_ss_flags(unsigned long sp); abi_ulong target_sigsp(abi_ulong sp, struct target_sigaction *ka); void target_save_altstack(target_stack_t *uss, CPUArchState *env); +abi_long target_restore_altstack(target_stack_t *uss, abi_ulong sp); static inline void target_sigemptyset(target_sigset_t *set) { diff --git a/linux-user/signal.c b/linux-user/signal.c index 7eecec46c407..9daa89eac5db 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -297,6 +297,50 @@ void target_save_altstack(target_stack_t *uss, CPUArchState *env) __put_user(ts->sigaltstack_used.ss_size, &uss->ss_size); } +abi_long target_restore_altstack(target_stack_t *uss, abi_ulong sp) +{ + TaskState *ts = (TaskState *)thread_cpu->opaque; + size_t minstacksize = TARGET_MINSIGSTKSZ; + target_stack_t ss; + +#if defined(TARGET_PPC64) + /* ELF V2 for PPC64 has a 4K minimum stack size for signal handlers */ + struct image_info *image = ts->info; + if (get_ppc64_abi(image) > 1) { + minstacksize = 4096; + } +#endif + + __get_user(ss.ss_sp, &uss->ss_sp); + __get_user(ss.ss_size, &uss->ss_size); + __get_user(ss.ss_flags, &uss->ss_flags); + + if (on_sig_stack(sp)) { + return -TARGET_EPERM; + } + + switch (ss.ss_flags) { + default: + return -TARGET_EINVAL; + + case TARGET_SS_DISABLE: + ss.ss_size = 0; + ss.ss_sp = 0; + break; + + case TARGET_SS_ONSTACK: + case 0: + if (ss.ss_size < minstacksize) { + return -TARGET_ENOMEM; + } + break; + } + + ts->sigaltstack_used.ss_sp = ss.ss_sp; + ts->sigaltstack_used.ss_size = ss.ss_size; + return 0; +} + /* siginfo conversion */ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, @@ -758,73 +802,44 @@ static void host_signal_handler(int host_signum, siginfo_t *info, /* compare linux/kernel/signal.c:do_sigaltstack() */ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp) { - int ret; - struct target_sigaltstack oss; - TaskState *ts = (TaskState *)thread_cpu->opaque; + target_stack_t oss, *uoss = NULL; + abi_long ret = -TARGET_EFAULT; + + if (uoss_addr) { + TaskState *ts = (TaskState *)thread_cpu->opaque; - /* XXX: test errors */ - if(uoss_addr) - { + /* Verify writability now, but do not alter user memory yet. */ + if (!lock_user_struct(VERIFY_WRITE, uoss, uoss_addr, 0)) { + goto out; + } __put_user(ts->sigaltstack_used.ss_sp, &oss.ss_sp); __put_user(ts->sigaltstack_used.ss_size, &oss.ss_size); __put_user(sas_ss_flags(sp), &oss.ss_flags); } - if(uss_addr) - { - struct target_sigaltstack *uss; - struct target_sigaltstack ss; - size_t minstacksize = TARGET_MINSIGSTKSZ; + if (uss_addr) { + target_stack_t *uss; -#if defined(TARGET_PPC64) - /* ELF V2 for PPC64 has a 4K minimum stack size for signal handlers */ - struct image_info *image = ((TaskState *)thread_cpu->opaque)->info; - if (get_ppc64_abi(image) > 1) { - minstacksize = 4096; - } -#endif - - ret = -TARGET_EFAULT; if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) { goto out; } - __get_user(ss.ss_sp, &uss->ss_sp); - __get_user(ss.ss_size, &uss->ss_size); - __get_user(ss.ss_flags, &uss->ss_flags); - unlock_user_struct(uss, uss_addr, 0); - - ret = -TARGET_EPERM; - if (on_sig_stack(sp)) + ret = target_restore_altstack(uss, sp); + if (ret) { goto out; - - ret = -TARGET_EINVAL; - if (ss.ss_flags != TARGET_SS_DISABLE - && ss.ss_flags != TARGET_SS_ONSTACK - && ss.ss_flags != 0) - goto out; - - if (ss.ss_flags == TARGET_SS_DISABLE) { - ss.ss_size = 0; - ss.ss_sp = 0; - } else { - ret = -TARGET_ENOMEM; - if (ss.ss_size < minstacksize) { - goto out; - } } - - ts->sigaltstack_used.ss_sp = ss.ss_sp; - ts->sigaltstack_used.ss_size = ss.ss_size; } if (uoss_addr) { - ret = -TARGET_EFAULT; - if (copy_to_user(uoss_addr, &oss, sizeof(oss))) - goto out; + memcpy(uoss, &oss, sizeof(oss)); + unlock_user_struct(uoss, uoss_addr, 1); + uoss = NULL; } - ret = 0; -out: + + out: + if (uoss) { + unlock_user_struct(uoss, uoss_addr, 0); + } return ret; } From patchwork Tue May 18 05:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441114 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1774402jac; Mon, 17 May 2021 22:34:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzArURBCqrHZ1eiJFQzvy8gATtBBGfdWVALNIvBuiARHsBK5BLwA0O4vEmRcxNfYKcMn68f X-Received: by 2002:a67:1684:: with SMTP id 126mr4452283vsw.37.1621316080908; Mon, 17 May 2021 22:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316080; cv=none; d=google.com; s=arc-20160816; b=f95GfbJGoMWJka+jKS+9n2fXVcDvES75YRLuLC1eB5Crw34cdjcrg5E8eQbQZDdxM0 lJ+ALOMDS1/anXnA2sDflpO0JbQTM9MWGm2duYJDX4wo1CVpTjaWIR2e/jBcwplBw6WK /cCrwHMPUr43K595ACVEmaz5T+JJnp/hy7+UMFFuz4nIJO4Qosc1kABW2kuOXiXjw3qs UHe/+odBT5pIZnA4sQA2Sm02/teLBa/n3myzF957dbAoqiuvPOJxFGd4N+0qo27Gwax7 NwGrs4Sc91k7tHRHPzJIC4XLdHKOS/LWsIaVZVjXoz1d6AcXyQaLYsL5c+USywuyIaQy izYw== 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=w4zO68ONdyQCIfIsEC3jbLljXfT8nYkAHXAT2D0uYKA=; b=p5WsFmq7gV5y313eFNrO0ZOMxh2z+if2vdcTdaSoUiHg2je0MVhq3R+hPuN/ENL1px IUJpynAniWvdO0HVQ7iHjqtE3agtqzWLkd3jJOAWxHms4bP571n3vq82KxSOXP5lqyeL GNnksihxYBm+Ut7ZDGMqZD1pQIfcho+sfhN229VnqLYaJ7ggqGWhdK/d8xua1epw8x8h geAY73f0PuAc+HN/z4x/jZtPi9Fj5qrUWHT084vUa9qo810TLd7drelGR3o8G7Z0TCMw wtOfjOuu9uN6GMwQXRyuUNapn/onTXkVLpijTXdfKZkuKazH4YJMC/Qcq2tTTHWvnaH3 2LCw== 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 k4si3938412ual.14.2021.05.17.22.34.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:34:40 -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]:48176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisNM-0004J6-7h for patch@linaro.org; Tue, 18 May 2021 01:34:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKT-0006lQ-To for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:41 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:56877) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKR-0006tQ-0m for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:41 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MjSsm-1l2i8o3DAY-00kt19; Tue, 18 May 2021 07:31:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 09/59] linux-user: Use target_restore_altstack in all sigreturn Date: Tue, 18 May 2021 07:30:41 +0200 Message-Id: <20210518053131.87212-10-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:YdeyL+51I9nU79hB8kJaOGG7cNr8wmUCF3tY4vIlgxnMZjYnhUh PeExuvcCvshQKPHDqPlw2Q98X82GmGeNfFQGB7RLAi61dcUf6NLYDhURG6OqbEO0imBLZGk MHU1DN8lygm6AUBx/6eUsfIcZhonTSgZ0OeCh9qU6ykg1y4IqAnaNYCFWtj9XWmhCTYqESE 3FmMZy0iB9/gHrCXICvng== X-UI-Out-Filterresults: notjunk:1; V03:K0:brCdCloNWww=:bKb4an6O/vfM/RvPd8+kOh FZI6QASCHIIBl3FapE0eCE9qAxu21TpmDWAFlej8rDbNZskoj1SW9CmxNJ9wt4V+7YqkyZj+o HEZ8B0FcQ9+wDDM6nhhkJUr2f3x1TfLNixAd6WpYkiXqbxg3WAshmo+7L6FRPjsineevcO63Y h9xgsbPAvxyzPkDNvPcaqkfFf1q0t5o10zUhGm/N60cINhSKdCd4hLLyDvspFLr7L0XPHXvpI 2Gg28Xxe3dJv3e58eln7SD/1JE7OaBfJBu8pDGc9f6EUrw518VV+zfpbcj+3MbEqY3/hIu3oF VsT+PWULDcm45Cdrr+DguFbfLLvs7wk7ZJynGVHfvJRvNrQimgnc3xuXivR8a5j5fWrIOEmwZ PtDf2HQF4jcuY+MDo/md3A74ZAJkmrH3t12aWoSnNkc7a3mfRhqhNT+GCAXMZ/wuY83LhphUN ruEG7yv0jEGzi5148xGgcs5/Ge5mzG8FZWuLgOD6OwYcYISrkb1+xx6FXVZWkyNmWTuXebCyb qCRpQKEz3Bbi5FpJkXwoCk= Received-SPF: none client-ip=212.227.17.24; 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, 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 Note that target_restore_altstack uses the host memory pointer that we have already verified, so TARGET_EFAULT is not a possible return value. Note that using -EFAULT was a bug. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/signal.c | 6 +----- linux-user/alpha/signal.c | 6 +----- linux-user/arm/signal.c | 9 ++------- linux-user/hexagon/signal.c | 6 +----- linux-user/hppa/signal.c | 8 +------- linux-user/i386/signal.c | 5 +---- linux-user/m68k/signal.c | 5 +---- linux-user/microblaze/signal.c | 6 +----- linux-user/mips/signal.c | 6 +----- linux-user/nios2/signal.c | 8 +------- linux-user/openrisc/signal.c | 5 +---- linux-user/ppc/signal.c | 4 +--- linux-user/riscv/signal.c | 6 +----- linux-user/s390x/signal.c | 6 ++---- linux-user/sh4/signal.c | 7 +------ linux-user/xtensa/signal.c | 6 +----- 16 files changed, 18 insertions(+), 81 deletions(-) -- 2.31.1 diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index b591790c22ed..2a1b7dbcdc2b 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -561,11 +561,7 @@ long do_rt_sigreturn(CPUARMState *env) goto badframe; } - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index c5c27ce08419..0af022711815 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -257,11 +257,7 @@ long do_rt_sigreturn(CPUAlphaState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, - uc.tuc_stack), - 0, env->ir[IR_SP]) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, env->ir[IR_SP]); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index f21d1535e4d9..b7a772302f45 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -685,11 +685,7 @@ static int do_sigframe_return_v2(CPUARMState *env, } } - if (do_sigaltstack(context_addr - + offsetof(struct target_ucontext_v2, tuc_stack), - 0, get_sp_from_cpustate(env)) == -EFAULT) { - return 1; - } + target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env)); #if 0 /* Send SIGTRAP if we're single-stepping */ @@ -773,8 +769,7 @@ static long do_rt_sigreturn_v1(CPUARMState *env) goto badframe; } - if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe_v1, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) - goto badframe; + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); #if 0 /* Send SIGTRAP if we're single-stepping */ diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index fde8dc93b7a6..3854eb4709be 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -260,11 +260,7 @@ long do_rt_sigreturn(CPUHexagonState *env) } restore_ucontext(env, &frame->uc); - - if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, - uc.uc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.uc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index d1a58feeb36f..578874cf27e6 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -187,13 +187,7 @@ long do_rt_sigreturn(CPUArchState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - unlock_user_struct(frame, frame_addr, 0); - - if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, - uc.tuc_stack), - 0, env->gr[30]) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, env->gr[30]); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 9320e1d47267..3a0a1546a63e 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -581,10 +581,7 @@ long do_rt_sigreturn(CPUX86State *env) goto badframe; } - if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe, uc.tuc_stack), 0, - get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index 49ff87c77bce..004b59fb6118 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -400,10 +400,7 @@ long do_rt_sigreturn(CPUM68KState *env) if (target_rt_restore_ucontext(env, &frame->uc)) goto badframe; - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, get_sp_from_cpustate(env)) == -EFAULT) - goto badframe; + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index cf0707b5564b..f59a1faf47bb 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -209,11 +209,7 @@ long do_rt_sigreturn(CPUMBState *env) restore_sigcontext(&frame->uc.tuc_mcontext, env); - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 455a8a229a83..456fa64f41cd 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -368,11 +368,7 @@ long do_rt_sigreturn(CPUMIPSState *env) set_sigmask(&blocked); restore_sigcontext(env, &frame->rs_uc.tuc_mcontext); - - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, rs_uc.tuc_stack), - 0, get_sp_from_cpustate(env)) == -EFAULT) - goto badframe; + target_restore_altstack(&frame->rs_uc.tuc_stack, get_sp_from_cpustate(env)); env->active_tc.PC = env->CP0_EPC; mips_set_hflags_isa_mode_from_pc(env); diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index 7d535065ed98..751ea88811f8 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -82,9 +82,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc, int *pr2) { int temp; - abi_ulong off, frame_addr = env->regs[R_SP]; unsigned long *gregs = uc->tuc_mcontext.gregs; - int err; /* Always make any pending restarted system calls return -EINTR */ /* current->restart_block.fn = do_no_restart_syscall; */ @@ -130,11 +128,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc, __get_user(env->regs[R_RA], &gregs[23]); __get_user(env->regs[R_SP], &gregs[28]); - off = offsetof(struct target_rt_sigframe, uc.tuc_stack); - err = do_sigaltstack(frame_addr + off, 0, get_sp_from_cpustate(env)); - if (err == -EFAULT) { - return 1; - } + target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env)); *pr2 = env->regs[2]; return 0; diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index 232ad82b98be..86f94d7f766d 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -158,10 +158,7 @@ long do_rt_sigreturn(CPUOpenRISCState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - if (do_sigaltstack(frame_addr + offsetof(target_rt_sigframe, uc.tuc_stack), - 0, frame_addr) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, frame_addr); unlock_user_struct(frame, frame_addr, 0); return cpu_get_gpr(env, 11); diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index bad38f8ed9b1..b44d5ce73c31 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -655,9 +655,7 @@ long do_rt_sigreturn(CPUPPCState *env) if (do_setcontext(&rt_sf->uc, env, 1)) goto sigsegv; - do_sigaltstack(rt_sf_addr - + offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, env->gpr[1]); + target_restore_altstack(&rt_sf->uc.tuc_stack, env->gpr[1]); unlock_user_struct(rt_sf, rt_sf_addr, 1); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index 67a95dbc7b91..81d1129da3d2 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -192,11 +192,7 @@ long do_rt_sigreturn(CPURISCVState *env) } restore_ucontext(env, &frame->uc); - - if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, - uc.uc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.uc_stack, get_sp_from_cpustate(env)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 7107c5fb5335..73806f547270 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -307,10 +307,8 @@ long do_rt_sigreturn(CPUS390XState *env) goto badframe; } - if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0, - get_sp_from_cpustate(env)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index 29c1ee30e6d6..684f18da5862 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -323,12 +323,7 @@ long do_rt_sigreturn(CPUSH4State *regs) set_sigmask(&blocked); restore_sigcontext(regs, &frame->uc.tuc_mcontext); - - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, get_sp_from_cpustate(regs)) == -EFAULT) { - goto badframe; - } + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(regs)); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 590f0313ffe9..22ec6cdeb98e 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -253,12 +253,8 @@ long do_rt_sigreturn(CPUXtensaState *env) set_sigmask(&set); restore_sigcontext(env, frame); + target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); - if (do_sigaltstack(frame_addr + - offsetof(struct target_rt_sigframe, uc.tuc_stack), - 0, get_sp_from_cpustate(env)) == -TARGET_EFAULT) { - goto badframe; - } unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; From patchwork Tue May 18 05:30:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441119 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1776189jac; Mon, 17 May 2021 22:37:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNZjnyzsoWczs9sD1x5NOBZSUFpHg0M1rBUQ1dm/x2pGdY3dXuehYScN+2nXjL0i2Chiw+ X-Received: by 2002:a1f:160c:: with SMTP id 12mr4238474vkw.25.1621316260864; Mon, 17 May 2021 22:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316260; cv=none; d=google.com; s=arc-20160816; b=m0yO5uH9FNgN1aRv7ldGA1SdAIlnnK9pOlum9S6h/9ezXtFqMyLyjWv3y236xn+SwU Kjpl/PyYwvQiJDAr7NvvXQ5pG8GFsEiT+wjVUBZ1xFq0l90zxb+wDfOoHsMfV/Fv2htp hBkVrKHKTMWNoEr0xkOzFlYWL46equgNfTAyKrNlaewpcsMHk1MdhUS/2EIg3oXPinzO ohWt2djSDc8B+zw91v2KUkASUbHcNl04DV20tp+2RqdO+E9rXZ10KguR13WLWtaQka7C iZ3/0HvpGve6mcpbePzYknY3Aq9RVqzCJXUdi/cMlw5YpZA+aj/waAl/1mtdaHxxw8tJ TzBw== 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=FsBmKb5yhr2M5OsIL5COxS7Do7okkyTuDNGVTS8LN8E=; b=d+m09ajVT6JLWp59p89g6PUlSttisqwxYNLSlB9cDYwvNNmSWtzc3DV4J6yXy5s66Y fQY0f4/wheCNbYIq7bvrIech187lBCgoE1DZrhYxCkghXI4JW7rYRqHSFdT6AF/LwClu eJzllDQnQWFbuaxm2SWRhTo7wDtEdLFJsvni9X5AAEnYlFMzv2mEzNkapokzvr6wGOpF l9swMdmGMwWxf5IMTO9JDRXAf1a6hND8xoEE6vAAChcFOSCbLvK7e0WsQAjn0JdensQt Mr4utIYUbWCo33SikXBXowmZiBuWhQewFMUuQFHrUSW4Mq2Mgv6uqjUjaEoGxvbRWLcf ws/Q== 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 i35si1489566uad.205.2021.05.17.22.37.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:37:40 -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]:36774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisQG-00076D-7E for patch@linaro.org; Tue, 18 May 2021 01:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKT-0006jq-Fg for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:41 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:44839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKR-0006uG-Dl for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:41 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MYvHa-1lw1U11kBM-00UtMf; Tue, 18 May 2021 07:31:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 10/59] linux-user: Pass CPUArchState to do_sigaltstack Date: Tue, 18 May 2021 07:30:42 +0200 Message-Id: <20210518053131.87212-11-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:Jw/oUiKDbNugkvf4iJbUazGAX2NzpEhAkTWc54ZKkoceoDH+qg4 olZj7g53VYt6JD8eLQWsGDREJ9PA7YChgadWBavteBUWjLaCbcmzWGKGWgwix/yrJbQ+kR8 NsuyFhJvmwVTlZEWOu5Clir61SrukYU1RaRH2Gzec8f2kWCrWfuDToTvq2eutWLIYAsQqpi 3e07wrvVHkxD+N9oOZfvQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:If9dX0RJ5mc=:Xdz3KYrHF7kP5L+IOxcMLC Pb0/zp+EzYp4t6rzHsJazEiFXf8nLDzvW6gtAeOB1i4N7GVz85cpqDIZmUzI6V5OywtE/kCuq 6E3HtFYFjo32tKJhwHtWO2S0IUUZ0SGVCnJLez4AZkVcZBwAUn/xdi0r2PM6XAHgd0ZvGjxRg 5Tsj0TIRu8L0EIVwAhyOQVWQB8HIDJiIw95wVW6J4DukmHzIAMnuqbdZR7XY7FiZVR5bpRqXr TdQ5X+mND6RJo/89mzGrx9hHToUZMrwj7eMkzf5K7/4TPk/7pdjQOJuhGmrMogD0Q7wgUusdD MC8ghIU7JfBzoBy3rPwG11or7X99kjjwpylNg+2dw0c/YFrha048/oB1lNZazL+rzyq/Q2Ruk T3POjNNbNlNZySr40UH6+FFOe4ha/mCFvuYf5tBZ6Cqi086sdkeL9pcpkScPyftW4mWqlzczq ++2wmgefj9ROf0KtJW7r/vebaASc+DfK37dAozTXMuE+Yq+Y7VN6CmwMmCQkj1JB2q6q0i7Md 112FxYEHsYKBmxKP/OeVjo= 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, 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 Now that we have exactly one call, it's easy to pass in env instead of passing in the sp value. Use target_save_altstack, which required env. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/qemu.h | 3 ++- linux-user/signal.c | 11 ++++------- linux-user/syscall.c | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) -- 2.31.1 diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 74e06e7121c5..3b0b6b75fe8f 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -432,7 +432,8 @@ int target_to_host_signal(int sig); int host_to_target_signal(int sig); long do_sigreturn(CPUArchState *env); long do_rt_sigreturn(CPUArchState *env); -abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp); +abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, + CPUArchState *env); int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset); abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, abi_ulong unew_ctx, abi_long ctx_size); diff --git a/linux-user/signal.c b/linux-user/signal.c index 9daa89eac5db..2e1095055b7c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -800,21 +800,18 @@ static void host_signal_handler(int host_signum, siginfo_t *info, /* do_sigaltstack() returns target values and errnos. */ /* compare linux/kernel/signal.c:do_sigaltstack() */ -abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp) +abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, + CPUArchState *env) { target_stack_t oss, *uoss = NULL; abi_long ret = -TARGET_EFAULT; if (uoss_addr) { - TaskState *ts = (TaskState *)thread_cpu->opaque; - /* Verify writability now, but do not alter user memory yet. */ if (!lock_user_struct(VERIFY_WRITE, uoss, uoss_addr, 0)) { goto out; } - __put_user(ts->sigaltstack_used.ss_sp, &oss.ss_sp); - __put_user(ts->sigaltstack_used.ss_size, &oss.ss_size); - __put_user(sas_ss_flags(sp), &oss.ss_flags); + target_save_altstack(&oss, env); } if (uss_addr) { @@ -823,7 +820,7 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp) if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) { goto out; } - ret = target_restore_altstack(uss, sp); + ret = target_restore_altstack(uss, get_sp_from_cpustate(env)); if (ret) { goto out; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 95d79ddc437a..4d52b2cfe36d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11195,8 +11195,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return ret; } case TARGET_NR_sigaltstack: - return do_sigaltstack(arg1, arg2, - get_sp_from_cpustate((CPUArchState *)cpu_env)); + return do_sigaltstack(arg1, arg2, cpu_env); #ifdef CONFIG_SENDFILE #ifdef TARGET_NR_sendfile From patchwork Tue May 18 05:30:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441120 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1776486jac; Mon, 17 May 2021 22:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhcFNT9ZrHOWcL6JK3apYxVy6YpeXAb3arY4mjfD0/AJfhKc63JFrjLe8HDSTl9t8l0+W0 X-Received: by 2002:a67:fb94:: with SMTP id n20mr4912681vsr.11.1621316286463; Mon, 17 May 2021 22:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316286; cv=none; d=google.com; s=arc-20160816; b=r6KAv0htId87lCZ5H766ObLBd5SKxYotyjVj8TE/DNnORiBIdahBUJrxMAHBLuyWlx nKfd1PRos0XsoeackPjbMNbTefU56Fnjfjqs5lPVk3G0Lo+AlRhIdvFqaD35U27WkUXm NdpBAAnfEXUJhRAdn99c6ZoTFETlNy7EdME5ssWPGo6eGT5IPfEBCkpX4wy3mjG8DKV+ gZEA11BVSVapHz/et+seCp2IjERg3RHHvlUL2yber7zBD02zCZiXB1OUBUedHwnBtMk1 k7IcqgYVlPV5E992D+xV6BUm+/OGtcOLvWf0O72W5iKQBL8mMjUtp3hnrFHpjk5XAyjH GH9Q== 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=pjD9GeDa8UaqAnMFx0NE4NNxldE8HgDuAyrgOLsUNyU=; b=cL5t/AjHMfUR+aVlI0B2ZvNw2DU9dddrUeKzgN7AsrH732pVH19xH2n0jQdpcDPPoQ nrSu1pBCYVOpP2TcUbqMMyKTp85I4kXp4GcmeBFJFb+EwoXOpeJD7EFvubZHj1uGO9QW mYrTYeq0+I52WnZYzlt/xy+2RoQhYeccUwJbAipQpopUilMnP/rynaEvMn8nIY5/YJ7w zl2ASUWdvgXmtTbf4Ol4niwp20yIydQQT7wT2z5ktl5q4ZWD2/yKEwoeDTXpjByKNaZD g5AObZJbSDoaEyxta36agYnOr6HSnbR1GnaVI5h0MZBq8lIon+cLz/iUSusjn8krxpny xEsA== 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 p4si2056455vsj.424.2021.05.17.22.38.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:38:06 -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]:37038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisQf-0007Gj-PX for patch@linaro.org; Tue, 18 May 2021 01:38:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKU-0006pj-UI for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:42 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:48659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKS-0006uh-0c for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:42 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5W0q-1lOcjr3epO-016yGp; Tue, 18 May 2021 07:31:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 11/59] linux-user: Pass CPUArchState to target_restore_altstack Date: Tue, 18 May 2021 07:30:43 +0200 Message-Id: <20210518053131.87212-12-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:paTfZ3iBZq58bYEomJI9ql453V7ZpPsTY39F2bg9JPy157o0ywI 7D1OzbJ7bB2kbpz5UYrVIW0VAbdi71Au5aaXR3amSVt6TXQEkHjdGcRkn1qIxSkGuaCBEKE Id3oP3/krsD89aJf/98s757svtHSDiif5axOMGbNixyT2jOC8f2T7d353Fg4W+0Ta3IrG99 5Lus7COb0+t6UIgg3X+Lw== X-UI-Out-Filterresults: notjunk:1; V03:K0:Z263EZEcSFE=:BRf+2tyANL4s4v3v0O3OY4 /z1ZW4e/xu+p1Kf82DacsEhxh+crD0mewE8DQBZ3XKjesfFxu4jEjdp1oTmoFAsc3BMOrxut6 MPU6TfDYNTPecoLrcj/jm2kodXqkb3R7YezQR21PIr1z8L9ak/rMxtmBTLrmSFQfNwK59nEuc 2ptNIwZyjTQwL8HuscRiRWmfrn4CrH1cDocgQfBObEjXMSuNx+unBPwXoneFOqS3TpfTujred rwCbnz/I3NJfCtdIqrp26ewC/7sM4vIcD4tkzjJIe5TJlmNr59EFDPz1rHf7hU5elodkptgGU r62xnMPtcg9lGi5nruG+sTcFJlrZkTqA1+21jvXS01vYbegnRlXOOlnGScnH8BKOgd4++hWU9 zz1DqSEnCJABC+LMk/oDCbVZ8Hu96rzkkw/I3/zME6zFv82erWk0ld1aLhgHBUbbvjKBOi8ef 4jZSCHI1aye4X1oymujIF65TN58wPMxIFaOXnPcRYb43cTzjDGP4iN1cb73CD7lZ3WTYg8/wh CZilp1G0Qgr/dY370+lPxU= Received-SPF: none client-ip=212.227.17.13; 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, 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 In most cases we were already passing get_sp_from_cpustate directly to the function. In other cases, we were passing a local variable which already contained the same value. In the rest of the cases, we were passing the stack pointer out of env directly. Reviewed by: Warner Losh Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/signal.c | 2 +- linux-user/alpha/signal.c | 2 +- linux-user/arm/signal.c | 4 ++-- linux-user/hexagon/signal.c | 2 +- linux-user/hppa/signal.c | 2 +- linux-user/i386/signal.c | 2 +- linux-user/m68k/signal.c | 2 +- linux-user/microblaze/signal.c | 2 +- linux-user/mips/signal.c | 2 +- linux-user/nios2/signal.c | 2 +- linux-user/openrisc/signal.c | 2 +- linux-user/ppc/signal.c | 2 +- linux-user/riscv/signal.c | 2 +- linux-user/s390x/signal.c | 2 +- linux-user/sh4/signal.c | 2 +- linux-user/signal-common.h | 2 +- linux-user/signal.c | 6 +++--- linux-user/xtensa/signal.c | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) -- 2.31.1 diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 2a1b7dbcdc2b..662bcd1c4e57 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -561,7 +561,7 @@ long do_rt_sigreturn(CPUARMState *env) goto badframe; } - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 0af022711815..d4e4666874e3 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -257,7 +257,7 @@ long do_rt_sigreturn(CPUAlphaState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - target_restore_altstack(&frame->uc.tuc_stack, env->ir[IR_SP]); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index b7a772302f45..32b68ee302ba 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -685,7 +685,7 @@ static int do_sigframe_return_v2(CPUARMState *env, } } - target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&uc->tuc_stack, env); #if 0 /* Send SIGTRAP if we're single-stepping */ @@ -769,7 +769,7 @@ static long do_rt_sigreturn_v1(CPUARMState *env) goto badframe; } - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); #if 0 /* Send SIGTRAP if we're single-stepping */ diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 3854eb4709be..85eab5e94382 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -260,7 +260,7 @@ long do_rt_sigreturn(CPUHexagonState *env) } restore_ucontext(env, &frame->uc); - target_restore_altstack(&frame->uc.uc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 578874cf27e6..0e266f472d5a 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -187,7 +187,7 @@ long do_rt_sigreturn(CPUArchState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - target_restore_altstack(&frame->uc.tuc_stack, env->gr[30]); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 3a0a1546a63e..8701774e3791 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -581,7 +581,7 @@ long do_rt_sigreturn(CPUX86State *env) goto badframe; } - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index 004b59fb6118..d06230655e98 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -400,7 +400,7 @@ long do_rt_sigreturn(CPUM68KState *env) if (target_rt_restore_ucontext(env, &frame->uc)) goto badframe; - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index f59a1faf47bb..4c483bd8c606 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -209,7 +209,7 @@ long do_rt_sigreturn(CPUMBState *env) restore_sigcontext(&frame->uc.tuc_mcontext, env); - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 456fa64f41cd..e6be807a81ae 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -368,7 +368,7 @@ long do_rt_sigreturn(CPUMIPSState *env) set_sigmask(&blocked); restore_sigcontext(env, &frame->rs_uc.tuc_mcontext); - target_restore_altstack(&frame->rs_uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->rs_uc.tuc_stack, env); env->active_tc.PC = env->CP0_EPC; mips_set_hflags_isa_mode_from_pc(env); diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index 751ea88811f8..cc3872f11da2 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -128,7 +128,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc, __get_user(env->regs[R_RA], &gregs[23]); __get_user(env->regs[R_SP], &gregs[28]); - target_restore_altstack(&uc->tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&uc->tuc_stack, env); *pr2 = env->regs[2]; return 0; diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index 86f94d7f766d..5c5640a28487 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -158,7 +158,7 @@ long do_rt_sigreturn(CPUOpenRISCState *env) set_sigmask(&set); restore_sigcontext(env, &frame->uc.tuc_mcontext); - target_restore_altstack(&frame->uc.tuc_stack, frame_addr); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return cpu_get_gpr(env, 11); diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index b44d5ce73c31..edfad28a375a 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -655,7 +655,7 @@ long do_rt_sigreturn(CPUPPCState *env) if (do_setcontext(&rt_sf->uc, env, 1)) goto sigsegv; - target_restore_altstack(&rt_sf->uc.tuc_stack, env->gpr[1]); + target_restore_altstack(&rt_sf->uc.tuc_stack, env); unlock_user_struct(rt_sf, rt_sf_addr, 1); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index 81d1129da3d2..9405c7fd9af6 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -192,7 +192,7 @@ long do_rt_sigreturn(CPURISCVState *env) } restore_ucontext(env, &frame->uc); - target_restore_altstack(&frame->uc.uc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 73806f547270..b68b44ae7e99 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -307,7 +307,7 @@ long do_rt_sigreturn(CPUS390XState *env) goto badframe; } - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index 684f18da5862..0451e65806a1 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -323,7 +323,7 @@ long do_rt_sigreturn(CPUSH4State *regs) set_sigmask(&blocked); restore_sigcontext(regs, &frame->uc.tuc_mcontext); - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(regs)); + target_restore_altstack(&frame->uc.tuc_stack, regs); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 34b963af9abc..ea86328b289a 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -24,7 +24,7 @@ int on_sig_stack(unsigned long sp); int sas_ss_flags(unsigned long sp); abi_ulong target_sigsp(abi_ulong sp, struct target_sigaction *ka); void target_save_altstack(target_stack_t *uss, CPUArchState *env); -abi_long target_restore_altstack(target_stack_t *uss, abi_ulong sp); +abi_long target_restore_altstack(target_stack_t *uss, CPUArchState *env); static inline void target_sigemptyset(target_sigset_t *set) { diff --git a/linux-user/signal.c b/linux-user/signal.c index 2e1095055b7c..cbd80b28cf5a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -297,7 +297,7 @@ void target_save_altstack(target_stack_t *uss, CPUArchState *env) __put_user(ts->sigaltstack_used.ss_size, &uss->ss_size); } -abi_long target_restore_altstack(target_stack_t *uss, abi_ulong sp) +abi_long target_restore_altstack(target_stack_t *uss, CPUArchState *env) { TaskState *ts = (TaskState *)thread_cpu->opaque; size_t minstacksize = TARGET_MINSIGSTKSZ; @@ -315,7 +315,7 @@ abi_long target_restore_altstack(target_stack_t *uss, abi_ulong sp) __get_user(ss.ss_size, &uss->ss_size); __get_user(ss.ss_flags, &uss->ss_flags); - if (on_sig_stack(sp)) { + if (on_sig_stack(get_sp_from_cpustate(env))) { return -TARGET_EPERM; } @@ -820,7 +820,7 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) { goto out; } - ret = target_restore_altstack(uss, get_sp_from_cpustate(env)); + ret = target_restore_altstack(uss, env); if (ret) { goto out; } diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 22ec6cdeb98e..72771e1294b6 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -253,7 +253,7 @@ long do_rt_sigreturn(CPUXtensaState *env) set_sigmask(&set); restore_sigcontext(env, frame); - target_restore_altstack(&frame->uc.tuc_stack, get_sp_from_cpustate(env)); + target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; 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 From patchwork Tue May 18 05:30:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441124 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1779124jac; Mon, 17 May 2021 22:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz//B7aK0Pb7WqB+TBRvUheQl0nQ7pg2xvsqP1obVeXGKETpVHuQMZg945rnHEh9Ey6M76o X-Received: by 2002:a67:fdd9:: with SMTP id l25mr4692433vsq.10.1621316555110; Mon, 17 May 2021 22:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316555; cv=none; d=google.com; s=arc-20160816; b=ldvTFMbr0yQ8e38sXsyKVFk9KuLyCgPgQAmaZyAl0C+YGM4fBk6jkN4GSYG0d04NeR d8WzyBN7v8zNI0Nbj1AQjTGJ4RAawdIQgBjlTMcLU0uP6kcuk/HWECMacDMP4fGBVDXJ C0yPm0werhr+mLcHeWhiFJ3knPo/Pd0FpENSwTo2vbfvSlGUjqrp693myVQB/j7mMTDm rtOwTHOQS47bSewlBxmiOCEvrHDsteRx6PtA7/u2kYvdb/XXKTMefwcIT6Uit2QL7EE2 zc5jGrzvqfBA5Fmk2wMhlko1CNVE/JTifMgutYmd1P+3iquarfqcqPDd2oFzO04lnPnZ nB5A== 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=bCwwniDfTG1rZnrmEjNm3NAale83yCCFDAqoQ9sm3I0=; b=WvyJxpaQ8mRgLUPMUV65MBIrYb8PZrQZbZheCs5Jdey5Txxw5yF4kMNE+zzgcR3fHY VcfzQPMZlaaNN7eOQw2XYGiUTJMmaHqEj/ZU7SOBTSt8Cfr5nNHprct8jMt8yM3yVuMm s5CCpK0QOWd+7/bhqc/kUZmWwvDnwNHE6ic8tjA/huyrDUB8KxRPLYM7SM49785Beaio Su1/B/1YLT6Tw9XGLNwK+3w7E/yKNIoNAbycB1sTA/EYna8A57GevSAsOJlKrsXtaKG6 mO30X000q9at6fn9tGYOkgfQ0aI1FwS3SpUlG2x6wgYswuJ6kHcgi5o1R5Nsnp8pYrg7 cxrg== 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 s17si3290998vsn.32.2021.05.17.22.42.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:42:35 -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]:45342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisV0-0004Pv-FQ for patch@linaro.org; Tue, 18 May 2021 01:42:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKV-0006u6-VJ for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:43 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:49477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKS-0006v4-Qi for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:43 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MwxRN-1lX7453OZP-00yTwY; Tue, 18 May 2021 07:31:39 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 13/59] linux-user/sparc: Clean up init_thread Date: Tue, 18 May 2021 07:30:45 +0200 Message-Id: <20210518053131.87212-14-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:A+V8BPEdLq7Ux9hJEFv4mAbW7gmXjpjxN8GRKXhvyvRIViu2WdG vwG4nIf8En+t2iG+i5lmLcG6PGlKKJkBGEnal0RdW7C+xoEaS8lS8y/HkGN5jGzYrQeqMOw eNjKmtQ83AsAWdXjKewTsaVgW7tZu33Q9qRqkOY7WgGeWc/CBr+bnPZbfDvlRyGsVmdN9MM vgPZ159LNgU4ufONy2y7Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:MwvuRD7FbiQ=:y5ymzWnrZHdCjyyQd0/QxQ Gn43F+GKJ2tIG6wD6m1Wou50YbQHtYZkRnnIhBpzXkeQoWdP8unsuUK7UMbdIjRwb3xPFnKly teGXfGbf37nYWsxBAd2HRbVT5V2ilC/1IY5e5FlGAC1w8dckC3EGHLPF7L4Adv+2prqNgmbAx 2S77oubj+Vy2dxwhx2V8TO1woMJyI/SGAw61GgqQPOrfGJYYvkSfytuMNgyGbc3gYu+wUuxgW 8R5vLSJZWlNzlUTYrN0Hf49vAkeyhcm9o25V28C515n2CiZw/TmtyoOmZaMMrsALaCffz2rrD pYqsREXuDnikL99OAk41mhXMlsNxJPO3sXG9PQa1buo9q/Sbdm5y5M0Tr7tXire0G3NRDSzX9 k5e85omxL46qjh83hfMSva3CXsHT4IquG+Ejq5fio6fyeKu573YObmy/IcSsDG3SdtaSjylsf qsovBZ2D3AZq74nXy/zuaVvHDaFVWRjHeIT3TngsZ/CrnDHoqQpQdvF0wXBx+6herUkAgXrGy cUNfdX4mFBud9J2nWleQSI= Received-SPF: none client-ip=217.72.192.75; 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 Share code between sparc32 and sparc64, removing a bit of pointless difference wrt psr/tstate. Use sizeof(abi_ulong) for allocating initial register window. Use TARGET_STACK_BIAS. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) -- 2.31.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index fc9c4f12be92..ffc03d72f935 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -676,48 +676,25 @@ static uint32_t get_elf_hwcap2(void) #define ELF_CLASS ELFCLASS64 #define ELF_ARCH EM_SPARCV9 - -#define STACK_BIAS 2047 - -static inline void init_thread(struct target_pt_regs *regs, - struct image_info *infop) -{ -#ifndef TARGET_ABI32 - regs->tstate = 0; -#endif - regs->pc = infop->entry; - regs->npc = regs->pc + 4; - regs->y = 0; -#ifdef TARGET_ABI32 - regs->u_regs[14] = infop->start_stack - 16 * 4; -#else - if (personality(infop->personality) == PER_LINUX32) - regs->u_regs[14] = infop->start_stack - 16 * 4; - else - regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; -#endif -} - #else #define ELF_START_MMAP 0x80000000 #define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \ | HWCAP_SPARC_MULDIV) - #define ELF_CLASS ELFCLASS32 #define ELF_ARCH EM_SPARC +#endif /* TARGET_SPARC64 */ static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { - regs->psr = 0; + /* Note that target_cpu_copy_regs does not read psr/tstate. */ regs->pc = infop->entry; regs->npc = regs->pc + 4; regs->y = 0; - regs->u_regs[14] = infop->start_stack - 16 * 4; + regs->u_regs[14] = (infop->start_stack - 16 * sizeof(abi_ulong) + - TARGET_STACK_BIAS); } - -#endif -#endif +#endif /* TARGET_SPARC */ #ifdef TARGET_PPC From patchwork Tue May 18 05:30: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: 441113 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1774404jac; Mon, 17 May 2021 22:34:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb1Xa6e+GrZebzNr2Ji6Ir19QIJY+Pvb5/Us7qcglHBvVaQowzibvpDHDmpU45ZhH5DuEL X-Received: by 2002:a67:5dc4:: with SMTP id r187mr443898vsb.7.1621316081063; Mon, 17 May 2021 22:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316081; cv=none; d=google.com; s=arc-20160816; b=ZqlsSqCi5WlPH7OrU+htWm7omEQeNBEchu5hnCL85xr0RuQTwWnnoGGIpPSS2ELnqi sxASsQevUDkklV/CVspRqN2qpUPshB9OCInmd1y77p4L6Mht+zH4WKdiALRJoAb9Ov4x T4HhiZG6o41tp6wDLctVaPFnKlLS5iWbnVtbK88v1Rk3fDb3pHt4kTep6UwQgXkqfp/O 6YWYIGIfTHT390BZe9oBnxZaspSL/ioAMbbnmnQIofARcfeLlf5klfAjyoBMxTiBJMgW iOlm3zWZGrQ8yVVTJwhc96a0BZbvcxM9tMbVdpiaIWQXPalA6Pf9FChqCMlBRFC87mML zM3Q== 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=lUpMGKO8CkYSHYgN2OoUn+D46OvBXXnaP6fght3wCgk=; b=itCqTIjzrJlcEeES592Zmex9MsoWWfKpcSB5JCvozaZcdY5UkTDhlAPDhC6GnUIQLB EqlF5/z8+7fVKf6yEdf1Ws+QQK2rmIomIySSYMehpo+1jpSRSnE4HimBUfp799XKJCfP wRhlwA/eIa2PT3sGtJ7Y2xWQyTe73ge/impFGnZVMcnz9H+4ffdwC0G0RATbyV8tbrzl rSYvW1a1wX3YCuhcIJe8xy4AeOP9tnkJvKrtIojukBUbYK0TDH5HY5XJFugeAl5pNBKh 8Q9jzaiKS4IOt9uIC74kjrELKXBRIyyuhEY+oLr4jfDrBjWCRpsrNgNIl+bQcjWb4FFT ISmA== 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 e3si5519394vsj.418.2021.05.17.22.34.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:34:41 -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]:48172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisNM-0004J1-Ew for patch@linaro.org; Tue, 18 May 2021 01:34:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKX-00070j-Dw for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:45 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:49463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKT-0006wT-QU for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:45 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mg6qO-1lGxl710Aw-00hdsl; Tue, 18 May 2021 07:31:39 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 14/59] linux-user/sparc: Merge sparc64 target_syscall.h Date: Tue, 18 May 2021 07:30:46 +0200 Message-Id: <20210518053131.87212-15-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:zP0eWViHxxDL9FfgmA6x+3t6FcO1YueMs/xzTNXd9Vai0futfoA D0iEp65oAkJurH/le9OQckNuCW/V+jo7i0UuM5KIvEBPkx6lDBJlN1na4NHMtX7AjNX5frp vSSM7aLelUN4hJfsVniJg48rcyGvP5WIIJog/QlQzhhWlt1xULMkAvOwjIItpQCRIIGnQP+ 7bXwOKu1MubGgGUuWIK+A== X-UI-Out-Filterresults: notjunk:1; V03:K0:rCrVIjbhFDk=:etvdoAc6TsiaSvyfR3DWK6 WeRV+AX8w7gyxOiSESRzbUco7TGImALfqvTXnmKOpZCQb1lGO+fdTczTiQ0vrYBxaDUqaYnkd MVI7Plv/DztQ0CSrAdyUcMYP0/OpNAYK7rJzvcibsYEvVAlcGhb++IwaC5pzJtIFVvcEctKqQ YqHNEDgffGejxVRKiA6I+Z8EQkEqWXp9JZsrRu/VvUngzeES1LKQVsbuliPeokM8Qg3F066fY zvfhOztsfNzOjKpbVym2ZsXIHCAm5h71tr7HzT4sY0OKrenq/4jHByrarIwZnLsMqPouLWhmB Ka3lTE6tNKTbjprue8MmIlj82gt+TeZG9ytjPWYLihbMcRRV3t+XXbDQr2T/1VDzAgaCO8ko+ HaSK+vF64qQ3sHlllAp3VEDBFPkvExCVnHzY6lWqW7a42T5s1cdJnQdy2n+Gj2W7MSQ8nOjDk aUlMN2lXmcyghuluhoPa3z3LhUDzAlIDsO4vKzHdLz8z9pWYxGJWwSvgUxK6mVdAVgvJI507I RbPHAo6+UVVvV4IU3QptTo= Received-SPF: none client-ip=217.72.192.73; 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 There are only a few differences in sparc32 vs sparc64. This fixes target_shmlba for sparc32plus, which is v9. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/target_syscall.h | 42 +++++++++++++++++++++-------- linux-user/sparc64/target_syscall.h | 36 +------------------------ 2 files changed, 32 insertions(+), 46 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/target_syscall.h b/linux-user/sparc/target_syscall.h index d8ea04ea837a..15d531f38978 100644 --- a/linux-user/sparc/target_syscall.h +++ b/linux-user/sparc/target_syscall.h @@ -3,18 +3,34 @@ #include "target_errno.h" +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_pt_regs { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; + abi_ulong u_regs[16]; + abi_ulong tstate; + abi_ulong pc; + abi_ulong npc; + uint32_t y; + uint32_t magic; }; +#else +struct target_pt_regs { + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; +}; +#endif -#define UNAME_MACHINE "sparc" +#ifdef TARGET_SPARC64 +# define UNAME_MACHINE "sparc64" +#else +# define UNAME_MACHINE "sparc" +#endif #define UNAME_MINIMUM_RELEASE "2.6.32" -/* SPARC kernels don't define this in their Kconfig, but they have the +/* + * SPARC kernels don't define this in their Kconfig, but they have the * same ABI as if they did, implemented by sparc-specific code which fishes * directly in the u_regs() struct for half the parameters in sparc_do_fork() * and copy_thread(). @@ -25,20 +41,24 @@ struct target_pt_regs { #define TARGET_MCL_FUTURE 0x4000 #define TARGET_MCL_ONFAULT 0x8000 -/* For SPARC SHMLBA is determined at runtime in the kernel, and - * libc has to runtime-detect it using the hwcaps (see glibc - * sysdeps/unix/sysv/linux/sparc/getshmlba; we follow the same - * logic here, though we know we're not the sparc v9 64-bit case). +/* + * For SPARC SHMLBA is determined at runtime in the kernel, and + * libc has to runtime-detect it using the hwcaps. + * See glibc sysdeps/unix/sysv/linux/sparc/getshmlba. */ #define TARGET_FORCE_SHMLBA static inline abi_ulong target_shmlba(CPUSPARCState *env) { +#ifdef TARGET_SPARC64 + return MAX(TARGET_PAGE_SIZE, 16 * 1024); +#else if (!(env->def.features & CPU_FEATURE_FLUSH)) { return 64 * 1024; } else { return 256 * 1024; } +#endif } #endif /* SPARC_TARGET_SYSCALL_H */ diff --git a/linux-user/sparc64/target_syscall.h b/linux-user/sparc64/target_syscall.h index 696a68b1ed4e..164a5fc6322f 100644 --- a/linux-user/sparc64/target_syscall.h +++ b/linux-user/sparc64/target_syscall.h @@ -1,35 +1 @@ -#ifndef SPARC64_TARGET_SYSCALL_H -#define SPARC64_TARGET_SYSCALL_H - -#include "../sparc/target_errno.h" - -struct target_pt_regs { - abi_ulong u_regs[16]; - abi_ulong tstate; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong fprs; -}; - -#define UNAME_MACHINE "sparc64" -#define UNAME_MINIMUM_RELEASE "2.6.32" - -/* SPARC kernels don't define this in their Kconfig, but they have the - * same ABI as if they did, implemented by sparc-specific code which fishes - * directly in the u_regs() struct for half the parameters in sparc_do_fork() - * and copy_thread(). - */ -#define TARGET_CLONE_BACKWARDS -#define TARGET_MINSIGSTKSZ 4096 -#define TARGET_MCL_CURRENT 0x2000 -#define TARGET_MCL_FUTURE 0x4000 -#define TARGET_MCL_ONFAULT 0x8000 - -#define TARGET_FORCE_SHMLBA - -static inline abi_ulong target_shmlba(CPUSPARCState *env) -{ - return MAX(TARGET_PAGE_SIZE, 16 * 1024); -} -#endif /* SPARC64_TARGET_SYSCALL_H */ +#include "../sparc/target_syscall.h" From patchwork Tue May 18 05:30:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441127 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1781206jac; Mon, 17 May 2021 22:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0ACRl7azgluU3W7yXM84vMWWVpqb4k7tCaqYUz/SBuxZVhT7xiiVqmq1SAsMHDI26+q4q X-Received: by 2002:a67:e418:: with SMTP id d24mr4790572vsf.27.1621316752635; Mon, 17 May 2021 22:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316752; cv=none; d=google.com; s=arc-20160816; b=nur/mQv0ssCXfJCpW9CMX0BCdyxWLe8/wbmo+kNfH+x69wXBOARKkcUXEDF345AJel 3wK86Uom1TMjHJYfUv46RSzmGg21O1yCaWq5iAPc5uKiqWJQu42hAchczECzCL/HYlOS sN7ZzcBT3Fq/HS/1D3kPK1Vu1daSNllLnlCyxAzMIuYPHSUKgXhzFTCNJW4LmlWkGGNz YMTYAZwGJ788Ods6R4Jd97C2VgSjJ0QpmLrSIFAhlwHQlatWs1XCBKENNfPcPTLWzJP5 4DF8PWeULzrT4iNZq4ng3n6YQq28kLz8V0GDzwzWkDHTutb2DrRFTqdZ1po743BnwjjC 4g0w== 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=QrU0R4+MjaqHnZGG5ahAsDJLIlHibI0q6LOwclpupAc=; b=Lt1aGCdF0kPf4opNdVOEtPT3RTrS+f06+tJMGRAR/6b2s9Wt0Qoidyxvbn17OcyGAF UfmC9AmUSaK9K3renDdT80AFH60SeMMSrFTMBONh1drC8Ts9rBoslURK0MkGKSrB6giD LVr4hSc5TYlztWJY5N5d5k2CxdgXeLVg4FXiWaDW0bMUJ856QK3GEZhY2RbFS0FgcKzJ bQprf7lTqkhp4Ywo6Qu12q73SvFLB95St8xTY4OU05XK6w7xyGzNoSZLp621HRwlexJR ok2HiZvfa5Yoej28whkm9k0E5qA4jMTk8DZ97GENGtvy9Wqee+leWF+padDeoRg4dHwj R4kg== 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 q11si2351151ual.49.2021.05.17.22.45.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:45:52 -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]:54256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisYB-00027n-Us for patch@linaro.org; Tue, 18 May 2021 01:45:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKV-0006ry-EH for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:43 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:52141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKT-0006wL-LM for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:43 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mf0uq-1lFrIP2lj8-00gXQ3; Tue, 18 May 2021 07:31:39 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 15/59] linux-user/sparc: Merge sparc64 target_elf.h Date: Tue, 18 May 2021 07:30:47 +0200 Message-Id: <20210518053131.87212-16-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:y0WpMoUJkFAn86t3/w26k8dqCcS0w2IIlRaYSqas3ZFf14toAeT hsUKkRPNvLQz/g8OMOGCFj/xYvyNEUGuB4AVKlr07Vg5G6RJ9nWHW+ai3+7Z2R8yJ5z8Mpl jOKsjVvf+gfy83+zareN9fJ8yfaWoMdN2/rBeraYBBsKferkgmG7Jj5t8Jbo42zHboN54am ZerU72i9Wn+ZeOlUZuICQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:+U0wW7jjOX8=:gS5sWBGKltgVGM3AvYDO77 tRiE0ZAW4TNAN7MJ7EZLJmEFMfT12doGmryO7CqkmspoQfP4MYyNRdY5g+24w5e5wizVdkqPl utNCCBSZ7UoLtEIEm6yEio6mVyuQsRWg9+ECJYmlA1XBv1KaNs8Z4iGhkcix7xGPw5atulW2T Fji5VRRWWKYvs/mY+BnbvHGrQt+zgVgopRNsuc2dueIV6PLTtFHQPjb19JlaKHMpLOPglAme/ oeJiSvFAfjay1xcbJ6T5HBQRqhtR4TGWKhbIqvWPXs8uMwBpRqN/PIIs9YEntXJpx1Cr6Q2YE pmoZMCPQ3y/LzAtLzsZIoL0T85JhzNaIbkFm1zbJIsIRZexFva6KJqnoSYAsPLZOjp/2HMliQ dyi/EgwmLfqcfx2TMYVOI3N7Rg1fohHeRPKqROSBod6IT88sNHiq+6iVxPKf3CCs0iOYEjhPK ntwy+iwf4A86Cgoll3UBGzbCsdLM6Cp5uBlgnKwTYCH17WdKXSE1FVJebFgSEphZ5ZeKA3kN3 EICg/zpC6zqg68YfS1lA04= Received-SPF: none client-ip=212.227.17.24; 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, 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc64/target_elf.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc64/target_elf.h b/linux-user/sparc64/target_elf.h index d6e388f1cf60..023b49b74375 100644 --- a/linux-user/sparc64/target_elf.h +++ b/linux-user/sparc64/target_elf.h @@ -1,14 +1 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation, or (at your option) any - * later version. See the COPYING file in the top-level directory. - */ - -#ifndef SPARC64_TARGET_ELF_H -#define SPARC64_TARGET_ELF_H -static inline const char *cpu_get_model(uint32_t eflags) -{ - return "TI UltraSparc II"; -} -#endif +#include "../sparc/target_elf.h" From patchwork Tue May 18 05:30:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441111 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1773931jac; Mon, 17 May 2021 22:33:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ8RiUrgcOYIgm3GWSsMwwd55FRf8UlFGXn/hkPC1gkrp3V7cHQmykf5cOy32R3bxEn8CT X-Received: by 2002:ab0:4507:: with SMTP id r7mr2631611uar.28.1621316036858; Mon, 17 May 2021 22:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316036; cv=none; d=google.com; s=arc-20160816; b=w2k8fN+92huyEpDCews6Y//OyK3Fr7KTQ+9m3I6BgHU8brsKfIYvYhzeSPIVtoI6io KfQfADqkaL3O56/VBoFCegs7JhXvO3CWTVL+DzVQDAsGfuGkpGgIXSICUmCXEKxP0FzU 7aRy78PT3qqtwqiocEjOo0HeV+LE6CVv2Ftf1wB15AhpC/U0Mn32JSrUzw6ucc2MVMoa 5TVF+DYkb88EREcmEHnEykehrJDwovG1IOvj6YHd9eyOStLMuKp4OBOOkCO5VE/Tnl0v d0lwTKLoqsR5nTPB7lNyp+yR/jLpTbaxsL65vASm1XmXdjPt2Zmlt16FL0JONKfBSt36 JJnA== 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=yWWXTh1Hbxk+I3QUwRZEbg/TQnxDZILf8UepXp5Wz1c=; b=klnrqs3/Pr9FxE5p8Ja67OfiFHJaR7t504I8tCKBZRAhE6TBog4yXrrjfbZP9lu9eF 8cvQLytr9eGc9reTjwlqHySBYthmI5Nm3kdfSJ1hQv371eZbiQBLsHdhuBKdrSVKlinK 88jFK3lf0roY1XKwSft3upJDBihPO5GJP2EKBl1WkoEWyWyPksEhcO7sAn2smPF5E4+r hbxxyEbFMNJ6Kz+kVwZ9vktnpX3r5s1HaHtRQ1Vzw4rKaeqw7ABEYpO/FN8ybkdgx4pK TkV1FsE45hi4Rdld01soAY89jpZGvtUe+b/HsWMatatzCV038MBkUp5Xr1W3BlUbuFLz +T6g== 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 g13si9531290uaj.36.2021.05.17.22.33.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:33:56 -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]:47866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisMe-00047F-61 for patch@linaro.org; Tue, 18 May 2021 01:33:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKX-0006z1-3i for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:45 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:48465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKU-0006xr-9O 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 1MbBQU-1lC1Y40VGi-00bZLN; Tue, 18 May 2021 07:31:40 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 16/59] linux-user/sparc: Merge sparc64 target_structs.h Date: Tue, 18 May 2021 07:30:48 +0200 Message-Id: <20210518053131.87212-17-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:1/5e4r+zAZ+ZyPgD8jXSNjawGo4MFUClDNKmTbWeJtWfxREdX5J FwvI5FfodzP3FeRcOyBx1VGwbj1PD16t3hCEkt4t38OGZjZs75bO7/psqNo/yUzaie7D0dR KBi4n+IHjFBKBeFG51PSfwK1bVscj/JlGejX25GYRxU12GiSE2/BDNiBGH0+UFfos8OOycv 1g218OuBorcXsWUfRA3JA== X-UI-Out-Filterresults: notjunk:1; V03:K0:kIuN/lYzzcA=:jolnatv8X+N+Hek47Q/tuA bftBktlR13BMT3LrQqY0Mb8A2D+SbRlnpnP9pl62hB/ec65tsuuJTGHCmclxjE8CXNVIZMWxy lOEGgS+bTkHhDEh9QXq4dmQiOAuAHf8Y5fmARlRkUcvCCswHhvP38ponUTJBxuCqEmHjHjiQI wGHDYlFN24ONP2ZlcqgDf7xvuLuJD7wwMx0iCaf4n/UjGVxVVHOodz3zUumAWPPUPuDNy0B/i IY85ElRkJ4ZReBWMgKkU9loN8l85X7ZtuhPFLdff5B0rCU8LoXO+oFYlgmxHyYYU8pnnC3M54 N771VGM19H4kwCRIEIF00zv9yGxRHZQg7tcEdeobIIqBxrmHEjuIf3CNZymM2SRUXN42WoeZB 59oIu/pvKZlMpsQ5zonLtMfgLO8FkAQmDYKE1S4ScjuC6jPq3oHTlMycgAuTsGzWT8GHAQJEh NdE9uxPtZkvA3UqCF1nYUfUOuXhFh+rdUmjpMNEh9SDpE8hAChBenjbcehl3l14fRZ3GZ4rqZ lZzpwbQBKP3sY5finH2phA= Received-SPF: none client-ip=217.72.192.73; 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/target_structs.h | 34 +++++++---------- linux-user/sparc64/target_structs.h | 59 +---------------------------- 2 files changed, 14 insertions(+), 79 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/target_structs.h b/linux-user/sparc/target_structs.h index 995354075950..beeace8fb237 100644 --- a/linux-user/sparc/target_structs.h +++ b/linux-user/sparc/target_structs.h @@ -26,13 +26,10 @@ struct target_ipc_perm { abi_uint cuid; /* Creator's user ID. */ abi_uint cgid; /* Creator's group ID. */ #if TARGET_ABI_BITS == 32 - abi_ushort __pad1; + abi_ushort __pad0; +#endif abi_ushort mode; /* Read/write permission. */ - abi_ushort __pad2; -#else - abi_ushort mode; abi_ushort __pad1; -#endif abi_ushort __seq; /* Sequence number. */ uint64_t __unused1; uint64_t __unused2; @@ -40,22 +37,17 @@ struct target_ipc_perm { struct target_shmid_ds { struct target_ipc_perm shm_perm; /* operation permission struct */ -#if TARGET_ABI_BITS == 32 - abi_uint __pad1; -#endif - abi_ulong shm_atime; /* time of last shmat() */ -#if TARGET_ABI_BITS == 32 - abi_uint __pad2; -#endif - abi_ulong shm_dtime; /* time of last shmdt() */ -#if TARGET_ABI_BITS == 32 - abi_uint __pad3; -#endif - abi_ulong shm_ctime; /* time of last change by shmctl() */ - abi_long shm_segsz; /* size of segment in bytes */ - abi_ulong shm_cpid; /* pid of creator */ - abi_ulong shm_lpid; /* pid of last shmop */ - abi_long shm_nattch; /* number of current attaches */ + /* + * Note that sparc32 splits these into hi/lo parts. + * For simplicity in qemu, always use a 64-bit type. + */ + int64_t shm_atime; /* last attach time */ + int64_t shm_dtime; /* last detach time */ + int64_t shm_ctime; /* last change time */ + abi_ulong shm_segsz; /* size of segment in bytes */ + abi_int shm_cpid; /* pid of creator */ + abi_int shm_lpid; /* pid of last shmop */ + abi_ulong shm_nattch; /* number of current attaches */ abi_ulong __unused1; abi_ulong __unused2; }; diff --git a/linux-user/sparc64/target_structs.h b/linux-user/sparc64/target_structs.h index 4a8ed48df742..cbcbc4602a69 100644 --- a/linux-user/sparc64/target_structs.h +++ b/linux-user/sparc64/target_structs.h @@ -1,58 +1 @@ -/* - * SPARC64 specific structures for linux-user - * - * Copyright (c) 2013 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ -#ifndef SPARC64_TARGET_STRUCTS_H -#define SPARC64_TARGET_STRUCTS_H - -struct target_ipc_perm { - abi_int __key; /* Key. */ - abi_uint uid; /* Owner's user ID. */ - abi_uint gid; /* Owner's group ID. */ - abi_uint cuid; /* Creator's user ID. */ - abi_uint cgid; /* Creator's group ID. */ - abi_ushort mode; /* Read/write permission. */ - abi_ushort __pad1; - abi_ushort __seq; /* Sequence number. */ - abi_ushort __pad2; - abi_ulong __unused1; - abi_ulong __unused2; -}; - -struct target_shmid_ds { - struct target_ipc_perm shm_perm; /* operation permission struct */ - abi_long shm_segsz; /* size of segment in bytes */ - abi_ulong shm_atime; /* time of last shmat() */ -#if TARGET_ABI_BITS == 32 - abi_ulong __unused1; -#endif - abi_ulong shm_dtime; /* time of last shmdt() */ -#if TARGET_ABI_BITS == 32 - abi_ulong __unused2; -#endif - abi_ulong shm_ctime; /* time of last change by shmctl() */ -#if TARGET_ABI_BITS == 32 - abi_ulong __unused3; -#endif - abi_int shm_cpid; /* pid of creator */ - abi_int shm_lpid; /* pid of last shmop */ - abi_ulong shm_nattch; /* number of current attaches */ - abi_ulong __unused4; - abi_ulong __unused5; -}; - -#endif +#include "../sparc/target_structs.h" From patchwork Tue May 18 05:30:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441117 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1775470jac; Mon, 17 May 2021 22:36:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRX/2om97beo1e1+V9JFszCkHbzRhLA2/vgBtArdTdwpoq/xtw5UIPa/aYXN8FHPoHiHXC X-Received: by 2002:ab0:3b06:: with SMTP id n6mr4634978uaw.6.1621316191415; Mon, 17 May 2021 22:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316191; cv=none; d=google.com; s=arc-20160816; b=ClcsGojgIpsF0nLkfcDCzWvoH9wpEX/v2oHTUQXmq5jdDAz1OG3+okvfdvdH2HtxIW ek1Lp2qBfi6hIv/EEzxtv/awIeDMphdXK526c4WrOlznW729T6ER79Otuvi7R8npSRqO 6Dw4DuUsPz414oX0+W9NW8xTwSaZIqJOddC2Rql9qVfZhOOaWgIEfZ22MitAhZmof+fo ce2ZQb3hCLzvW2QwsSALSxlJ996vIRgAridLtuijwvk/M3Bm1nriiYY9L+O3jYPSA/f+ NcDLnZZncNMAb0lXmfPB+/MqEAI4ZR7GyHJT6VE0atyIp+HbgjEOz4axGUJLFJQlizrx ADmA== 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=XqXZdoRvTQUvVpQHQda9mWJNRXyQRJ3RgwVX2zjfWIc=; b=uwzkWMlK7KoWWJE++z8IpSZAq0VXENap6iEf5Vh4bAcaR833BYGvfgLxHUu6MS7W2Q /aU6eGLNwgIZQmitXD22ptS8HsGibbKCoG0RneEQUVc/lPhtTfWM62sHLQTiMwKjHRxx nQyEacM40UWrw6uP/Su3a9+4ZL74BD5ML5ulnWoNHuccPcB0MKb2f0ErhkERGf4jgFDe wrC+Ochis6R4PPgkBr+cN1VYeR71xfFzfM4nQArJz1O6E+FALhN0QZm0gGijgwMsdQmP R3GvI33/ywoOk6T0sSX7PaW4dJ8FOIDe4QT60FwAHfkytxc/kx8kSQlxIQY5Y+ooSimQ Mysw== 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 q3si1805526vsj.174.2021.05.17.22.36.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:36: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]:56694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisP8-0001aN-OF for patch@linaro.org; Tue, 18 May 2021 01:36:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKY-00073q-Dw for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:46 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:43135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKU-0006zI-Uy for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:46 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M8xsm-1lnoXS2b6U-0067Cx; Tue, 18 May 2021 07:31:40 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 17/59] linux-user/sparc: Merge sparc64 termbits.h Date: Tue, 18 May 2021 07:30:49 +0200 Message-Id: <20210518053131.87212-18-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:TnsCHLvYzMpIlf030xEDAhbVuqdOVh8mgB6EjZoKgKjo+3KNj1M mcdfL2bdllmMNNqfUJyN2xLxAbE9DVg3Xe73B3zKCQLH2nRUZIUQELLXUO//9PAyzOscCjp 8fzlmfalw/sz1tW+kOnSm52JQt3eZHI8SplyQOyd11Fup3+x4YpMpW+IlOW04zvj4SgF1UK 4y7GIQhGqlvkMzzPySjRQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:TfXNc3Th2YU=:45mZDDLnqlAofL9GBDPDsv V7mYvXzy9+zyYCS1rBkDL+JoHLcebuYNG7wgI0L9iauS5kXUQUWoOq/WJnNngzfxtqFjVPZdm PO/uuqHzcMX66BfKhSAen34+jm0W9h+QYaUYiEcv8dnVAFJQJUes5h0KXg2QVARt0ItnaMl1K HaYZkyr5fbLwi88jRwMENjD3h/u92VBCGiTrkKJYDAeROQP0Xya2UarIlr6t3W5yOerN4L/o/ HMJYIx2mngcDenXcCuIVKxi5+Em8WcdBNVFT79L159ZeRWSPnkLd2jNDaE6UnOwxNLaGbOjpv lOAnmwXJdCabyNXRPxMjsWat/5X4+jA4MUaajtcOsAd5b54X6l/Lo0/NCQ3blq7MSWZCVK6Z6 +zYo344xTVn0Gb70rsRi5e4akxjVP69wSlPOpOfgceM472Pne58boTPQXVfP3WgQK0HTOKss/ CWfSLlHujRpcZGm6SD40bKfWqY6Xp/FUzW2GFtW2zu/l70b/gIefWJIvi8zpSdUBEWovdpb4v zJE7cdTWeQablPmHoTxCBQ= Received-SPF: none client-ip=212.227.17.24; 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, 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc64/termbits.h | 292 +--------------------------------- 1 file changed, 1 insertion(+), 291 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h index 1ab1e80db548..54ddfee3ba34 100644 --- a/linux-user/sparc64/termbits.h +++ b/linux-user/sparc64/termbits.h @@ -1,291 +1 @@ -/* from asm/termbits.h */ - -#ifndef LINUX_USER_SPARC64_TERMBITS_H -#define LINUX_USER_SPARC64_TERMBITS_H - -#define TARGET_NCCS 19 - -typedef unsigned char target_cc_t; /* cc_t */ -typedef unsigned int target_speed_t; /* speed_t */ -typedef unsigned int target_tcflag_t; /* tcflag_t */ - -struct target_termios { - target_tcflag_t c_iflag; /* input mode flags */ - target_tcflag_t c_oflag; /* output mode flags */ - target_tcflag_t c_cflag; /* control mode flags */ - target_tcflag_t c_lflag; /* local mode flags */ - target_cc_t c_line; /* line discipline */ - target_cc_t c_cc[TARGET_NCCS]; /* control characters */ -}; - - -/* c_cc characters */ -#define TARGET_VINTR 0 -#define TARGET_VQUIT 1 -#define TARGET_VERASE 2 -#define TARGET_VKILL 3 -#define TARGET_VEOF 4 -#define TARGET_VEOL 5 -#define TARGET_VEOL2 6 -#define TARGET_VSWTC 7 -#define TARGET_VSTART 8 -#define TARGET_VSTOP 9 - -#define TARGET_VSUSP 10 -#define TARGET_VDSUSP 11 /* SunOS POSIX nicety I do believe... */ -#define TARGET_VREPRINT 12 -#define TARGET_VDISCARD 13 -#define TARGET_VWERASE 14 -#define TARGET_VLNEXT 15 - -/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is - * shared with eof/eol - */ -#define TARGET_VMIN TARGET_VEOF -#define TARGET_VTIME TARGET_VEOL - -/* c_iflag bits */ -#define TARGET_IGNBRK 0x00000001 -#define TARGET_BRKINT 0x00000002 -#define TARGET_IGNPAR 0x00000004 -#define TARGET_PARMRK 0x00000008 -#define TARGET_INPCK 0x00000010 -#define TARGET_ISTRIP 0x00000020 -#define TARGET_INLCR 0x00000040 -#define TARGET_IGNCR 0x00000080 -#define TARGET_ICRNL 0x00000100 -#define TARGET_IUCLC 0x00000200 -#define TARGET_IXON 0x00000400 -#define TARGET_IXANY 0x00000800 -#define TARGET_IXOFF 0x00001000 -#define TARGET_IMAXBEL 0x00002000 -#define TARGET_IUTF8 0x00004000 - -/* c_oflag bits */ -#define TARGET_OPOST 0x00000001 -#define TARGET_OLCUC 0x00000002 -#define TARGET_ONLCR 0x00000004 -#define TARGET_OCRNL 0x00000008 -#define TARGET_ONOCR 0x00000010 -#define TARGET_ONLRET 0x00000020 -#define TARGET_OFILL 0x00000040 -#define TARGET_OFDEL 0x00000080 -#define TARGET_NLDLY 0x00000100 -#define TARGET_NL0 0x00000000 -#define TARGET_NL1 0x00000100 -#define TARGET_CRDLY 0x00000600 -#define TARGET_CR0 0x00000000 -#define TARGET_CR1 0x00000200 -#define TARGET_CR2 0x00000400 -#define TARGET_CR3 0x00000600 -#define TARGET_TABDLY 0x00001800 -#define TARGET_TAB0 0x00000000 -#define TARGET_TAB1 0x00000800 -#define TARGET_TAB2 0x00001000 -#define TARGET_TAB3 0x00001800 -#define TARGET_XTABS 0x00001800 -#define TARGET_BSDLY 0x00002000 -#define TARGET_BS0 0x00000000 -#define TARGET_BS1 0x00002000 -#define TARGET_VTDLY 0x00004000 -#define TARGET_VT0 0x00000000 -#define TARGET_VT1 0x00004000 -#define TARGET_FFDLY 0x00008000 -#define TARGET_FF0 0x00000000 -#define TARGET_FF1 0x00008000 -#define TARGET_PAGEOUT 0x00010000 /* SUNOS specific */ -#define TARGET_WRAP 0x00020000 /* SUNOS specific */ - -/* c_cflag bit meaning */ -#define TARGET_CBAUD 0x0000100f -#define TARGET_B0 0x00000000 /* hang up */ -#define TARGET_B50 0x00000001 -#define TARGET_B75 0x00000002 -#define TARGET_B110 0x00000003 -#define TARGET_B134 0x00000004 -#define TARGET_B150 0x00000005 -#define TARGET_B200 0x00000006 -#define TARGET_B300 0x00000007 -#define TARGET_B600 0x00000008 -#define TARGET_B1200 0x00000009 -#define TARGET_B1800 0x0000000a -#define TARGET_B2400 0x0000000b -#define TARGET_B4800 0x0000000c -#define TARGET_B9600 0x0000000d -#define TARGET_B19200 0x0000000e -#define TARGET_B38400 0x0000000f -#define TARGET_EXTA B19200 -#define TARGET_EXTB B38400 -#define TARGET_CSIZE 0x00000030 -#define TARGET_CS5 0x00000000 -#define TARGET_CS6 0x00000010 -#define TARGET_CS7 0x00000020 -#define TARGET_CS8 0x00000030 -#define TARGET_CSTOPB 0x00000040 -#define TARGET_CREAD 0x00000080 -#define TARGET_PARENB 0x00000100 -#define TARGET_PARODD 0x00000200 -#define TARGET_HUPCL 0x00000400 -#define TARGET_CLOCAL 0x00000800 -#define TARGET_CBAUDEX 0x00001000 -/* We'll never see these speeds with the Zilogs, but for completeness... */ -#define TARGET_B57600 0x00001001 -#define TARGET_B115200 0x00001002 -#define TARGET_B230400 0x00001003 -#define TARGET_B460800 0x00001004 -/* This is what we can do with the Zilogs. */ -#define TARGET_B76800 0x00001005 -/* This is what we can do with the SAB82532. */ -#define TARGET_B153600 0x00001006 -#define TARGET_B307200 0x00001007 -#define TARGET_B614400 0x00001008 -#define TARGET_B921600 0x00001009 -/* And these are the rest... */ -#define TARGET_B500000 0x0000100a -#define TARGET_B576000 0x0000100b -#define TARGET_B1000000 0x0000100c -#define TARGET_B1152000 0x0000100d -#define TARGET_B1500000 0x0000100e -#define TARGET_B2000000 0x0000100f -/* These have totally bogus values and nobody uses them - so far. Later on we'd have to use say 0x10000x and - adjust CBAUD constant and drivers accordingly. -#define B2500000 0x00001010 -#define B3000000 0x00001011 -#define B3500000 0x00001012 -#define B4000000 0x00001013 */ -#define TARGET_CIBAUD 0x100f0000 /* input baud rate (not used) */ -#define TARGET_CMSPAR 0x40000000 /* mark or space (stick) parity */ -#define TARGET_CRTSCTS 0x80000000 /* flow control */ - -/* c_lflag bits */ -#define TARGET_ISIG 0x00000001 -#define TARGET_ICANON 0x00000002 -#define TARGET_XCASE 0x00000004 -#define TARGET_ECHO 0x00000008 -#define TARGET_ECHOE 0x00000010 -#define TARGET_ECHOK 0x00000020 -#define TARGET_ECHONL 0x00000040 -#define TARGET_NOFLSH 0x00000080 -#define TARGET_TOSTOP 0x00000100 -#define TARGET_ECHOCTL 0x00000200 -#define TARGET_ECHOPRT 0x00000400 -#define TARGET_ECHOKE 0x00000800 -#define TARGET_DEFECHO 0x00001000 /* SUNOS thing, what is it? */ -#define TARGET_FLUSHO 0x00002000 -#define TARGET_PENDIN 0x00004000 -#define TARGET_IEXTEN 0x00008000 -#define TARGET_EXTPROC 0x00010000 - -/* ioctls */ - -/* Big T */ -#define TARGET_TCGETA TARGET_IOR('T', 1, struct target_termio) -#define TARGET_TCSETA TARGET_IOW('T', 2, struct target_termio) -#define TARGET_TCSETAW TARGET_IOW('T', 3, struct target_termio) -#define TARGET_TCSETAF TARGET_IOW('T', 4, struct target_termio) -#define TARGET_TCSBRK TARGET_IO('T', 5) -#define TARGET_TCXONC TARGET_IO('T', 6) -#define TARGET_TCFLSH TARGET_IO('T', 7) -#define TARGET_TCGETS TARGET_IOR('T', 8, struct target_termios) -#define TARGET_TCSETS TARGET_IOW('T', 9, struct target_termios) -#define TARGET_TCSETSW TARGET_IOW('T', 10, struct target_termios) -#define TARGET_TCSETSF TARGET_IOW('T', 11, struct target_termios) - -/* Note that all the ioctls that are not available in Linux have a - * double underscore on the front to: a) avoid some programs to - * thing we support some ioctls under Linux (autoconfiguration stuff) - */ -/* Little t */ -#define TARGET_TIOCGETD TARGET_IOR('t', 0, int) -#define TARGET_TIOCSETD TARGET_IOW('t', 1, int) -//#define __TIOCHPCL _IO('t', 2) /* SunOS Specific */ -//#define __TIOCMODG _IOR('t', 3, int) /* SunOS Specific */ -//#define __TIOCMODS _IOW('t', 4, int) /* SunOS Specific */ -//#define __TIOCGETP _IOR('t', 8, struct sgttyb) /* SunOS Specific */ -//#define __TIOCSETP _IOW('t', 9, struct sgttyb) /* SunOS Specific */ -//#define __TIOCSETN _IOW('t', 10, struct sgttyb) /* SunOS Specific */ -#define TARGET_TIOCEXCL TARGET_IO('t', 13) -#define TARGET_TIOCNXCL TARGET_IO('t', 14) -//#define __TIOCFLUSH _IOW('t', 16, int) /* SunOS Specific */ -//#define __TIOCSETC _IOW('t', 17, struct tchars) /* SunOS Specific */ -//#define __TIOCGETC _IOR('t', 18, struct tchars) /* SunOS Specific */ -//#define __TIOCTCNTL _IOW('t', 32, int) /* SunOS Specific */ -//#define __TIOCSIGNAL _IOW('t', 33, int) /* SunOS Specific */ -//#define __TIOCSETX _IOW('t', 34, int) /* SunOS Specific */ -//#define __TIOCGETX _IOR('t', 35, int) /* SunOS Specific */ -#define TARGET_TIOCCONS TARGET_IO('t', 36) -//#define __TIOCSSIZE _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */ -//#define __TIOCGSIZE _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */ -#define TARGET_TIOCGSOFTCAR TARGET_IOR('t', 100, int) -#define TARGET_TIOCSSOFTCAR TARGET_IOW('t', 101, int) -//#define __TIOCUCNTL _IOW('t', 102, int) /* SunOS Specific */ -#define TARGET_TIOCSWINSZ TARGET_IOW('t', 103, struct winsize) -#define TARGET_TIOCGWINSZ TARGET_IOR('t', 104, struct winsize) -//#define __TIOCREMOTE _IOW('t', 105, int) /* SunOS Specific */ -#define TARGET_TIOCMGET TARGET_IOR('t', 106, int) -#define TARGET_TIOCMBIC TARGET_IOW('t', 107, int) -#define TARGET_TIOCMBIS TARGET_IOW('t', 108, int) -#define TARGET_TIOCMSET TARGET_IOW('t', 109, int) -#define TARGET_TIOCSTART TARGET_IO('t', 110) -#define TARGET_TIOCSTOP TARGET_IO('t', 111) -#define TARGET_TIOCPKT TARGET_IOW('t', 112, int) -#define TARGET_TIOCNOTTY TARGET_IO('t', 113) -#define TARGET_TIOCSTI TARGET_IOW('t', 114, char) -#define TARGET_TIOCOUTQ TARGET_IOR('t', 115, int) -//#define __TIOCGLTC _IOR('t', 116, struct ltchars) /* SunOS Specific */ -//#define __TIOCSLTC _IOW('t', 117, struct ltchars) /* SunOS Specific */ -/* 118 is the non-posix setpgrp tty ioctl */ -/* 119 is the non-posix getpgrp tty ioctl */ -//#define __TIOCCDTR TARGET_IO('t', 120) /* SunOS Specific */ -//#define __TIOCSDTR TARGET_IO('t', 121) /* SunOS Specific */ -#define TARGET_TIOCCBRK TARGET_IO('t', 122) -#define TARGET_TIOCSBRK TARGET_IO('t', 123) -//#define __TIOCLGET TARGET_IOW('t', 124, int) /* SunOS Specific */ -//#define __TIOCLSET TARGET_IOW('t', 125, int) /* SunOS Specific */ -//#define __TIOCLBIC TARGET_IOW('t', 126, int) /* SunOS Specific */ -//#define __TIOCLBIS TARGET_IOW('t', 127, int) /* SunOS Specific */ -//#define __TIOCISPACE TARGET_IOR('t', 128, int) /* SunOS Specific */ -//#define __TIOCISIZE TARGET_IOR('t', 129, int) /* SunOS Specific */ -#define TARGET_TIOCSPGRP TARGET_IOW('t', 130, int) -#define TARGET_TIOCGPGRP TARGET_IOR('t', 131, int) -#define TARGET_TIOCSCTTY TARGET_IO('t', 132) -#define TARGET_TIOCGSID TARGET_IOR('t', 133, int) -/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ -#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */ -#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */ -#define TARGET_TIOCGPTPEER TARGET_IO('t', 137) /* Safely open the slave */ - -/* Little f */ -#define TARGET_FIOCLEX TARGET_IO('f', 1) -#define TARGET_FIONCLEX TARGET_IO('f', 2) -#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) -#define TARGET_FIONBIO TARGET_IOW('f', 126, int) -#define TARGET_FIONREAD TARGET_IOR('f', 127, int) -#define TARGET_TIOCINQ TARGET_FIONREAD - -/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it - * someday. This is completely bogus, I know... - */ -//#define __TCGETSTAT TARGET_IO('T', 200) /* Rutgers specific */ -//#define __TCSETSTAT TARGET_IO('T', 201) /* Rutgers specific */ - -/* Linux specific, no SunOS equivalent. */ -#define TARGET_TIOCLINUX 0x541C -#define TARGET_TIOCGSERIAL 0x541E -#define TARGET_TIOCSSERIAL 0x541F -#define TARGET_TCSBRKP 0x5425 -#define TARGET_TIOCTTYGSTRUCT 0x5426 -#define TARGET_TIOCSERCONFIG 0x5453 -#define TARGET_TIOCSERGWILD 0x5454 -#define TARGET_TIOCSERSWILD 0x5455 -#define TARGET_TIOCGLCKTRMIOS 0x5456 -#define TARGET_TIOCSLCKTRMIOS 0x5457 -#define TARGET_TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TARGET_TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */ -#define TARGET_TIOCMIWAIT 0x545C /* Wait input */ -#define TARGET_TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */ - -#endif +#include "../sparc/termbits.h" From patchwork Tue May 18 05:30:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441131 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1785559jac; Mon, 17 May 2021 22:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7n4FSdUObLqmeY3SbyLWxE/Fw2cjUP2WDRY2X6A+kM4AdiEN1zaCgm7ghEVrhWvORZsfu X-Received: by 2002:a05:6102:256:: with SMTP id a22mr4644902vsq.26.1621317192175; Mon, 17 May 2021 22:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317192; cv=none; d=google.com; s=arc-20160816; b=bkWnHtFFWRSWW1TTSZSHwSSYts7Hwy+IIdNNP9BLwCvmcGe4sJLZ/v2JuH++XNtzkP HoKafM0hoTesfroDIE80ri5zHGPOIvdB3yFNVdYylXWLA7aNaPe0BQfAgK0M42USP650 8wuBOeBDeLghx4TIDYugzaHx6+6lFRdoVa1cQDloNo3TgM/61BczAPRPrHbVt+VBcj29 jkuLD+EvbXP8rZXSvw7IWyznW9fQKh/LF60Pxet09yz+KqYOlqeXX5le0W+H7V4+1X6I REgb8B3L0zQn/34jEVSDufTy5YLnb9HwM7MmEOgPWBcoPUjMqYJ5ipIbWagUw9vC0uAp zmSA== 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=4D32jxnjpkkoeXqWlVkLVpoMfRWAUqRU6wkDiQQR2Gk=; b=IPoeGqzn7clC3cxc6Zhvb+ps6Y/FrmNhCuXhT3C+9lsAg9P0EmQMk5QG7Tq+ERjj8Z ETunex/o4zEG3gGqmt0rDsW3q7vlOKDcZx6ZrI4CiuQkVtYkuDGnA4K17fHt2yqgYUoD f9/SSEhKpiNFVFF+L8BvhLbt3LOE/sraXtFiC+guuGhcVQh4VOukR+y8P+qXYOEl5e9j BtUedddvW7YmUgVU1REK9fQnD7y5s4zOkflTkit/bCwC0E61ZfL1e6/Q5H9DzucA6gg9 573hZ0B0/US2O7VSVQUoO3IzmgwVR4KxVo6Wq9vxpPQg1pT7OKLQAJnR88f5Hko6IDrf n4/w== 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 k24si9330105uap.59.2021.05.17.22.53.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:53: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; 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]:42898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisfH-0005Aj-F1 for patch@linaro.org; Tue, 18 May 2021 01:53:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKa-0007Dz-Ng for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:48 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:50089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKV-00070D-U4 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:48 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M6VRf-1lpBqe0uDJ-006vU8; Tue, 18 May 2021 07:31:41 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 18/59] linux-user/sparc: Merge sparc64/ into sparc/ Date: Tue, 18 May 2021 07:30:50 +0200 Message-Id: <20210518053131.87212-19-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:SQtVYMl6rxqFBrgFzcbxWXLNAMfq62gNOqfUalpu/QYcs9LKop7 9Xj2+WOxSq6pBxvF5BXUF7R4Pm/0FLSF2R7ez+2mLIEg//ZA45OnoQS3Ob3byzgqGxwe4cT qOmxad+DCXDd/cyu0A/1laeZ88A3NnrkRr+vD2SmoyR/vg10AER6Em/xDTRsmVliQLA+seT M+8i/QAmwLgEh+kvm4eBQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:xnTLwYff4S4=:jiNuXoJvyttHz66PVNCmHY t4qWLhDU53yAqXiM6augBJb1F6qVBKqfaW19CpdMHEKqO4jyroRQMAZs9me/hRVEVzPwWaw1e QdotSA3BErNvxHO7z4Agoj/97z9yZXEQKDOT/30Yrgh0BLzxMJnAk85cCAU1JVEssErcBZPMH UTOSxSfyNTnPAgQmTL86QNwLvj2cV3a+MDC9yzNFOZDNjWOxlv3SdUyMgUK3i6GR6osN2PuF0 5ERpm5sObk97Lr54wO31vsD2rlU9jGoIx7Ygh4Y9bbtw3i0R4VAx42vW6zPs5Tihk80bXGM/h 2HWHqosLVYpClMYE1LkU0Srf6y+hf5WEK3S1xNKtQSHssbqj38VawoBKUoribKmyuGcoGAg0p 2kioU+2KOjx5VVsz9qKq6AMwote0iVEIflKSfcmcZgLpTXkWZoD/DrBpHfJcz1zW3E9Baf6zT 3lytpWanVi28dbSy2lj4eceMco9D8qcAGSsH34H8GJcuphecgDOz+TAUQ8OrI2RYDMuei3d+R lnE8oWl9WJh5O2qYqjh6k4= Received-SPF: none client-ip=212.227.17.24; 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, 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 All of the source and header files already defer to sparc via #include. The syscall.tbl and syscallhdr.sh files could not do the same, but are identical. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- .../targets/sparc64-linux-user.mak | 1 + linux-user/meson.build | 1 - linux-user/sparc64/cpu_loop.c | 20 - linux-user/sparc64/meson.build | 5 - linux-user/sparc64/signal.c | 19 - linux-user/sparc64/sockbits.h | 1 - linux-user/sparc64/syscall.tbl | 487 ------------------ linux-user/sparc64/syscallhdr.sh | 32 -- linux-user/sparc64/target_cpu.h | 1 - linux-user/sparc64/target_elf.h | 1 - linux-user/sparc64/target_fcntl.h | 1 - linux-user/sparc64/target_signal.h | 1 - linux-user/sparc64/target_structs.h | 1 - linux-user/sparc64/target_syscall.h | 1 - linux-user/sparc64/termbits.h | 1 - 15 files changed, 1 insertion(+), 572 deletions(-) delete mode 100644 linux-user/sparc64/cpu_loop.c delete mode 100644 linux-user/sparc64/meson.build delete mode 100644 linux-user/sparc64/signal.c delete mode 100644 linux-user/sparc64/sockbits.h delete mode 100644 linux-user/sparc64/syscall.tbl delete mode 100644 linux-user/sparc64/syscallhdr.sh delete mode 100644 linux-user/sparc64/target_cpu.h delete mode 100644 linux-user/sparc64/target_elf.h delete mode 100644 linux-user/sparc64/target_fcntl.h delete mode 100644 linux-user/sparc64/target_signal.h delete mode 100644 linux-user/sparc64/target_structs.h delete mode 100644 linux-user/sparc64/target_syscall.h delete mode 100644 linux-user/sparc64/termbits.h -- 2.31.1 diff --git a/default-configs/targets/sparc64-linux-user.mak b/default-configs/targets/sparc64-linux-user.mak index 846924201ae1..9d23ab4a266e 100644 --- a/default-configs/targets/sparc64-linux-user.mak +++ b/default-configs/targets/sparc64-linux-user.mak @@ -1,5 +1,6 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc +TARGET_ABI_DIR=sparc TARGET_SYSTBL_ABI=common,64 TARGET_SYSTBL=syscall.tbl TARGET_ALIGNED_ONLY=y diff --git a/linux-user/meson.build b/linux-user/meson.build index 7fe28d659eff..9549f81682d5 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -32,7 +32,6 @@ subdir('mips') subdir('ppc') subdir('s390x') subdir('sh4') -subdir('sparc64') subdir('sparc') subdir('x86_64') subdir('xtensa') diff --git a/linux-user/sparc64/cpu_loop.c b/linux-user/sparc64/cpu_loop.c deleted file mode 100644 index 4fd44e1b1ebd..000000000000 --- a/linux-user/sparc64/cpu_loop.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * qemu user cpu loop - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include "../sparc/cpu_loop.c" diff --git a/linux-user/sparc64/meson.build b/linux-user/sparc64/meson.build deleted file mode 100644 index 9527a40ed440..000000000000 --- a/linux-user/sparc64/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -syscall_nr_generators += { - 'sparc64': generator(sh, - arguments: [ meson.current_source_dir() / 'syscallhdr.sh', '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@' ], - output: '@BASENAME@_nr.h') -} diff --git a/linux-user/sparc64/signal.c b/linux-user/sparc64/signal.c deleted file mode 100644 index 170ebac232c0..000000000000 --- a/linux-user/sparc64/signal.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Emulation of Linux signals - * - * Copyright (c) 2003 Fabrice Bellard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ -#include "../sparc/signal.c" diff --git a/linux-user/sparc64/sockbits.h b/linux-user/sparc64/sockbits.h deleted file mode 100644 index 658899e4d363..000000000000 --- a/linux-user/sparc64/sockbits.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/sockbits.h" diff --git a/linux-user/sparc64/syscall.tbl b/linux-user/sparc64/syscall.tbl deleted file mode 100644 index 4af114e84f20..000000000000 --- a/linux-user/sparc64/syscall.tbl +++ /dev/null @@ -1,487 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note -# -# system call numbers and entry vectors for sparc -# -# The format is: -# -# -# The can be common, 64, or 32 for this file. -# -0 common restart_syscall sys_restart_syscall -1 32 exit sys_exit sparc_exit -1 64 exit sparc_exit -2 common fork sys_fork -3 common read sys_read -4 common write sys_write -5 common open sys_open compat_sys_open -6 common close sys_close -7 common wait4 sys_wait4 compat_sys_wait4 -8 common creat sys_creat -9 common link sys_link -10 common unlink sys_unlink -11 32 execv sunos_execv -11 64 execv sys_nis_syscall -12 common chdir sys_chdir -13 32 chown sys_chown16 -13 64 chown sys_chown -14 common mknod sys_mknod -15 common chmod sys_chmod -16 32 lchown sys_lchown16 -16 64 lchown sys_lchown -17 common brk sys_brk -18 common perfctr sys_nis_syscall -19 common lseek sys_lseek compat_sys_lseek -20 common getpid sys_getpid -21 common capget sys_capget -22 common capset sys_capset -23 32 setuid sys_setuid16 -23 64 setuid sys_setuid -24 32 getuid sys_getuid16 -24 64 getuid sys_getuid -25 common vmsplice sys_vmsplice compat_sys_vmsplice -26 common ptrace sys_ptrace compat_sys_ptrace -27 common alarm sys_alarm -28 common sigaltstack sys_sigaltstack compat_sys_sigaltstack -29 32 pause sys_pause -29 64 pause sys_nis_syscall -30 32 utime sys_utime32 -30 64 utime sys_utime -31 32 lchown32 sys_lchown -32 32 fchown32 sys_fchown -33 common access sys_access -34 common nice sys_nice -35 32 chown32 sys_chown -36 common sync sys_sync -37 common kill sys_kill -38 common stat sys_newstat compat_sys_newstat -39 32 sendfile sys_sendfile compat_sys_sendfile -39 64 sendfile sys_sendfile64 -40 common lstat sys_newlstat compat_sys_newlstat -41 common dup sys_dup -42 common pipe sys_sparc_pipe -43 common times sys_times compat_sys_times -44 32 getuid32 sys_getuid -45 common umount2 sys_umount -46 32 setgid sys_setgid16 -46 64 setgid sys_setgid -47 32 getgid sys_getgid16 -47 64 getgid sys_getgid -48 common signal sys_signal -49 32 geteuid sys_geteuid16 -49 64 geteuid sys_geteuid -50 32 getegid sys_getegid16 -50 64 getegid sys_getegid -51 common acct sys_acct -52 64 memory_ordering sys_memory_ordering -53 32 getgid32 sys_getgid -54 common ioctl sys_ioctl compat_sys_ioctl -55 common reboot sys_reboot -56 32 mmap2 sys_mmap2 sys32_mmap2 -57 common symlink sys_symlink -58 common readlink sys_readlink -59 32 execve sys_execve sys32_execve -59 64 execve sys64_execve -60 common umask sys_umask -61 common chroot sys_chroot -62 common fstat sys_newfstat compat_sys_newfstat -63 common fstat64 sys_fstat64 compat_sys_fstat64 -64 common getpagesize sys_getpagesize -65 common msync sys_msync -66 common vfork sys_vfork -67 common pread64 sys_pread64 compat_sys_pread64 -68 common pwrite64 sys_pwrite64 compat_sys_pwrite64 -69 32 geteuid32 sys_geteuid -70 32 getegid32 sys_getegid -71 common mmap sys_mmap -72 32 setreuid32 sys_setreuid -73 32 munmap sys_munmap -73 64 munmap sys_64_munmap -74 common mprotect sys_mprotect -75 common madvise sys_madvise -76 common vhangup sys_vhangup -77 32 truncate64 sys_truncate64 compat_sys_truncate64 -78 common mincore sys_mincore -79 32 getgroups sys_getgroups16 -79 64 getgroups sys_getgroups -80 32 setgroups sys_setgroups16 -80 64 setgroups sys_setgroups -81 common getpgrp sys_getpgrp -82 32 setgroups32 sys_setgroups -83 common setitimer sys_setitimer compat_sys_setitimer -84 32 ftruncate64 sys_ftruncate64 compat_sys_ftruncate64 -85 common swapon sys_swapon -86 common getitimer sys_getitimer compat_sys_getitimer -87 32 setuid32 sys_setuid -88 common sethostname sys_sethostname -89 32 setgid32 sys_setgid -90 common dup2 sys_dup2 -91 32 setfsuid32 sys_setfsuid -92 common fcntl sys_fcntl compat_sys_fcntl -93 common select sys_select -94 32 setfsgid32 sys_setfsgid -95 common fsync sys_fsync -96 common setpriority sys_setpriority -97 common socket sys_socket -98 common connect sys_connect -99 common accept sys_accept -100 common getpriority sys_getpriority -101 common rt_sigreturn sys_rt_sigreturn sys32_rt_sigreturn -102 common rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction -103 common rt_sigprocmask sys_rt_sigprocmask compat_sys_rt_sigprocmask -104 common rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending -105 32 rt_sigtimedwait sys_rt_sigtimedwait_time32 compat_sys_rt_sigtimedwait_time32 -105 64 rt_sigtimedwait sys_rt_sigtimedwait -106 common rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo -107 common rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend -108 32 setresuid32 sys_setresuid -108 64 setresuid sys_setresuid -109 32 getresuid32 sys_getresuid -109 64 getresuid sys_getresuid -110 32 setresgid32 sys_setresgid -110 64 setresgid sys_setresgid -111 32 getresgid32 sys_getresgid -111 64 getresgid sys_getresgid -112 32 setregid32 sys_setregid -113 common recvmsg sys_recvmsg compat_sys_recvmsg -114 common sendmsg sys_sendmsg compat_sys_sendmsg -115 32 getgroups32 sys_getgroups -116 common gettimeofday sys_gettimeofday compat_sys_gettimeofday -117 common getrusage sys_getrusage compat_sys_getrusage -118 common getsockopt sys_getsockopt sys_getsockopt -119 common getcwd sys_getcwd -120 common readv sys_readv compat_sys_readv -121 common writev sys_writev compat_sys_writev -122 common settimeofday sys_settimeofday compat_sys_settimeofday -123 32 fchown sys_fchown16 -123 64 fchown sys_fchown -124 common fchmod sys_fchmod -125 common recvfrom sys_recvfrom -126 32 setreuid sys_setreuid16 -126 64 setreuid sys_setreuid -127 32 setregid sys_setregid16 -127 64 setregid sys_setregid -128 common rename sys_rename -129 common truncate sys_truncate compat_sys_truncate -130 common ftruncate sys_ftruncate compat_sys_ftruncate -131 common flock sys_flock -132 common lstat64 sys_lstat64 compat_sys_lstat64 -133 common sendto sys_sendto -134 common shutdown sys_shutdown -135 common socketpair sys_socketpair -136 common mkdir sys_mkdir -137 common rmdir sys_rmdir -138 32 utimes sys_utimes_time32 -138 64 utimes sys_utimes -139 common stat64 sys_stat64 compat_sys_stat64 -140 common sendfile64 sys_sendfile64 -141 common getpeername sys_getpeername -142 32 futex sys_futex_time32 -142 64 futex sys_futex -143 common gettid sys_gettid -144 common getrlimit sys_getrlimit compat_sys_getrlimit -145 common setrlimit sys_setrlimit compat_sys_setrlimit -146 common pivot_root sys_pivot_root -147 common prctl sys_prctl -148 common pciconfig_read sys_pciconfig_read -149 common pciconfig_write sys_pciconfig_write -150 common getsockname sys_getsockname -151 common inotify_init sys_inotify_init -152 common inotify_add_watch sys_inotify_add_watch -153 common poll sys_poll -154 common getdents64 sys_getdents64 -155 32 fcntl64 sys_fcntl64 compat_sys_fcntl64 -156 common inotify_rm_watch sys_inotify_rm_watch -157 common statfs sys_statfs compat_sys_statfs -158 common fstatfs sys_fstatfs compat_sys_fstatfs -159 common umount sys_oldumount -160 common sched_set_affinity sys_sched_setaffinity compat_sys_sched_setaffinity -161 common sched_get_affinity sys_sched_getaffinity compat_sys_sched_getaffinity -162 common getdomainname sys_getdomainname -163 common setdomainname sys_setdomainname -164 64 utrap_install sys_utrap_install -165 common quotactl sys_quotactl -166 common set_tid_address sys_set_tid_address -167 common mount sys_mount compat_sys_mount -168 common ustat sys_ustat compat_sys_ustat -169 common setxattr sys_setxattr -170 common lsetxattr sys_lsetxattr -171 common fsetxattr sys_fsetxattr -172 common getxattr sys_getxattr -173 common lgetxattr sys_lgetxattr -174 common getdents sys_getdents compat_sys_getdents -175 common setsid sys_setsid -176 common fchdir sys_fchdir -177 common fgetxattr sys_fgetxattr -178 common listxattr sys_listxattr -179 common llistxattr sys_llistxattr -180 common flistxattr sys_flistxattr -181 common removexattr sys_removexattr -182 common lremovexattr sys_lremovexattr -183 32 sigpending sys_sigpending compat_sys_sigpending -183 64 sigpending sys_nis_syscall -184 common query_module sys_ni_syscall -185 common setpgid sys_setpgid -186 common fremovexattr sys_fremovexattr -187 common tkill sys_tkill -188 32 exit_group sys_exit_group sparc_exit_group -188 64 exit_group sparc_exit_group -189 common uname sys_newuname -190 common init_module sys_init_module -191 32 personality sys_personality sys_sparc64_personality -191 64 personality sys_sparc64_personality -192 32 remap_file_pages sys_sparc_remap_file_pages sys_remap_file_pages -192 64 remap_file_pages sys_remap_file_pages -193 common epoll_create sys_epoll_create -194 common epoll_ctl sys_epoll_ctl -195 common epoll_wait sys_epoll_wait -196 common ioprio_set sys_ioprio_set -197 common getppid sys_getppid -198 32 sigaction sys_sparc_sigaction compat_sys_sparc_sigaction -198 64 sigaction sys_nis_syscall -199 common sgetmask sys_sgetmask -200 common ssetmask sys_ssetmask -201 32 sigsuspend sys_sigsuspend -201 64 sigsuspend sys_nis_syscall -202 common oldlstat sys_newlstat compat_sys_newlstat -203 common uselib sys_uselib -204 32 readdir sys_old_readdir compat_sys_old_readdir -204 64 readdir sys_nis_syscall -205 common readahead sys_readahead compat_sys_readahead -206 common socketcall sys_socketcall sys32_socketcall -207 common syslog sys_syslog -208 common lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie -209 common fadvise64 sys_fadvise64 compat_sys_fadvise64 -210 common fadvise64_64 sys_fadvise64_64 compat_sys_fadvise64_64 -211 common tgkill sys_tgkill -212 common waitpid sys_waitpid -213 common swapoff sys_swapoff -214 common sysinfo sys_sysinfo compat_sys_sysinfo -215 32 ipc sys_ipc compat_sys_ipc -215 64 ipc sys_sparc_ipc -216 32 sigreturn sys_sigreturn sys32_sigreturn -216 64 sigreturn sys_nis_syscall -217 common clone sys_clone -218 common ioprio_get sys_ioprio_get -219 32 adjtimex sys_adjtimex_time32 -219 64 adjtimex sys_sparc_adjtimex -220 32 sigprocmask sys_sigprocmask compat_sys_sigprocmask -220 64 sigprocmask sys_nis_syscall -221 common create_module sys_ni_syscall -222 common delete_module sys_delete_module -223 common get_kernel_syms sys_ni_syscall -224 common getpgid sys_getpgid -225 common bdflush sys_bdflush -226 common sysfs sys_sysfs -227 common afs_syscall sys_nis_syscall -228 common setfsuid sys_setfsuid16 -229 common setfsgid sys_setfsgid16 -230 common _newselect sys_select compat_sys_select -231 32 time sys_time32 -232 common splice sys_splice -233 32 stime sys_stime32 -233 64 stime sys_stime -234 common statfs64 sys_statfs64 compat_sys_statfs64 -235 common fstatfs64 sys_fstatfs64 compat_sys_fstatfs64 -236 common _llseek sys_llseek -237 common mlock sys_mlock -238 common munlock sys_munlock -239 common mlockall sys_mlockall -240 common munlockall sys_munlockall -241 common sched_setparam sys_sched_setparam -242 common sched_getparam sys_sched_getparam -243 common sched_setscheduler sys_sched_setscheduler -244 common sched_getscheduler sys_sched_getscheduler -245 common sched_yield sys_sched_yield -246 common sched_get_priority_max sys_sched_get_priority_max -247 common sched_get_priority_min sys_sched_get_priority_min -248 32 sched_rr_get_interval sys_sched_rr_get_interval_time32 -248 64 sched_rr_get_interval sys_sched_rr_get_interval -249 32 nanosleep sys_nanosleep_time32 -249 64 nanosleep sys_nanosleep -250 32 mremap sys_mremap -250 64 mremap sys_64_mremap -251 common _sysctl sys_ni_syscall -252 common getsid sys_getsid -253 common fdatasync sys_fdatasync -254 32 nfsservctl sys_ni_syscall sys_nis_syscall -254 64 nfsservctl sys_nis_syscall -255 common sync_file_range sys_sync_file_range compat_sys_sync_file_range -256 32 clock_settime sys_clock_settime32 -256 64 clock_settime sys_clock_settime -257 32 clock_gettime sys_clock_gettime32 -257 64 clock_gettime sys_clock_gettime -258 32 clock_getres sys_clock_getres_time32 -258 64 clock_getres sys_clock_getres -259 32 clock_nanosleep sys_clock_nanosleep_time32 -259 64 clock_nanosleep sys_clock_nanosleep -260 common sched_getaffinity sys_sched_getaffinity compat_sys_sched_getaffinity -261 common sched_setaffinity sys_sched_setaffinity compat_sys_sched_setaffinity -262 32 timer_settime sys_timer_settime32 -262 64 timer_settime sys_timer_settime -263 32 timer_gettime sys_timer_gettime32 -263 64 timer_gettime sys_timer_gettime -264 common timer_getoverrun sys_timer_getoverrun -265 common timer_delete sys_timer_delete -266 common timer_create sys_timer_create compat_sys_timer_create -# 267 was vserver -267 common vserver sys_nis_syscall -268 common io_setup sys_io_setup compat_sys_io_setup -269 common io_destroy sys_io_destroy -270 common io_submit sys_io_submit compat_sys_io_submit -271 common io_cancel sys_io_cancel -272 32 io_getevents sys_io_getevents_time32 -272 64 io_getevents sys_io_getevents -273 common mq_open sys_mq_open compat_sys_mq_open -274 common mq_unlink sys_mq_unlink -275 32 mq_timedsend sys_mq_timedsend_time32 -275 64 mq_timedsend sys_mq_timedsend -276 32 mq_timedreceive sys_mq_timedreceive_time32 -276 64 mq_timedreceive sys_mq_timedreceive -277 common mq_notify sys_mq_notify compat_sys_mq_notify -278 common mq_getsetattr sys_mq_getsetattr compat_sys_mq_getsetattr -279 common waitid sys_waitid compat_sys_waitid -280 common tee sys_tee -281 common add_key sys_add_key -282 common request_key sys_request_key -283 common keyctl sys_keyctl compat_sys_keyctl -284 common openat sys_openat compat_sys_openat -285 common mkdirat sys_mkdirat -286 common mknodat sys_mknodat -287 common fchownat sys_fchownat -288 32 futimesat sys_futimesat_time32 -288 64 futimesat sys_futimesat -289 common fstatat64 sys_fstatat64 compat_sys_fstatat64 -290 common unlinkat sys_unlinkat -291 common renameat sys_renameat -292 common linkat sys_linkat -293 common symlinkat sys_symlinkat -294 common readlinkat sys_readlinkat -295 common fchmodat sys_fchmodat -296 common faccessat sys_faccessat -297 32 pselect6 sys_pselect6_time32 compat_sys_pselect6_time32 -297 64 pselect6 sys_pselect6 -298 32 ppoll sys_ppoll_time32 compat_sys_ppoll_time32 -298 64 ppoll sys_ppoll -299 common unshare sys_unshare -300 common set_robust_list sys_set_robust_list compat_sys_set_robust_list -301 common get_robust_list sys_get_robust_list compat_sys_get_robust_list -302 common migrate_pages sys_migrate_pages compat_sys_migrate_pages -303 common mbind sys_mbind compat_sys_mbind -304 common get_mempolicy sys_get_mempolicy compat_sys_get_mempolicy -305 common set_mempolicy sys_set_mempolicy compat_sys_set_mempolicy -306 common kexec_load sys_kexec_load compat_sys_kexec_load -307 common move_pages sys_move_pages compat_sys_move_pages -308 common getcpu sys_getcpu -309 common epoll_pwait sys_epoll_pwait compat_sys_epoll_pwait -310 32 utimensat sys_utimensat_time32 -310 64 utimensat sys_utimensat -311 common signalfd sys_signalfd compat_sys_signalfd -312 common timerfd_create sys_timerfd_create -313 common eventfd sys_eventfd -314 common fallocate sys_fallocate compat_sys_fallocate -315 32 timerfd_settime sys_timerfd_settime32 -315 64 timerfd_settime sys_timerfd_settime -316 32 timerfd_gettime sys_timerfd_gettime32 -316 64 timerfd_gettime sys_timerfd_gettime -317 common signalfd4 sys_signalfd4 compat_sys_signalfd4 -318 common eventfd2 sys_eventfd2 -319 common epoll_create1 sys_epoll_create1 -320 common dup3 sys_dup3 -321 common pipe2 sys_pipe2 -322 common inotify_init1 sys_inotify_init1 -323 common accept4 sys_accept4 -324 common preadv sys_preadv compat_sys_preadv -325 common pwritev sys_pwritev compat_sys_pwritev -326 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo -327 common perf_event_open sys_perf_event_open -328 32 recvmmsg sys_recvmmsg_time32 compat_sys_recvmmsg_time32 -328 64 recvmmsg sys_recvmmsg -329 common fanotify_init sys_fanotify_init -330 common fanotify_mark sys_fanotify_mark compat_sys_fanotify_mark -331 common prlimit64 sys_prlimit64 -332 common name_to_handle_at sys_name_to_handle_at -333 common open_by_handle_at sys_open_by_handle_at compat_sys_open_by_handle_at -334 32 clock_adjtime sys_clock_adjtime32 -334 64 clock_adjtime sys_sparc_clock_adjtime -335 common syncfs sys_syncfs -336 common sendmmsg sys_sendmmsg compat_sys_sendmmsg -337 common setns sys_setns -338 common process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv -339 common process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev -340 32 kern_features sys_ni_syscall sys_kern_features -340 64 kern_features sys_kern_features -341 common kcmp sys_kcmp -342 common finit_module sys_finit_module -343 common sched_setattr sys_sched_setattr -344 common sched_getattr sys_sched_getattr -345 common renameat2 sys_renameat2 -346 common seccomp sys_seccomp -347 common getrandom sys_getrandom -348 common memfd_create sys_memfd_create -349 common bpf sys_bpf -350 32 execveat sys_execveat sys32_execveat -350 64 execveat sys64_execveat -351 common membarrier sys_membarrier -352 common userfaultfd sys_userfaultfd -353 common bind sys_bind -354 common listen sys_listen -355 common setsockopt sys_setsockopt sys_setsockopt -356 common mlock2 sys_mlock2 -357 common copy_file_range sys_copy_file_range -358 common preadv2 sys_preadv2 compat_sys_preadv2 -359 common pwritev2 sys_pwritev2 compat_sys_pwritev2 -360 common statx sys_statx -361 32 io_pgetevents sys_io_pgetevents_time32 compat_sys_io_pgetevents -361 64 io_pgetevents sys_io_pgetevents -362 common pkey_mprotect sys_pkey_mprotect -363 common pkey_alloc sys_pkey_alloc -364 common pkey_free sys_pkey_free -365 common rseq sys_rseq -# room for arch specific syscalls -392 64 semtimedop sys_semtimedop -393 common semget sys_semget -394 common semctl sys_semctl compat_sys_semctl -395 common shmget sys_shmget -396 common shmctl sys_shmctl compat_sys_shmctl -397 common shmat sys_shmat compat_sys_shmat -398 common shmdt sys_shmdt -399 common msgget sys_msgget -400 common msgsnd sys_msgsnd compat_sys_msgsnd -401 common msgrcv sys_msgrcv compat_sys_msgrcv -402 common msgctl sys_msgctl compat_sys_msgctl -403 32 clock_gettime64 sys_clock_gettime sys_clock_gettime -404 32 clock_settime64 sys_clock_settime sys_clock_settime -405 32 clock_adjtime64 sys_clock_adjtime sys_clock_adjtime -406 32 clock_getres_time64 sys_clock_getres sys_clock_getres -407 32 clock_nanosleep_time64 sys_clock_nanosleep sys_clock_nanosleep -408 32 timer_gettime64 sys_timer_gettime sys_timer_gettime -409 32 timer_settime64 sys_timer_settime sys_timer_settime -410 32 timerfd_gettime64 sys_timerfd_gettime sys_timerfd_gettime -411 32 timerfd_settime64 sys_timerfd_settime sys_timerfd_settime -412 32 utimensat_time64 sys_utimensat sys_utimensat -413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 -414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents -417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 -418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend -419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive -420 32 semtimedop_time64 sys_semtimedop sys_semtimedop -421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 -422 32 futex_time64 sys_futex sys_futex -423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval -424 common pidfd_send_signal sys_pidfd_send_signal -425 common io_uring_setup sys_io_uring_setup -426 common io_uring_enter sys_io_uring_enter -427 common io_uring_register sys_io_uring_register -428 common open_tree sys_open_tree -429 common move_mount sys_move_mount -430 common fsopen sys_fsopen -431 common fsconfig sys_fsconfig -432 common fsmount sys_fsmount -433 common fspick sys_fspick -434 common pidfd_open sys_pidfd_open -# 435 reserved for clone3 -436 common close_range sys_close_range -437 common openat2 sys_openat2 -438 common pidfd_getfd sys_pidfd_getfd -439 common faccessat2 sys_faccessat2 diff --git a/linux-user/sparc64/syscallhdr.sh b/linux-user/sparc64/syscallhdr.sh deleted file mode 100644 index 08c7e39bb3fe..000000000000 --- a/linux-user/sparc64/syscallhdr.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -in="$1" -out="$2" -my_abis=`echo "($3)" | tr ',' '|'` -prefix="$4" -offset="$5" - -fileguard=LINUX_USER_SPARC64_`basename "$out" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ - -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` -grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( - printf "#ifndef %s\n" "${fileguard}" - printf "#define %s\n" "${fileguard}" - printf "\n" - - nxt=0 - while read nr abi name entry compat ; do - if [ -z "$offset" ]; then - printf "#define TARGET_NR_%s%s\t%s\n" \ - "${prefix}" "${name}" "${nr}" - else - printf "#define TARGET_NR_%s%s\t(%s + %s)\n" \ - "${prefix}" "${name}" "${offset}" "${nr}" - fi - nxt=$((nr+1)) - done - - printf "\n" - printf "#endif /* %s */" "${fileguard}" -) > "$out" diff --git a/linux-user/sparc64/target_cpu.h b/linux-user/sparc64/target_cpu.h deleted file mode 100644 index b22263d2dbe9..000000000000 --- a/linux-user/sparc64/target_cpu.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_cpu.h" diff --git a/linux-user/sparc64/target_elf.h b/linux-user/sparc64/target_elf.h deleted file mode 100644 index 023b49b74375..000000000000 --- a/linux-user/sparc64/target_elf.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_elf.h" diff --git a/linux-user/sparc64/target_fcntl.h b/linux-user/sparc64/target_fcntl.h deleted file mode 100644 index 053c7742579f..000000000000 --- a/linux-user/sparc64/target_fcntl.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_fcntl.h" diff --git a/linux-user/sparc64/target_signal.h b/linux-user/sparc64/target_signal.h deleted file mode 100644 index 6a7d57d0243c..000000000000 --- a/linux-user/sparc64/target_signal.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_signal.h" diff --git a/linux-user/sparc64/target_structs.h b/linux-user/sparc64/target_structs.h deleted file mode 100644 index cbcbc4602a69..000000000000 --- a/linux-user/sparc64/target_structs.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_structs.h" diff --git a/linux-user/sparc64/target_syscall.h b/linux-user/sparc64/target_syscall.h deleted file mode 100644 index 164a5fc6322f..000000000000 --- a/linux-user/sparc64/target_syscall.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/target_syscall.h" diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h deleted file mode 100644 index 54ddfee3ba34..000000000000 --- a/linux-user/sparc64/termbits.h +++ /dev/null @@ -1 +0,0 @@ -#include "../sparc/termbits.h" From patchwork Tue May 18 05:30:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441121 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1776490jac; Mon, 17 May 2021 22:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmCR1ENWoO+uNayRVd8TD/L6HDESOJw8QHjHXImONhmVTeKKQuSJ3mtlnoHsZ4hEZbK2uz X-Received: by 2002:a05:6102:3006:: with SMTP id s6mr4271334vsa.55.1621316286719; Mon, 17 May 2021 22:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316286; cv=none; d=google.com; s=arc-20160816; b=eEWXOErzPmo1ZIp6sM1v8trdgAP6dn4NjdAExKMkrRtM1XeHiRscxAGqErSAcaNpbQ re6lwV6WTTDdJCugEW2bPboD6kGQPa8T+SWSrtonCqy7G6X8GXeSNccFzENzva0uqDRT irRwYYrt3X0AqFv9KJVaSL+mJZX/RYq0dEIQVsrTRwqQh8rL4FL/NS4DBCSswucX4uqp qIegcH3G+bph1nwkZZY+UCUfhlw0CltkxJtPqJZK0J2NjpVxNia4bsnuLl7MxPMWy6mR R/7lJCqryiPTR4gBlMaiC13yjoVbxbwVnyknA+CgQss+kQmLskYUcRXjEhWJhU+kSfes 4T5g== 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=aETM7cX6Fn2IOowAJApdnIrW/Wt3lUGHDrN0sMwrFLc=; b=eT1Yx0zc769pIQFDJxK/4aVssHJ8wko+P3qCvio/Twe3seeuZA4kkATLHuvAKCpu+Z mwpwoqueoV1RvXfXqJkhqgkEGzyWO0g6Ws5PY8SsXGZu+g31NO98+8uoEMmM3BCAjPg6 W2A7UbwBUx9LPRUbA6WimuxtPPkRLJkEMSUwaPwE0c23+B0EVPY5/w7HiEcJUAMSxZO5 yC62Yi6LCbgxTncFaoWFrMQNs1ntjpqkySKt+v1VUHg3SeHDEsflJ32W57oC5WW8iCB5 uR6QLjRetWW7ia2W0NOjaJXmc0mIpeilJ+8SiqjL8de2iZ1bYHl+Bt8v99S6kH0mKXN7 XoZw== 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 p4si1750451vkm.54.2021.05.17.22.38.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:38:06 -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]:37084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisQg-0007II-3C for patch@linaro.org; Tue, 18 May 2021 01:38:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKZ-00076a-2L for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:47 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:59629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKX-00071H-Ab for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:46 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mnq4Q-1l75r248a2-00pNWQ; Tue, 18 May 2021 07:31:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 19/59] linux-user/sparc: Remove target_sigcontext as unused Date: Tue, 18 May 2021 07:30:51 +0200 Message-Id: <20210518053131.87212-20-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:fzgVEwQgHpq5x7eUZ6n+Y9Jg7c2kJgFhZ9mPXELGNIUovVvMXG+ fFRHH50Ins/T7+XW3NvGhUKQywVgww1xivcP/NuEehlTflrrpZw7K9lJMqGkUR9fLvOzDqn CEJkrGVwM8/lftnKzCf3kuQZiNpYeWFUvQgAI2/HNSf4gdP1MeelhM1e+EjKJ5X3W8Uyhq9 uJxhytJBAJZfH/Km3TLqg== X-UI-Out-Filterresults: notjunk:1; V03:K0:txJ3j8Gd3Ow=:bDPsAdo17l4f6gLL4nb5ck GpoQCVLhFR8fG6OxwrftE4DmfogOznEmSmvA7n0s7LeWtUv7gGHDmU6/AyFOZi1Gg0VZjUXO/ +5p94pdN35VLx3VswQwlR6NUylvk+mhI81FPfohIar/6x/I9qrXnvoih49SCYm+1k//vRnjCP uUcwPPazhjD3ttPeyZXyyo69wMOsbtglS3jx/8a1+29wO3tz7Uo0xbMlwpM8H9NBHXjy+Kvzb 2YZy9jPRviD3qTQw6Y1opcjYzOggVO6TfVhBSU49MuP/fgSjucrYdnylHQnAI01ysxEs5yTNS c2buQF4v5l/Ot1JBMxKce1itHE5r499bMgBAc2PFj1RzKNFMXtF8fX3sal7CFtXeLPE7lBccr bDI2g8PBE68HyR7GtgLvCuTZ3IpDK1coiAXEkIIW77z3bkW6gH1HuJ1bscoPpyTSSEmH76OgZ cCbEoNC3x8AUlFNL+Cp06dBBmVI5CJxkS36t/bnAYCLrh5nEdy1eaqqXuER330WLJO+tNG6lB lCbo4jy1wKoC0GBr/IXUqw= Received-SPF: none client-ip=212.227.126.131; 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, 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 28 ---------------------------- 1 file changed, 28 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 76579093a88c..3d068e095508 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -21,34 +21,6 @@ #include "signal-common.h" #include "linux-user/trace.h" -#define __SUNOS_MAXWIN 31 - -/* This is what SunOS does, so shall I. */ -struct target_sigcontext { - abi_ulong sigc_onstack; /* state to restore */ - - abi_ulong sigc_mask; /* sigmask to restore */ - abi_ulong sigc_sp; /* stack pointer */ - abi_ulong sigc_pc; /* program counter */ - abi_ulong sigc_npc; /* next program counter */ - abi_ulong sigc_psr; /* for condition codes etc */ - abi_ulong sigc_g1; /* User uses these two registers */ - abi_ulong sigc_o0; /* within the trampoline code. */ - - /* Now comes information regarding the users window set - * at the time of the signal. - */ - abi_ulong sigc_oswins; /* outstanding windows */ - - /* stack ptrs for each regwin buf */ - char *sigc_spbuf[__SUNOS_MAXWIN]; - - /* Windows to restore after signal */ - struct { - abi_ulong locals[8]; - abi_ulong ins[8]; - } sigc_wbuf[__SUNOS_MAXWIN]; -}; /* A Sparc stack frame */ struct sparc_stackf { abi_ulong locals[8]; From patchwork Tue May 18 05:30:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441134 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1786719jac; Mon, 17 May 2021 22:55:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFCh5s91oM97Rb8hb8aHe+vY4qEKDcvpKwApNAvXf6y71h6MfsxtGGtE8Q4GGwaPIk/rh2 X-Received: by 2002:ac8:1206:: with SMTP id x6mr3130412qti.261.1621317310018; Mon, 17 May 2021 22:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317310; cv=none; d=google.com; s=arc-20160816; b=kt1H8j3BmssV0DMqQZisOLpFlRQNkVq9dCQCuOgN16bW0wHp4cxD/gYCMKFdWQRAa/ WmPYNTBlM+vrvurRcKePlyFRe1DUrz3k984Xc5uhPdhLdww3NgWZ350wGJoNUBbhXNqc iv0phOiwFgSgY7PMQM3y4GNfRViKms1AneiFcuugJqlnYdglQ0vGOQ7h7S7rdU6LonKw +PZqzFdIVY+WBF6Qjm9ESLLGPQC7ANRrAGlgufUcPGNt7DWn3pC91DhIp7X168UI7o21 GvR3ID4sx0yA/ZDg5ZcM2HdlKmRJxuPty9Ey6lOuLHOlNPGQ5oe2YvpvaFDBqDEnx+kq b2sg== 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=bKzskBAJgP7icxaeKtmII4rS816hMzGi1KXbx6iXGaE=; b=wRSA+c9mZi3kkHpJsUdpfInwif6fk/WpdsUoijzRXZBHqmUaN38yT/S2zI46zafeHY Dh0tPpKWATc0S5e1KN9CjHSsSc3zTAs4fkwcDeoWKo2gLZAQbq296oDmeHpx1fvEHQgN ksPbHKFt+TQq8CuE6hYFriTRMORXo9Wmw9kFzNGrXnrZ9wQBCzSne5k9wumWBQ3XJu4M +G61H8mOzEMVYAGy/F0k0jQa/Q+vunqPFytmaQpwDzCX9xVV2jjJwtj+ez7wsgcnL56g H2sHezRrwz3QwEEhTTL05TDmn6K9xhkOENtYuCdmtt3bhD9JJ317wa5Y0Df3y3EZTybZ g0JA== 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 t22si14670481qkj.6.2021.05.17.22.55.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:55:10 -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]:45782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lishB-000797-BP for patch@linaro.org; Tue, 18 May 2021 01:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKc-0007Lt-LV for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:50 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:38329) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKX-00071f-Hg for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:50 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MLiPA-1m0PDL1xDs-00HdQ4; Tue, 18 May 2021 07:31:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 20/59] linux-user/sparc: Remove target_rt_signal_frame as unused Date: Tue, 18 May 2021 07:30:52 +0200 Message-Id: <20210518053131.87212-21-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:pzEhl5msB69SR1LsoqWXfpcEmhm28bWZGCNObjajD4vE5qRp2rh 7hjmXvwFhS33IFOyGAq21ravfx2HyotUI4fuxBwUQIpGULnjLkV/qsRRtYheWX2q1/fKcPh 3cBtwoG7lPJtb34QY+Hsq3RF2J85kpCZl8umSTp0s5Jr+V00qYBJ+taReBWp83X2sYMqhGR XlbPIKO81tCt7ym4W2hlA== X-UI-Out-Filterresults: notjunk:1; V03:K0:Z5KaRiB5JzM=:C+XKfrtCu4Q0bB+TnrZos2 4bftf59kDiCbAJcyXp0ZToAKhEn8WlNeqZocSDCtnzjtdDDn4P8ow/C6b1iaRjBx28apYA8rf IUtdVevZt3UAKjTiP4LdyPVSHa0XodEQLs5aSqO7r4awihP5ot3xLSK4p7I4Z+MjSQso7tjWn FxNRds3vhV0Yqu92AzyfursuLmwSLeMtUvRPlfTf08qQaY2NLpkz255T7ohURq8b5fnIrZcXR 850uPRT9CXPEUv7++w0rR1zro+kwk244TRQhxu1/RJwUfn8H0owMhvM0Y9BxJ835pnpP0ZFMy /wia5F1lAYbW6YKXYAKDx3wkrAAaQAWsadSsIIwXjwtmrldTkkCUC+TuwBVYagdAQhgNjSF1x J3W38/XG8M2LhJBI8mTaz3bFV2XoMUmG46E+M/TX0d3qYjYrlbyg4ZmfLQCpVhsFtMD1Bl6+M HsfEgtYNwiRoNDoOrXMRr4HgNmOYrrbwgZgMTJIxf95n0Nbtf0SjJWyVf7bLN8L/wHfrEy1ep nOsZFuolkpBTAwc/kXrKTI= 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 It's wrong anyway. Remove it for now. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 11 ----------- 1 file changed, 11 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 3d068e095508..29c5e3b0c0be 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -64,17 +64,6 @@ struct target_signal_frame { abi_ulong extra_size; /* Should be 0 */ qemu_siginfo_fpu_t fpu_state; }; -struct target_rt_signal_frame { - struct sparc_stackf ss; - siginfo_t info; - abi_ulong regs[20]; - sigset_t mask; - abi_ulong fpu_save; - uint32_t insns[2]; - stack_t stack; - unsigned int extra_size; /* Should be 0 */ - qemu_siginfo_fpu_t fpu_state; -}; static inline abi_ulong get_sigframe(struct target_sigaction *sa, CPUSPARCState *env, 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) { From patchwork Tue May 18 05:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441135 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1787295jac; Mon, 17 May 2021 22:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGemuvNNSixnK0hOkjkeiZa2npP5jT1O3mwnWEKMQx9DUl6pNNYB6sifqOt1cDqHkHmjK2 X-Received: by 2002:a05:6214:250f:: with SMTP id gf15mr3688494qvb.51.1621317371655; Mon, 17 May 2021 22:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317371; cv=none; d=google.com; s=arc-20160816; b=C2mQ0/IbxxFeQgZ+93ZRXmWPGYaUc97ecJgJ4wGyCnQ5MMQul94tTAzGmruc1FfcMC kmgrZsGgMzdqmlYMsHURxSs6Gclef64PKlkihe5ZjUyJv5goJAnbXrGnajZr2ggXX94o FUOlWOPynudbF8V1nvS1LdR7opzQ7KFqfphLDIZQF95hJG6WfkSlsyrhA9U5VBtA6WVh mLNznm5HW/liRRVp5Bp4bknUbVvGqD/cL1HQuTCtXbrIpSiaPq4S6WRO+GrGGtACTY+k oyT82aMKnw5l16x8Lh6ypXQn6ICjQVmHbiBJwf/N4R0IBltO2/Eiqf7d+psopmOTIWcP Br5g== 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=0+TUh1C+a2WQZAOVDg1ev1i53I0ztM+s+oValm/gNw8=; b=ZHTwdQ+5WX7vAEDOiKcdCKmEczo3g8PnPjet+xsxJ+o51g9i8qKOrcEETLW0z+VuYA vkWan1vI3slv61ALTL3TC45vfgsSECJsS1b4mEHV9zn5qCHDLuPvpp3TNC0ITU5tqp47 8M83+Q6aKV1mm6ucEtQM2jGMShdQ9lmO2D7oKATD1mbeNWpw4A02xygwsgnxkIGHlW4U O58PfKQiwGvqUtZOAL6fmLwOJu39iflgd169ioY9utdeLd7zjcHrqI8FEULAyYiFIt7b HZRtjRwiXkLgLGuQdmmmEJ6p1/d+T0bIGIZtbBDE8z2Wb12OVx0x/g8wcONGlrk1yKRf AW5w== 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 j6si9807810qtp.353.2021.05.17.22.56.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:56:11 -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]:51594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisiA-0002eN-Uh for patch@linaro.org; Tue, 18 May 2021 01:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKc-0007LV-GZ for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:50 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:35221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKY-00073T-OW for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:50 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MeCd5-1lA60l1Dkt-00bMtX; Tue, 18 May 2021 07:31:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 22/59] linux-user/sparc: Use target_pt_regs Date: Tue, 18 May 2021 07:30:54 +0200 Message-Id: <20210518053131.87212-23-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:PevIUhbPkgzvvmYLXnc/vzCw9lJf9UwmnBDWP3i6zs8mnjkih2m zUShhb+ebWxgTo4drZvpWb229YoTrsSqW61MFRwDPM+h5fubSzODyDHjwRjqqKsoDtlELiv YLRTwDq5dThm3yN00DZyU7jL2oUUNIjzlhYlV3V2yqUsapql91g4IsQ/ClGh7KSA2ZWOKzi mCZjU82rmBQlKiOhs0sQg== X-UI-Out-Filterresults: notjunk:1; V03:K0:rqJ7Ay0WD9A=:Wp6y/wVvRDXEkw3JO7+ozz 0ZVwGAf7SGjAnel98iVlLKn9IgPTHUX7w20fBFUXupKkWSu5wBerC5WoHgXH15LkYxHWIhf4l YGNgTGRucAuybus39I/N9ji6wufFch8YjVcr/42U7O7ciRHxuVwOIUdKqxFjDtwvzRE332ETi Ew1fAEUptytsNiMibNVSr4ztlUVW2HheoR9q6385HxxC5ZLy8qqjeGt6Vhk8dQ3MKqZCudtCW sfmgFQ8CJTsDl4O+Le+9meqavQdDDyYygBmZBpY+vKDP//H/ZsTnYdoXoGU5XIHFrV3wN4bRq wacGVMzxdgb/cARJoZ8e79rxvO7KOBRZcwOjOkTmGUp7YB0IJSrnQsBq0V3JfQ+bwl/vtcDf8 hkqjMbYoXZvnot1G4JYvR5WfeKnb1lBwxsYiUboxIyNFFkwJO5j3ZD9/qPMuHLtMTOKx3qpPL 4jJzL1KfmCeN5/S45Wi9tOQUhmrjJYputJgDVVmGxQMGekQcHZL/OpZ9iWwz29ceE0CcGDHya 41UTX/pjhzta+QE6gjZm6E= Received-SPF: none client-ip=212.227.126.133; 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, 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 Replace __siginfo_t with target_pt_regs, and move si_mask into target_signal_frame directly. Extract save/restore functions for target_pt_regs. Adjust for sparc64 tstate. Use proper get/put functions for psr. Turns out we were already writing to si_mask twice, so no need to handle that in the new functions. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-16-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 123 ++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 58 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 3474098641a6..0d9305818f8c 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -43,17 +43,6 @@ struct target_stackf { abi_ulong xargs[8]; }; -typedef struct { - struct { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; /* globals and ins */ - } si_regs; - int si_mask; -} __siginfo_t; - typedef struct { abi_ulong si_float_regs[32]; unsigned long si_fsr; @@ -67,7 +56,8 @@ typedef struct { struct target_signal_frame { struct target_stackf ss; - __siginfo_t info; + struct target_pt_regs regs; + uint32_t si_mask; abi_ulong fpu_save; uint32_t insns[2] QEMU_ALIGNED(8); abi_ulong extramask[TARGET_NSIG_WORDS - 1]; @@ -103,23 +93,61 @@ static inline abi_ulong get_sigframe(struct target_sigaction *sa, return sp; } -static int -setup___siginfo(__siginfo_t *si, CPUSPARCState *env, abi_ulong mask) +static void save_pt_regs(struct target_pt_regs *regs, CPUSPARCState *env) { - int err = 0, i; - - __put_user(env->psr, &si->si_regs.psr); - __put_user(env->pc, &si->si_regs.pc); - __put_user(env->npc, &si->si_regs.npc); - __put_user(env->y, &si->si_regs.y); - for (i=0; i < 8; i++) { - __put_user(env->gregs[i], &si->si_regs.u_regs[i]); + int i; + +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + __put_user(sparc64_tstate(env), ®s->tstate); + /* TODO: magic should contain PT_REG_MAGIC + %tt. */ + __put_user(0, ®s->magic); +#else + __put_user(cpu_get_psr(env), ®s->psr); +#endif + + __put_user(env->pc, ®s->pc); + __put_user(env->npc, ®s->npc); + __put_user(env->y, ®s->y); + + for (i = 0; i < 8; i++) { + __put_user(env->gregs[i], ®s->u_regs[i]); } - for (i=0; i < 8; i++) { - __put_user(env->regwptr[WREG_O0 + i], &si->si_regs.u_regs[i + 8]); + for (i = 0; i < 8; i++) { + __put_user(env->regwptr[WREG_O0 + i], ®s->u_regs[i + 8]); + } +} + +static void restore_pt_regs(struct target_pt_regs *regs, CPUSPARCState *env) +{ + int i; + +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + /* User can only change condition codes and %asi in %tstate. */ + uint64_t tstate; + __get_user(tstate, ®s->tstate); + cpu_put_ccr(env, tstate >> 32); + env->asi = extract64(tstate, 24, 8); +#else + /* + * User can only change condition codes and FPU enabling in %psr. + * But don't bother with FPU enabling, since a real kernel would + * just re-enable the FPU upon the next fpu trap. + */ + uint32_t psr; + __get_user(psr, ®s->psr); + env->psr = (psr & PSR_ICC) | (env->psr & ~PSR_ICC); +#endif + + /* Note that pc and npc are handled in the caller. */ + + __get_user(env->y, ®s->y); + + for (i = 0; i < 8; i++) { + __get_user(env->gregs[i], ®s->u_regs[i]); + } + for (i = 0; i < 8; i++) { + __get_user(env->regwptr[WREG_O0 + i], ®s->u_regs[i + 8]); } - __put_user(mask, &si->si_mask); - return err; } #define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) @@ -129,7 +157,7 @@ void setup_frame(int sig, struct target_sigaction *ka, { abi_ulong sf_addr; struct target_signal_frame *sf; - int sigframe_size, err, i; + int sigframe_size, i; /* 1. Make sure everything is clean */ //synchronize_user_stack(); @@ -143,18 +171,14 @@ void setup_frame(int sig, struct target_sigaction *ka, if (!sf) { goto sigsegv; } -#if 0 - if (invalid_frame_pointer(sf, sigframe_size)) - goto sigill_and_return; -#endif /* 2. Save the current process state */ - err = setup___siginfo(&sf->info, env, set->sig[0]); + save_pt_regs(&sf->regs, env); __put_user(0, &sf->extra_size); //save_fpu_state(regs, &sf->fpu_state); //__put_user(&sf->fpu_state, &sf->fpu_save); - __put_user(set->sig[0], &sf->info.si_mask); + __put_user(set->sig[0], &sf->si_mask); for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) { __put_user(set->sig[i + 1], &sf->extramask[i]); } @@ -165,16 +189,14 @@ void setup_frame(int sig, struct target_sigaction *ka, for (i = 0; i < 8; i++) { __put_user(env->regwptr[i + WREG_I0], &sf->ss.win.ins[i]); } - if (err) - goto sigsegv; /* 3. signal handler back-trampoline and parameters */ env->regwptr[WREG_SP] = sf_addr; env->regwptr[WREG_O0] = sig; env->regwptr[WREG_O1] = sf_addr + - offsetof(struct target_signal_frame, info); + offsetof(struct target_signal_frame, regs); env->regwptr[WREG_O2] = sf_addr + - offsetof(struct target_signal_frame, info); + offsetof(struct target_signal_frame, regs); /* 4. signal handler */ env->pc = ka->_sa_handler; @@ -218,7 +240,7 @@ long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; - abi_ulong up_psr, pc, npc; + abi_ulong pc, npc; target_sigset_t set; sigset_t host_set; int i; @@ -234,29 +256,17 @@ long do_sigreturn(CPUSPARCState *env) if (sf_addr & 3) goto segv_and_exit; - __get_user(pc, &sf->info.si_regs.pc); - __get_user(npc, &sf->info.si_regs.npc); + __get_user(pc, &sf->regs.pc); + __get_user(npc, &sf->regs.npc); if ((pc | npc) & 3) { goto segv_and_exit; } /* 2. Restore the state */ - __get_user(up_psr, &sf->info.si_regs.psr); - - /* User can only change condition codes and FPU enabling in %psr. */ - env->psr = (up_psr & (PSR_ICC /* | PSR_EF */)) - | (env->psr & ~(PSR_ICC /* | PSR_EF */)); - + restore_pt_regs(&sf->regs, env); env->pc = pc; env->npc = npc; - __get_user(env->y, &sf->info.si_regs.y); - for (i=0; i < 8; i++) { - __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); - } - for (i=0; i < 8; i++) { - __get_user(env->regwptr[i + WREG_O0], &sf->info.si_regs.u_regs[i + 8]); - } /* FIXME: implement FPU save/restore: * __get_user(fpu_save, &sf->fpu_save); @@ -267,11 +277,8 @@ long do_sigreturn(CPUSPARCState *env) * } */ - /* This is pretty much atomic, no amount locking would prevent - * the races which exist anyways. - */ - __get_user(set.sig[0], &sf->info.si_mask); - for(i = 1; i < TARGET_NSIG_WORDS; i++) { + __get_user(set.sig[0], &sf->si_mask); + for (i = 1; i < TARGET_NSIG_WORDS; i++) { __get_user(set.sig[i], &sf->extramask[i - 1]); } From patchwork Tue May 18 05:30:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441141 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1790820jac; Mon, 17 May 2021 23:02:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQnLnGmYAvxzmwPPJuGcmMQHpXWdqfsu0LXERvnDVdUhG7HqpmHEMCLkqqTHqvVxUSfX/N X-Received: by 2002:a67:fa84:: with SMTP id f4mr4458161vsq.59.1621317721964; Mon, 17 May 2021 23:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317721; cv=none; d=google.com; s=arc-20160816; b=sGsaDxSAQKW39YYNkfav6tBPpUAldYvdprpeMMdhH5i2hvCQKCPFxcZFgmryQTBZje zDkWV5kQfzlLtSvLVaVlBMmXCFKFOxhCNi+JFM4dbg9cZKEsMP6uZcGVvvCvN5V43ti7 5lgcXGn9J7Ps/LYupvGp+EJCPVwKUTvDAVgwShxSuxS+LnYDDjdIy6U704NLaKCGf1qP MnDTf15BMo2mudCPmMomddfIsm5aH2cAktJgKGYPrxCJjZwuiozHoRWQ1nEvYsU6caMN Kk/9vDtPzwrww/ypLFKDmH6RfP0LWL8JlOfsGmUuTeg/RGvhU+PNoYouJgtG8WSJmNkh ri+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=RjmzNiqX/HTvl9sPUYpG2flxCzIiFrj0/u9nqI9FbRc=; b=0OpvWHpYxaCTpurqWJGDHFEnA7NkGGjEc+D6/cZR59YVx9PSODy2QT+GPOCZB6dX5b bW+rXkvPIGslwMn3+W+XoLyau7dSWB0dHjbSfGxa40Ga0zIEKkcLzkoD1pgIHHoiBmpI bALzrPEkh9I/lpvycQO9GRHyvDs9xM+8lu+SQ1xOE5aHN1CI321924boGR0CgA+OX2kV BtBQ9aWvaNSimOo3RMGx4KcKv5npRsYaJ7e7wNuOQHVYZD9g0cdVVBdobIsEu4njbw5L sVy0iWf8HdqVwxQlO3pR/G8JiSWtj/eJkPYULK0uRdQq2hm6Wo9J0yGGtjKcIA6YpXGy UTxg== 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 x184si8840629vsc.325.2021.05.17.23.02.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:02:01 -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]:40006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisnp-0005az-BJ for patch@linaro.org; Tue, 18 May 2021 02:02:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKf-0007SF-Hu for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:53 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:53775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKY-00073X-Tv for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:53 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MUpCz-1lrMdl3Asz-00Qfxd; Tue, 18 May 2021 07:31:44 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 23/59] linux-user/sparc: Split out save_reg_win Date: Tue, 18 May 2021 07:30:55 +0200 Message-Id: <20210518053131.87212-24-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:K2qmxzMh3jHMdE92C7fZj5Oufy+9Fm/bEJ+tQggSkWkjLNtx1r4 m70N24jAF3GYddMuVcXMRoXsKiOzFBqA8vpgV2x/MRbhUsfYZ42zMBr84yI2e7QraTA33pZ 63HOyA39oIPrpmFmeHFzzKA/3qXvv0lY5xFpyo1IxOstp7kWTskDhpWNGCnC/Dw9PsLtWt2 a3wl9HazHPgdHh5pz47WQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:3y1/3yzFB44=:qDynCUmxMyFaahYlWNakRa pQyYAZ05xiiBklRvzKK6PJa4d9NW+hxTgQNXjGewkqUvcAFZhaPqX6lzi0JAC22YVkzH8Tpdm egIkKPXKukdIVLAW/WZniHMc5xAvL9GDY8RmJQE3kQoyqu1Zuz8W0km16rA6MvrHSLB+g6pEh XV9e3vwm4ZyjSXwGHFQ1ZnJNu5y0hRs5mXnRwEr2cemAXy5jOTrDzRKIolw4K7W7sq7XSgaCe A2cYosF1kPyFDNQ7YnKuPyZIgjSQ7SuJaa/YuSt7MezvxdiEhg9+C41RYtNS8F9jt8m9OHPzU +o6+EBOsdO1U2ZK3YzbwrKlXoIeQOzMyo8RGHRXrPiS1/imA0/chzqOTEkHkEeGuiGR9D1gcM HJUrmKaZTFWS3p0ZCTvtHpOII6utiUwBpRvDUBWnkhqiOmYFGuQWCBh0XaGB2mTSBUo1o3Q4V CY5Zfjjm/5xNgTZ9+HAKvDMvjeRoLi5uoGgA8UTwhgWRER+L7qJCjAa7/zVdEY3ULwikewlzH pK+pCq+YsXlIGPJBTEHzfQ= Received-SPF: none client-ip=212.227.126.131; 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, 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-17-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 0d9305818f8c..69fee5a76a8b 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -150,6 +150,18 @@ static void restore_pt_regs(struct target_pt_regs *regs, CPUSPARCState *env) } } +static void save_reg_win(struct target_reg_window *win, CPUSPARCState *env) +{ + int i; + + for (i = 0; i < 8; i++) { + __put_user(env->regwptr[i + WREG_L0], &win->locals[i]); + } + for (i = 0; i < 8; i++) { + __put_user(env->regwptr[i + WREG_I0], &win->ins[i]); + } +} + #define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) void setup_frame(int sig, struct target_sigaction *ka, @@ -183,12 +195,7 @@ void setup_frame(int sig, struct target_sigaction *ka, __put_user(set->sig[i + 1], &sf->extramask[i]); } - for (i = 0; i < 8; 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.win.ins[i]); - } + save_reg_win(&sf->ss.win, env); /* 3. signal handler back-trampoline and parameters */ env->regwptr[WREG_SP] = sf_addr; From patchwork Tue May 18 05:30:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441137 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1788304jac; Mon, 17 May 2021 22:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqzkWyxHmhmBtEW9xgzI/J1vQbNjvWEWxALHfDuP7K6UtsDvEJI/ZoQrnxxmqByfV9xtit X-Received: by 2002:ac8:5459:: with SMTP id d25mr3149175qtq.385.1621317479579; Mon, 17 May 2021 22:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317479; cv=none; d=google.com; s=arc-20160816; b=i4E3K+liweILxM5PjzrBSfUMEJp/QIFZmziq3fFDCndQvC3CHmvXZ4VNpDvoD7sLZl 4mcuWR9SE9CMQouQgMRGIJ5hVZGvLAjMfXImAIxSeSUDVMx53SvRt5PWJL0KcENj0a93 bRRasa68mHpjXrOuhOgTXJf8yUQBLjjYJkZsWAmrc6pRe5XID0fwg7xpBR+BO6RnJ3qX Ol6S4cWpegY32aUNOZQRjyLN4RB+RtSNl88E8NThgoAK95uMWT6YB51JOH+DOJNUO5FY eqDtDstVLw0g/Gxb9jYfzrCTF+J7bGC7L8VDVr4hzNDLFc1WxPviQcw3k9HUUkTCTLNZ hs5A== 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=61rFI5PKzcOz/G10Rq+BczzBIfY7SgPblFIfT5kjN9Q=; b=lw21GJiD6WfqvIueErlDJhlPjyiTVqjbYi2dp1q94vYpdCXGM/fynZPcuPM+EbhWtd lfLkpf4dYTQ0N1LKvfwyPCgiowos/wo/RBU6KioyWjGe+zcMMNUsGv8t9gssbOPpm4Td dMGdU/gykKiPbxLDr7A36q38UMdyHMZMRlTsUSrjHYwtrNgU0Opghfc309wS3gVlB8bt pmZhPNA2zSccTxKBuSA75lFDptHsGrnDP31Lj93naXksfUAiBhgKMn3qVtoIXXdbqcQH viNh7ZUKTbNVgcJCyicyYIufRDrGst3siIJ1fz3Iwt+AKYygGaZjF1PeKBaEhYO7jGS8 mYtw== 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 y11si14303960qkp.94.2021.05.17.22.57.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:57:59 -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]:54276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisju-0004V2-VO for patch@linaro.org; Tue, 18 May 2021 01:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKd-0007MV-4L for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:51 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:37511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKZ-00073e-Ay for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:50 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M4ahC-1ljQpT0i1O-001kxe; Tue, 18 May 2021 07:31:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 24/59] linux-user/sparc: Clean up get_sigframe Date: Tue, 18 May 2021 07:30:56 +0200 Message-Id: <20210518053131.87212-25-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:Y23eJeByVcdaXufsDKSY7vQTyD+/2j5XrkjWQfjC4Cw6M1UUwj7 02O84q1LlQDwiwsgq9ic0Hx9P1e7apeLMO4s7PJB/fpKN94p2WJpZElxMLxDQY1ZzereVlo 83w94LfeXNmRNxO7W/xvEuGDnwbaILGQkwR/INu1ZSQXx1LjrIVs5BbUUkKZa9ZVcmtH+eW 32MZgEbrmmBZpVt77Go9w== X-UI-Out-Filterresults: notjunk:1; V03:K0:6s7TOdQVoIs=:duT049otYUhQKW2QHHqqpE /1PtXM/U1AVCUtyAl24dCG7EzoRpqAQLsX37D5ZXviFhXW8UgBDFImJP7tyfy3Fnk0qu1lmUP 9HojYkBk+c3SNpwQT6967FUZCgBbmzqIAhT+9PzNWgYP7/cf6lvC3Y6w270MDv4YkDUizIcVN VLpFecs7gPZ4P0I+7Hs4JmBViQpuMGS2D8IYbblRMH7BdXJVVw6rUpCrLsYwMtVMRb1jAcjyO DXxHR5Nrj2zQ5CFn3QTNqvw0z7u7Rls7mamojKTGHzHphzIpZs7NtTA7qeHcb3M/MgyqKn/+t HeZllctPg4ju8niE45c/tCGQ1FrhDjfWCeV4GdeMOb2QJeuqPJlg44NFG5C5VwDbuwWOuJAP/ F+6hPThqqoye9/5DmBzPn6fht/ZiUo51GGCkHuGpSqMgsDI2/W/COLuXaV0iVCStFXYdzCtLV ic1QGiTTZsdQeUCinHdvARRU7ijHkiHKoG33C1sumVFoBX86PV9J/FfGOH9/jiLS3QZvfyfIk TImgco3EmrLj2/NMHd3r8w= Received-SPF: none client-ip=212.227.126.135; 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, 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 Remove inline; fix spacing and comment format. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-18-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 69fee5a76a8b..57dbc72c9949 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -65,24 +65,25 @@ struct target_signal_frame { qemu_siginfo_fpu_t fpu_state; }; -static inline abi_ulong get_sigframe(struct target_sigaction *sa, - CPUSPARCState *env, - unsigned long framesize) +static abi_ulong get_sigframe(struct target_sigaction *sa, + CPUSPARCState *env, + size_t framesize) { abi_ulong sp = get_sp_from_cpustate(env); /* * If we are on the alternate signal stack and would overflow it, don't. * Return an always-bogus address instead so we will die with SIGSEGV. - */ + */ if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) { - return -1; + return -1; } /* This is the X/Open sanctioned signal stack switching. */ sp = target_sigsp(sp, sa) - framesize; - /* Always align the stack frame. This handles two cases. First, + /* + * Always align the stack frame. This handles two cases. First, * sigaltstack need not be mindful of platform specific stack * alignment. Second, if we took this signal because the stack * is not aligned properly, we'd like to take the signal cleanly From patchwork Tue May 18 05:30:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441138 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1788691jac; Mon, 17 May 2021 22:58:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyouZvEmBiFcOTAQxXnmAtLsTalic5cjxcIHbg2MWCCkjqmF6LSwFcL38gOyvJT7lAZaING X-Received: by 2002:a05:6902:1006:: with SMTP id w6mr5360577ybt.223.1621317527038; Mon, 17 May 2021 22:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317527; cv=none; d=google.com; s=arc-20160816; b=CnIOxq4uMFR0CgFhfplccLz6MjmHUAIuXHDDj3B31PtWYbxW5qJgTT67EQbcmxkziH AUsQw/37D0f2FvSbliD3feEnZgENZJaA+qcPwJlc56RaMZTv+xzDIjzIh6XFQ+ZKnVa4 lGRcmyjEOd+fZKsWiPe+0jJwfI+lFU/Zfk+YnspZwbM5QGG+G7H3l9CQ8Nkoc4c48/Op 1+oGb76GsSRVLDw47TtOYt9nLZ6NPyYZ3F1xg3+u7BrzELB0dOsEaqdPvnj2PkwicBAO JAVCdwLwBQptJF+RD3tRnMFfA5QPH6UzbYfUzA2IRT6pY+o7y3f4pwZdZdCBULx+0wlY nOgg== 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=KdCF+sOIW28MolcKmvk05rGa06IyHCSU5nYcZ5mIZr8=; b=WAI+7yJVQpkFXooofc4NVba6QnAtj/W0lJduMd9h18AdIfDXHcrptuRBb0/YuHUiD/ 83YCWeYpTsbteDxAy9NG3Efzz+YQg7UrO2iDHFYrE0F2psVWZSxSlXMBGb5FvqNmEFPW DW+Q+gLYYvdmXvHOQWnZk/NzXbcTHwa5iKnP+Ja0U0nPmIwuNAAVDkS/fZCcYYXgQ2qo 9ChVYtYkzgOvZbc0OgFyD/0TxyNW7Y4BUzLEiAhlt/AE/ZRPwo3j8yQkQh70ndFIakOC GP0FSpent2bypvdgTX7Vs128nlFtq+W21VRR9TFmtSCvQh16wtGUBvUKuFm/RyHQZ/dO dQ6A== 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 m199si18119649ybm.126.2021.05.17.22.58.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:58:47 -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]:60074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liskg-0008Rg-Ff for patch@linaro.org; Tue, 18 May 2021 01:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKd-0007N3-GL for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:51 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:46909) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKZ-00073t-ME for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:51 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MRC3Y-1m5tMj2TrQ-00N9jU; Tue, 18 May 2021 07:31:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 25/59] linux-user/sparc: Save and restore fpu in signal frame Date: Tue, 18 May 2021 07:30:57 +0200 Message-Id: <20210518053131.87212-26-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:MrodjR0SfSHrd8asxsNpQjYphJC2m2oB8vNj/1K4zZo0gADjW7K nUc8WXBADfK3njGUC7adRCS4sHs8NlKKQTJWEudMwp3zPLx5fnya97f2e0T/Z3bqM70CxCf fkp+twXMKz9TVuPxKLRLDInpXElwC11lM25QvcL5RJehR0H34ew7EGmu96NpW82RSuZf3Tp 8v8oQQ05dcmpmT0iD9cAw== X-UI-Out-Filterresults: notjunk:1; V03:K0:/RZ1JrAKCAQ=:i13FlK6h8m5XVQlSg+vm9m honIXXTU1bBm4PPW9qK0H284z/kNhley3aIEBKNKT1+n7TiLyEbJkWVZWME0i9/dDghvs92DA s39hRZ5xHHZZQ51j63SlhfqpASxbQWWjYHxOxv5ezqWb3ohHYCZS7yLj1IaHZal7lEnJN5ID6 6a1iITV44CdjIHXyDBeZC5pel2Fm3otSQvkobQOMe7anWeESJHMzME4FPuevDKJPGGGDlgiY9 uWUaw+hfiX42VdOyJ6B6nna+y0LnQaWFJEe1c9ZRr8ARVXGu1B7saRJS7Pw8UNfWqDeWgWsO2 qwt/cKfPm+dwQfhnuIofbfMxiroMZvXkr/OKyCPPZpe6Tpz6APglLVteV1rbqDegqaU91GX8z 2yVzw5Rb4W9Ce3EE0MGLWUHkk6cycYijvUd8sRJDfdcKME7uJXLuVgLhddtebhYjkpNTpD2Lh En2buklbDjZZ/mp/3jlt3ptCm3iuJ2k4bsxsi74K0yD5RB5X1cUyNR3kIOMPTGc0qX9VIWxtj l+6ZlHv0U2cCX0nk6ohWY0= 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-19-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 84 ++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 33 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 57dbc72c9949..59bb4495121e 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -43,26 +43,25 @@ struct target_stackf { abi_ulong xargs[8]; }; -typedef struct { - abi_ulong si_float_regs[32]; - unsigned long si_fsr; - unsigned long si_fpqdepth; +struct target_siginfo_fpu { + /* It is more convenient for qemu to move doubles, not singles. */ + uint64_t si_double_regs[16]; + uint32_t si_fsr; + uint32_t si_fpqdepth; struct { - unsigned long *insn_addr; - unsigned long insn; + uint32_t insn_addr; + uint32_t insn; } si_fpqueue [16]; -} qemu_siginfo_fpu_t; - +}; struct target_signal_frame { struct target_stackf ss; struct target_pt_regs regs; - uint32_t si_mask; - abi_ulong fpu_save; - uint32_t insns[2] QEMU_ALIGNED(8); - abi_ulong extramask[TARGET_NSIG_WORDS - 1]; - abi_ulong extra_size; /* Should be 0 */ - qemu_siginfo_fpu_t fpu_state; + uint32_t si_mask; + abi_ulong fpu_save; + uint32_t insns[2] QEMU_ALIGNED(8); + abi_ulong extramask[TARGET_NSIG_WORDS - 1]; + abi_ulong extra_size; /* Should be 0 */ }; static abi_ulong get_sigframe(struct target_sigaction *sa, @@ -163,33 +162,51 @@ static void save_reg_win(struct target_reg_window *win, CPUSPARCState *env) } } -#define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) +static void save_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) +{ + int i; + + for (i = 0; i < 16; ++i) { + __put_user(env->fpr[i].ll, &fpu->si_double_regs[i]); + } + __put_user(env->fsr, &fpu->si_fsr); + __put_user(0, &fpu->si_fpqdepth); +} + +static void restore_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) +{ + int i; + + for (i = 0; i < 16; ++i) { + __get_user(env->fpr[i].ll, &fpu->si_double_regs[i]); + } + __get_user(env->fsr, &fpu->si_fsr); +} void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; - int sigframe_size, i; + size_t sf_size = sizeof(*sf) + sizeof(struct target_siginfo_fpu); + int i; /* 1. Make sure everything is clean */ - //synchronize_user_stack(); - sigframe_size = NF_ALIGNEDSZ; - sf_addr = get_sigframe(ka, env, sigframe_size); + sf_addr = get_sigframe(ka, env, sf_size); trace_user_setup_frame(env, sf_addr); - sf = lock_user(VERIFY_WRITE, sf_addr, - sizeof(struct target_signal_frame), 0); + sf = lock_user(VERIFY_WRITE, sf_addr, sf_size, 0); if (!sf) { goto sigsegv; } + /* 2. Save the current process state */ save_pt_regs(&sf->regs, env); __put_user(0, &sf->extra_size); - //save_fpu_state(regs, &sf->fpu_state); - //__put_user(&sf->fpu_state, &sf->fpu_save); + save_fpu((struct target_siginfo_fpu *)(sf + 1), env); + __put_user(sf_addr + sizeof(*sf), &sf->fpu_save); __put_user(set->sig[0], &sf->si_mask); for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) { @@ -226,7 +243,7 @@ void setup_frame(int sig, struct target_sigaction *ka, val32 = 0x91d02010; __put_user(val32, &sf->insns[1]); } - unlock_user(sf, sf_addr, sizeof(struct target_signal_frame)); + unlock_user(sf, sf_addr, sf_size); return; #if 0 sigill_and_return: @@ -248,7 +265,7 @@ long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; - abi_ulong pc, npc; + abi_ulong pc, npc, ptr; target_sigset_t set; sigset_t host_set; int i; @@ -276,14 +293,15 @@ long do_sigreturn(CPUSPARCState *env) env->pc = pc; env->npc = npc; - /* FIXME: implement FPU save/restore: - * __get_user(fpu_save, &sf->fpu_save); - * if (fpu_save) { - * if (restore_fpu_state(env, fpu_save)) { - * goto segv_and_exit; - * } - * } - */ + __get_user(ptr, &sf->fpu_save); + if (ptr) { + struct target_siginfo_fpu *fpu; + if ((ptr & 3) || !lock_user_struct(VERIFY_READ, fpu, ptr, 1)) { + goto segv_and_exit; + } + restore_fpu(fpu, env); + unlock_user_struct(fpu, ptr, 0); + } __get_user(set.sig[0], &sf->si_mask); for (i = 1; i < TARGET_NSIG_WORDS; i++) { From patchwork Tue May 18 05:30:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441139 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1788961jac; Mon, 17 May 2021 22:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCWPPWwWV6n+nzWDaIIDzTAYwbKdu6gJrfUO2Q/elW5/YuoKysKo9NaCtwyKhENKll3+z+ X-Received: by 2002:ac8:108e:: with SMTP id a14mr3125429qtj.28.1621317559743; Mon, 17 May 2021 22:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317559; cv=none; d=google.com; s=arc-20160816; b=EdJmbPp4lSIF99oO0MLdmwfYDid2eBj0DaMfgVxQzbqcRXMsE8xPAndDe6PpZ/Ecad JlbLy1jVYG1sh/a90zFoyOAr6erjD9y9+xU51ytq071xK78sb4ay4eQE5Hldr6MkLjb2 /RDu6sHTzro5Kyvjw4Bg91wjbacdBQm+0vPK9XMzSKpUqhK+RX/9oksh+c1lUqid/1L3 w+AZlkJJoE4+vhXHkAZy7lUK2miHkghd6iyf95amwh8hORseT1f68WEZSjmSpQrkmTnO oybG1VZ3CiH9zepXDV9/fv0Vz/eMSCx25lxVEXCLVB9QuMtJplxDRQykBNLaJMbAkseA kJKA== 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=BB/2J3+06BdIrB+lW60VLV+vXyqThCXXIkncBvbmPcM=; b=ysT91Nvqp56fKxlavXzfKXHzW3a2l/BgPAUh2U5b5MtCsH2NogJN854/StRw+iPe/k dtVOuS+u2VHlsV0gc0tl4owmziriIpkdDAr6vwOXpa7PqcFYF8jj9aCDyG0sqzZOZ0IX StBEpvSx8DYEGX0EXPfvxx57u5HZZXRsM2IDc8r4IfX9XQLyfL72jJ2Qs7y7jfaDsay/ 77xUrBztEGYC71U34+rcIMNV2631PzhTHrMtnsZqGHv4U/LKvqPQ11UI6GryGmog4zbK c+HChjPtIP5V58OmkLAYmEmnIJIbUC+wfgOQxXlwgGyoV1uq+amS/OBykT+JHkC9ogUz JJaA== 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 q10si14133254qvh.157.2021.05.17.22.59.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:59:19 -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]:34250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lislD-0001eC-6H for patch@linaro.org; Tue, 18 May 2021 01:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKd-0007NN-QP for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:52 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:55627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKa-000748-8K for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:51 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MFKbB-1lgQR90nUn-00Flr3; Tue, 18 May 2021 07:31:46 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 26/59] linux-user/sparc: Add rwin_save to signal frame Date: Tue, 18 May 2021 07:30:58 +0200 Message-Id: <20210518053131.87212-27-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:qYmK0xUYuefZzH0MoLWsHZA4pHRgoMrIzl1AqxqvLQrdwW102mf qKm3oHhZpf7PApBYYFUJzZ4u4mLlG4XvqjYoYpvlamziDGO+RWH1elC0cI1D55OaqsHShI2 AKLxeDmqPF0Glz4WdzzXQGLsuMXAqz9/B82/l+Fy+xWvTs9/NTT78ziZ2itzqsuTAve8JWW 0r3Q80GAkwjFrh7Og983Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:Pzp3nhEHQUg=:c3+smK89o9oAZLxyN2JU8e QXMH8y4dM6v4lTvtAvRQHIrhnZrbje0Z04Swmj9Rvs0kYihqran5v2op38cvQIRxVGrH07EjK 74KjgVAX5LcqEpPbRukuAnAfCL1A+SaCgHp/wprdRgsf/KH5cNjhgmN2CsXtYfS+fOIJiTXGg SBMOpmFzHRY9NqnpxZKuDBH4jOwkqBUZacdGis5OGqZ5ALvc1HxNI9qPKHj8vqXMzEnxHHpmO 4InASAmAHqBb/h6c0AyprVLsIyl/ESQp/V1KjkO0P44u+rGfoD3aTX7w/Sz1t3tcaukc8MHTx nv/0sDW4H0rnuDVGNuwlDRgiPWe9A0NuEk99fv9b+yiBO2fZ10ydf2hykgTwOvdVIhR/fSPsh uA9OnJyKCF2VjU1axXcL+TTaGdVabuoyzXDtzUCzHSJaYsdQh0z7xgRiMm6wNbBBIa1THjgkd WutCHaXrVoHJGtn6CBBkHSNKWfGoUedEINJNwLY7h/LjN2wBfGKjxhkfidEJhsW2IXly2NjDT nK0M5q3lRJiijN+Ve66KTs= 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 Stub it out to zero, but at least include it. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-20-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 59bb4495121e..4a0578ebf37b 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -62,6 +62,7 @@ struct target_signal_frame { uint32_t insns[2] QEMU_ALIGNED(8); abi_ulong extramask[TARGET_NSIG_WORDS - 1]; abi_ulong extra_size; /* Should be 0 */ + abi_ulong rwin_save; }; static abi_ulong get_sigframe(struct target_sigaction *sa, @@ -208,6 +209,8 @@ void setup_frame(int sig, struct target_sigaction *ka, save_fpu((struct target_siginfo_fpu *)(sf + 1), env); __put_user(sf_addr + sizeof(*sf), &sf->fpu_save); + __put_user(0, &sf->rwin_save); /* TODO: save_rwin_state */ + __put_user(set->sig[0], &sf->si_mask); for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) { __put_user(set->sig[i + 1], &sf->extramask[i]); @@ -303,6 +306,11 @@ long do_sigreturn(CPUSPARCState *env) unlock_user_struct(fpu, ptr, 0); } + __get_user(ptr, &sf->rwin_save); + if (ptr) { + goto segv_and_exit; /* TODO: restore_rwin */ + } + __get_user(set.sig[0], &sf->si_mask); for (i = 1; i < TARGET_NSIG_WORDS; i++) { __get_user(set.sig[i], &sf->extramask[i - 1]); From patchwork Tue May 18 05:30:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441125 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1779247jac; Mon, 17 May 2021 22:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwpdlUmo2VePVaOiZ+BxMsp44yyA43P+A3bAPTCDDZQVEbi+gw8jXfQc3AI3+7z0+xUR93 X-Received: by 2002:a67:e95c:: with SMTP id p28mr4623982vso.39.1621316565723; Mon, 17 May 2021 22:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316565; cv=none; d=google.com; s=arc-20160816; b=VaUN49+W2B7m73UKsr3Q9o+7AxoUyZJ11CxnTQqPRC3cNV2Io8ihZhLrlP30v7Jydx f9ecuJGItA0KbKk/4l0M+CsTbdMoukr5bRvQ3WdFeHsXxJZwQm6qAL+ETAhjrVabSxMR BsaFmjGZ+QgS2kSND+gcEAPzqRQbKxLRj/lO110a788hFFBjzxTb19GmbV8PmzrhJrj9 uS2+yeYfhpqfzgZZmmRs0fFv9vCOTrMpnLtZcxSYi5IiloSizQJ645mUQXgv8cgm0DRF bKtAgdAy1SnC0Npu1Oa8X2zAGdbeh3fDa2EK7aPyHaXo5lxddnvBzzcKXXD3VnZQ+p0H QMFA== 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=kT/iDkD8mVwazS6sVSHV9ZY3eKN00k4pOg364vqPGJ0=; b=00aBVVGxC5anMZs4LGNm+lA6EAplyMie2DxtCgu520ccCDk7LR3bQ4kvmxJZqEESpF J4MRHbpghEOo4rq2iyo8/VegXMlhiGqPzduaW7CpUU1OxF/khYjFfsmW5SDt8R5zcywt yyh6lnGOSzXR60PSzPcIRb5T9tfBzrWFNXcVgnOkJmvwjp3OnWigk6qDJs3SC5odI18C RTGZp+89w1pAbEUYxF95l6q419bpWMwKlQm65HYkDRUazOD74ftouW/mZatzbhBkSxXR 7SAK2IaA7v6JUpeaPpdbuYqRQtUqWCTpQzSYmb6AJsf8K6ZrvXgUfE2WX2vduwBtSwqA bRXw== 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 p16si7970760vsm.162.2021.05.17.22.42.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:42: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; 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]:45606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisVB-0004dg-4M for patch@linaro.org; Tue, 18 May 2021 01:42:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007Yo-Qw for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:01 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:35237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKb-00074f-3d for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:01 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MGzI3-1ldfXt2ohH-00E6tT; Tue, 18 May 2021 07:31:46 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 27/59] linux-user/sparc: Clean up setup_frame Date: Tue, 18 May 2021 07:30:59 +0200 Message-Id: <20210518053131.87212-28-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:O6o4lxWFP6lgjUZn8R2ul7q8ED1LuM6zEnjgHOMBjRMIiINHwWz s+idrNuDzMsCUdM8zL8+eNdITooqw4kMkPpWlVgz8WTHDBPUbljdEmy6sigbO68hxPyGq6t vAYznLtEQNYk6VNi/AZWSQnvHzDAszi4OAe65W4f8xvOxsdbmgcmuqo6oF6rJSrAg/TgLlW +ACp8dutIpvmWTzFx9IkA== X-UI-Out-Filterresults: notjunk:1; V03:K0:oWf+8smovsw=:DIqaO+yPpfPgLa2M9vghta GvYaIcl06pA8upASCWVEbelguXBW7D+xPGdKDfzBuaFBno/kFYIo54xRctj47ln0iGvdQFgky BSt0CISVraT6iAVjFOsqPvuu0Z8wvLydqwJ6fFLtY06hh6PRRsBbQmUPs04ITZZjxHuB9pYfE uOZi+a94k5shf9iDq9g2pDDj6lcVlCg44xDtmm7Tljs0AhMNKsJFFNDRO0/NIPpMf2x58CkPG PD+TXgHahFb0k4osrunhk5MdEbg/Gc3ybHFPRbg0w7Bb0Irl80pvtuGsvIeO9eXUFWZV+YpPd NZcaxpaEid2YX7u1CURFxsrP7VtT/Gij0r/w1yxvVS7H+ONGQMlmIrsHG2aKziSkRHUTYQSSS jg4NL9iY8hy/hjqrltrv+zb2gWgu7yP3EU0qnavIkG6JKUx5oHBksPWe78fQTw/z9TKskDSiu EM0cY4CVAnbzF2R3tlBi31INotEF4L0tUvnc4onglADpjNrGrgnQqXbJFHQBTa9oY/oFIIudO 3q4dTqFsVW/uipvhTncW+g= Received-SPF: none client-ip=212.227.126.130; 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, 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 Clean up a goto label with a single use. Remove #if 0. Remove useless parentheses. Fold constants into __put_user. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-21-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 4a0578ebf37b..f0f614a3af7a 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -192,14 +192,13 @@ void setup_frame(int sig, struct target_sigaction *ka, size_t sf_size = sizeof(*sf) + sizeof(struct target_siginfo_fpu); int i; - /* 1. Make sure everything is clean */ - sf_addr = get_sigframe(ka, env, sf_size); trace_user_setup_frame(env, sf_addr); sf = lock_user(VERIFY_WRITE, sf_addr, sf_size, 0); if (!sf) { - goto sigsegv; + force_sigsegv(sig); + return; } /* 2. Save the current process state */ @@ -228,33 +227,21 @@ void setup_frame(int sig, struct target_sigaction *ka, /* 4. signal handler */ env->pc = ka->_sa_handler; - env->npc = (env->pc + 4); + env->npc = env->pc + 4; + /* 5. return to kernel instructions */ if (ka->ka_restorer) { env->regwptr[WREG_O7] = ka->ka_restorer; } else { - uint32_t val32; - env->regwptr[WREG_O7] = sf_addr + offsetof(struct target_signal_frame, insns) - 2 * 4; /* mov __NR_sigreturn, %g1 */ - val32 = 0x821020d8; - __put_user(val32, &sf->insns[0]); - + __put_user(0x821020d8u, &sf->insns[0]); /* t 0x10 */ - val32 = 0x91d02010; - __put_user(val32, &sf->insns[1]); + __put_user(0x91d02010u, &sf->insns[1]); } unlock_user(sf, sf_addr, sf_size); - return; -#if 0 -sigill_and_return: - force_sig(TARGET_SIGILL); -#endif -sigsegv: - unlock_user(sf, sf_addr, sizeof(struct target_signal_frame)); - force_sigsegv(sig); } void setup_rt_frame(int sig, struct target_sigaction *ka, From patchwork Tue May 18 05:31:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441118 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1776177jac; Mon, 17 May 2021 22:37:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbCIIXW7QS2KwKWN+vdRk8LuQl8W0UxXBf6XX2fZw+9hsGP0kFOgK/Aqzt0KtFx6VjlyOg X-Received: by 2002:ac5:c9b0:: with SMTP id f16mr4322375vkm.24.1621316259693; Mon, 17 May 2021 22:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316259; cv=none; d=google.com; s=arc-20160816; b=ZiccejKE8odjvbeMtLkxgQygHxKeHpnM+VPUsMl8+pbOGCGjdDJv0yGwxbhh88Aave rBtY7UAO/QCUZRwCNRfCqH1UchMphKzbseTcMyTC4Ve0e0Zch6aKxnMD/6vgOd1io9qw ENCtPKlB1iuCgWTx9DRN50AUWebUhSnWhlEypfVwwT6rK2xzgUabYILimoaCGUcj4dhd 4PKSw4yB7+479BAe6Ot9i0aleJvlpKKYJValeoxJkjlPatY8pgqlAtvTW8ZdtDlFPkF3 ntQSxddHbfbJt24N+qd+BpGnheXksJ4OXNIBPP28PGqr4XtIcZ01972L9/VuSZSw7vfc YhhQ== 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=Rlr/DM62R3JCOLmfPXiwLKsg3SOAqgxLEh3i2J9Q6AE=; b=FxQ6vOaGQj9e3lVFsVoe/HnuuO7iQpMGPeN/uDmsJrKYUUxTsd7SqBUYMLNDyddGCF pvH5MjkW949alQwi/BZ+R11YM8dofvWN9fmtO/49VrKCH4z3QCtD5AcqSfhYoCc3/T3g 1KdPUmtiW1A6XHy9J+JaIW76pZUObtg2RtEzWXMbkzCHKZynmY+0wRNW8PMbkcsyxn5P G2tbOtJl/ip4re09NktUJDOlDXPd4V6dujxyWXv4qglECOhysteZ5pt84IyrlEhCG0Vy g+EaD9dQ85i6Jc1RrfVx/2p7XR2sWwri+HWSCjMMUCz4urWf/0/kCDCsb1RyUiJRNnsv vwWw== 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 b24si5916675vsj.415.2021.05.17.22.37.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:37:39 -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]:36626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisQF-00070Q-2d for patch@linaro.org; Tue, 18 May 2021 01:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKe-0007PV-Tc for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:52 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:40141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKb-00075J-Jk for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:52 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MgNQd-1lGgeq0o7b-00hzfn; Tue, 18 May 2021 07:31:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 28/59] linux-user/sparc: Minor corrections to do_sigreturn Date: Tue, 18 May 2021 07:31:00 +0200 Message-Id: <20210518053131.87212-29-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:BFI5rHXYAIEDrRze942IqTicXNlMq9tNE+BxoP7KZFzabJYepyB +brjGrKOoVLssvJr7A/pyNbEF8sRpsmWUr5PB4aFlvTmqVWXRp/VvZGH0i5hg/3J0l3gHmx 802XSW+Fad/CCd423YjxHXx4moTWnPHqeiMkT18ewpGxAlaDttpkmKSr1bBCpeTSGN7OrId HeBvU5aP/jH7phxIQzKeg== X-UI-Out-Filterresults: notjunk:1; V03:K0:FRzrQkrgFgQ=:HC5I7Ol2cTI2lrPl0TjZTo XfHe5mgFt0aHFGAalVVEj4+febFF6vmpx0T2gM46p6+JPlyhG7md/DbylvjibfTzGzvnPkMu8 bbTv7yhUDHYhYiesvIfD3/Uw/TgHufj5KCttjBc8KigLbIY+WVBFb3LiEAySCSEfHAkb5iHF2 hBaX6s6g7lPTI0/auuDNEKQsINL6YtT8hyX6+XgB+zEjW9NcwMRmwwZuQ9hvxLlHi2P0rOKSU HHkA2xtZU99yNRKRyCHQpsdSk52B65ayG25eScJkrDLjngoRgCZpT4hoO+IcIqiSxHTxtDoId J8zJzi0qbhlnukq5b9gySFvCdaJZxbzDLr+CAmtILFkyAGCHbK4qMxn/sB2Cywz2GIPGLZ8Q5 HgBu7VxfcHyw3yyvwZ9x8bgrZMQVNpjK+/S+Jg4YMKr1dRy4Kl1EO38RjJ+bwcDjnQbAhm/0q Dc+RFMRY0uyUgyc9hA0ZKtclma+QJu1mvEHbARERzQ2ylQAVM+SDjzBIbzy7WhrEReJMAYxxt VRORaMds5uaEGfX/zl//uM= Received-SPF: none client-ip=212.227.126.187; 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 Check that the input sp is 16 byte aligned, not 4. Do that before the lock_user_struct check. Validate the saved sp is 8 byte aligned. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-22-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index f0f614a3af7a..0ff57af43d1e 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -254,7 +254,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; - struct target_signal_frame *sf; + struct target_signal_frame *sf = NULL; abi_ulong pc, npc, ptr; target_sigset_t set; sigset_t host_set; @@ -262,18 +262,21 @@ long do_sigreturn(CPUSPARCState *env) sf_addr = env->regwptr[WREG_SP]; trace_user_do_sigreturn(env, sf_addr); - if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { - goto segv_and_exit; - } /* 1. Make sure we are not getting garbage from the user */ + if ((sf_addr & 15) || !lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { + goto segv_and_exit; + } - if (sf_addr & 3) + /* Make sure stack pointer is aligned. */ + __get_user(ptr, &sf->regs.u_regs[14]); + if (ptr & 7) { goto segv_and_exit; + } - __get_user(pc, &sf->regs.pc); + /* Make sure instruction pointers are aligned. */ + __get_user(pc, &sf->regs.pc); __get_user(npc, &sf->regs.npc); - if ((pc | npc) & 3) { goto segv_and_exit; } @@ -309,7 +312,7 @@ long do_sigreturn(CPUSPARCState *env) unlock_user_struct(sf, sf_addr, 0); return -TARGET_QEMU_ESIGRETURN; -segv_and_exit: + segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; From patchwork Tue May 18 05:31:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441116 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1775435jac; Mon, 17 May 2021 22:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGQAvww0z/v5rhjLr1ltEz/p8vWV0vZgMQjjG5sIKS8XvIR5fO2IkzIbkqDQWJ1GLnPk+7 X-Received: by 2002:a67:7912:: with SMTP id u18mr4377516vsc.12.1621316188046; Mon, 17 May 2021 22:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316188; cv=none; d=google.com; s=arc-20160816; b=Fj0hA5cBfwH5G5O9ScI00KAOGodSdxsbDkhgHPl6RLGaeOWXrJlrkQLW9F6Cvq+ogA cyGrSikCBSfR8c3OyeOvNYgJM77OdDF1BtZjZhQ2pZuFVjb97QCVu+a73OHqQEZKALI/ JjYKpTFCF/OcgoO5RKNFBd7d0tsjMFQsjIAJJ27B1KLDS+yWUzaXqLwixMjFaqsAOqI3 3jm0fEHWxaZslYaf+I59ac6W5/4mzsSq89te6eJOsy8I4nyUCMm99jgCStmdeqibx0Hq KScSb7IGtrlFwvheh0CUsazBbbPuQoIFwB9UYCVN9+4Si/gcJC3GpyxapY34ggKC/6jM dkpg== 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=A2nc0rX1Iqy4HRlYvwf20T8jLafbFovSTexElWk5DLg=; b=0GFgZbaMid02XHg47MzrHb9zG+zo6z8AJ27Op51Zw46mIiiijtKe2k7p7fmZZHmWEB v5JN+ZpLrFzmbSjfsIfFPRV7uhqvS/ZvpCRdn6cNmikVHdMxXQJMvAHUx4l2h4E+kN55 +pMCjoGRGamXpUcfyd0NsgedTrS/sMUvBporYNlQzGbqlZJrjp0NPptE7jmfTnDfyrwW XR1uu0NFVxNzLRbgUkHW5Z+lcwugngdoJ3Zps9Cwt6bfCD9Kyzorduv7nnc3i/tBPsQ2 1EhdMhjBUsTxIRk9eBo7x6D1uCvlz54n4rLhGxf7c/+9aq5vsey+Po34mjWCVhQ+8mJn YM6g== 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 r4si980413uap.182.2021.05.17.22.36.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:36:28 -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]:56398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisP5-0001Nt-Cn for patch@linaro.org; Tue, 18 May 2021 01:36:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKe-0007P7-QY for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:52 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:54723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKb-00075g-Nl for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:52 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MFbBO-1lhG3B2ays-00H9AI; Tue, 18 May 2021 07:31:47 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 29/59] linux-user/sparc: Add 64-bit support to fpu save/restore Date: Tue, 18 May 2021 07:31:01 +0200 Message-Id: <20210518053131.87212-30-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:kbm87H6GosaiRgNfHBPWWlsPUgW5jJAWAt8CM7dvKd8pnjCOOo3 4fbBeyGomwdL0YfmPPDQRpu1i5UrKkY+5Frg0+PtHXfY2CZizY0XRrB9MidXjEamq3CZojr zb4HKD0+pFxCbNC3PSjB6dNlJHH72FnIL/mWmF5baWqzcRtUR61jFQ0Ry3BaE4OH/+smadM JQMBvK37/W46omGgx/Ocg== X-UI-Out-Filterresults: notjunk:1; V03:K0:nppYtzIi45Y=:f8HQUzN/s2J0+LgxIg88ZA ctIibT7A7SintwICXViQb7QjD4ckUtrmmgN9uoJnhPUS1Oz0zVB34pFl+7WAcsjgthiMUCc4O KafOLDDyLru7RqUzTD7BVH4MPDewP+TTAExMEPgGBOVlO28jNn11gS6G1EKoUxUSGGUfMDdkw EYcKTJpeVupvqFVSuvDb3VDYp1Ott4dEhI7WSN79HjCzJJa4d4Wvc0cw3ajcy3P1EnhKUT43f F90kXdbfUkmVzyiX4mXYZd5fp1afUqJLomQ0+6QsBKXGoQNELG5gf/XiN3QS4q8SH9CVPUOpy a70mpudWDA3cUF+AhARdL5CPcFV5U83eMbot9kX8CD+old1N+jXFkIUF+B/W1WPq1v+6fzCfZ 9MtbTy0ug078g+zY+7+s4Y5eD5Mhe4DST5xZ8Hd7/i7VCvF+ZTivjf0L8gT6hiI/TzmkmZoKL ZJthaabq0taY3Pd9isIXYyhPo+EZsgZsBYBpSJRzNNsdnccJVLr19ZkCO4stSJ99nhKDqIDPl Pjq/bN+6rEs1Udsf+TiZBs= Received-SPF: none client-ip=212.227.126.131; 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, 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 The shape of the kernel's __siginfo_fpu_t is dependent on the cpu type, not the abi. Which is weird, but there ya go. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-23-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 0ff57af43d1e..41a8b33bac3c 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -44,6 +44,12 @@ struct target_stackf { }; struct target_siginfo_fpu { +#ifdef TARGET_SPARC64 + uint64_t si_double_regs[32]; + uint64_t si_fsr; + uint64_t si_gsr; + uint64_t si_fprs; +#else /* It is more convenient for qemu to move doubles, not singles. */ uint64_t si_double_regs[16]; uint32_t si_fsr; @@ -52,6 +58,7 @@ struct target_siginfo_fpu { uint32_t insn_addr; uint32_t insn; } si_fpqueue [16]; +#endif }; struct target_signal_frame { @@ -167,21 +174,50 @@ static void save_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) { int i; +#ifdef TARGET_SPARC64 + for (i = 0; i < 32; ++i) { + __put_user(env->fpr[i].ll, &fpu->si_double_regs[i]); + } + __put_user(env->fsr, &fpu->si_fsr); + __put_user(env->gsr, &fpu->si_gsr); + __put_user(env->fprs, &fpu->si_fprs); +#else for (i = 0; i < 16; ++i) { __put_user(env->fpr[i].ll, &fpu->si_double_regs[i]); } __put_user(env->fsr, &fpu->si_fsr); __put_user(0, &fpu->si_fpqdepth); +#endif } static void restore_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) { int i; +#ifdef TARGET_SPARC64 + uint64_t fprs; + __get_user(fprs, &fpu->si_fprs); + + /* In case the user mucks about with FPRS, restore as directed. */ + if (fprs & FPRS_DL) { + for (i = 0; i < 16; ++i) { + __get_user(env->fpr[i].ll, &fpu->si_double_regs[i]); + } + } + if (fprs & FPRS_DU) { + for (i = 16; i < 32; ++i) { + __get_user(env->fpr[i].ll, &fpu->si_double_regs[i]); + } + } + __get_user(env->fsr, &fpu->si_fsr); + __get_user(env->gsr, &fpu->si_gsr); + env->fprs |= fprs; +#else for (i = 0; i < 16; ++i) { __get_user(env->fpr[i].ll, &fpu->si_double_regs[i]); } __get_user(env->fsr, &fpu->si_fsr); +#endif } void setup_frame(int sig, struct target_sigaction *ka, From patchwork Tue May 18 05:31:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441122 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1778231jac; Mon, 17 May 2021 22:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUbg4vNq0F0RK2xzsUfWlcBOW/nm1jG/JRwhGD1i3jly+9MjTSeSMGp9wwgZVAXiedM2xD X-Received: by 2002:a9f:368f:: with SMTP id p15mr4599285uap.41.1621316468703; Mon, 17 May 2021 22:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316468; cv=none; d=google.com; s=arc-20160816; b=j/9BZmr4/9we7TA4MZ4u0p0X7KpGDbPQ9t4J3lxOC0QoE141O84Pza58dkp2dEHH4i 76cunKe2qMzwGUZNtEaXw7uXEEZLtohTz7xsCBnYpjXy0cBlRuwaoMIsWR0/btstrbYW BeIRxg1Vg8e4xmTk6I7VFucJgcyMoZv50nl8lQXZHLXn41oNSOpRWQRe2SlJrxh26Y9b iqwyoz1LjtjjY8FZNFVNli1S4w/F28Wh64XpcAaUUAlsDmH/A/4a3plHFZvraDx1QkI0 r3GF/2tMDGW0YKtno5oZlJHihp7D1TzImKnycGnUtYzYkKXXB94VqhP/qo+b7Nzigd6M qFeg== 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=fOxGeIRCelj4CONBl1eUcjAiOwwpBUh3lGKn0TnWh9k=; b=VI6aBtd5I0VRCWI1ViZiiUFsWBUWpJaC6sGqQJ0g14mVJoS1GyKPP6D5gYuLQgo3z7 peYekh6fdateiI79uvUD7QujwClAukOO2FJcW8ZXYyL86mODayUKTVLvmTBa8o0OO0c4 dRAR3jxNAFXbpsTfdTnY5A/NkfpU9Up2fFPSx+isq0UtXcO3s2z4qJ4wnrB+JuKC9zV/ Pogf9htFabSjyd+oM/5TSbuz6/YaSr4+UaM4NtzYp9vKpr3nw1amA9Ge13jXvb8KkDIs aquxJl10ARO0yytBW3hOUY6iz2b7TZl0etlHltYL4cKdvlIaw80OK6UD5ZXU7Fgw2XPc dQCQ== 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 9si604708uar.258.2021.05.17.22.41.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:41:08 -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]:45040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisTa-0004Dk-0W for patch@linaro.org; Tue, 18 May 2021 01:41:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKf-0007R9-8l for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:53 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:48755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKc-000766-7V for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:53 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mbiak-1lCa3G0B1a-00dIhm; Tue, 18 May 2021 07:31:48 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 30/59] linux-user/sparc: Implement sparc32 rt signals Date: Tue, 18 May 2021 07:31:02 +0200 Message-Id: <20210518053131.87212-31-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:sQkv67/K9JX6RHNQYdHoIz2T0fY0olvbWAjA4NnMvuFkF5KHjUd ry5DaYbUgEGlcHUEjCiJb41O1YHR/MkllJU3knxJNPXk+Oc1BBB9t52QEmMjZ5Em7NDK0JX 9yOi8t8HOSDZZJfEQJK+xsmayQUsnDDXEOUQ+mVgrDybNQW2jj05SnTc1n+g+FP2/CnwoIy A6ymfRrn2ZjZuZSexYHuQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:RHkgrpiAo6s=:5FaqyRniF1gFEB/tznq3YE WpiZNM018/QsMQVO5NOTi9jA9w3clx74UkF7E5ZlCTKVgXZCO9ldIEqu/lfAlM/BAI7hdqLnO XJV21JQY48Pb/i1EGg2PNDe4oAb5Sc6kkibS8Tsw5M5h9lYAaWEdmmkfcrK+i602Z7adVvFsD 7nscdFLNBBY2fiQPGAazA4wqsR2is/7cjVWzjGMUgwdOS0AyekGILBSP+zfY4gtUsl1gThCjb YGhWZhLM36jaWHzijMzdwbdeCx3nqI4ZfK3CY1jamUHZufRgf7KyMGvZGrkS7wRIlGkMWV4+j Vr/lT3fgXWEgK0VO/RR3kTQhf9mVl0hXx2nlIttNU6/h9Pv/efrhhfL6+Jwpede7beoTC8cZX aZ9Tmy8YyZC2iCRz+D0M2yO7cU22FBN6AI1BuvZPXihzNHogbwoNGSw0bBzXv0O+L1VpnoF73 Rr1kThC51HIjg9UPIUJ4+R7dvyXAo7+/O9gth32cB/hITH/QnM4FtzLkOBzBL9SBCtT5NHhsf mzdx1DZd3Iff+Cb+RFHea8= Received-SPF: none client-ip=212.227.126.187; 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-24-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 126 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 4 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 41a8b33bac3c..362993da0281 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -72,6 +72,18 @@ struct target_signal_frame { abi_ulong rwin_save; }; +struct target_rt_signal_frame { + struct target_stackf ss; + target_siginfo_t info; + struct target_pt_regs regs; + target_sigset_t mask; + abi_ulong fpu_save; + uint32_t insns[2]; + target_stack_t stack; + abi_ulong extra_size; /* Should be 0 */ + abi_ulong rwin_save; +}; + static abi_ulong get_sigframe(struct target_sigaction *sa, CPUSPARCState *env, size_t framesize) @@ -284,7 +296,59 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUSPARCState *env) { - qemu_log_mask(LOG_UNIMP, "setup_rt_frame: not implemented\n"); + abi_ulong sf_addr; + struct target_rt_signal_frame *sf; + size_t sf_size = sizeof(*sf) + sizeof(struct target_siginfo_fpu); + + sf_addr = get_sigframe(ka, env, sf_size); + trace_user_setup_rt_frame(env, sf_addr); + + sf = lock_user(VERIFY_WRITE, sf_addr, sf_size, 0); + if (!sf) { + force_sigsegv(sig); + return; + } + + /* 2. Save the current process state */ + save_reg_win(&sf->ss.win, env); + save_pt_regs(&sf->regs, env); + + save_fpu((struct target_siginfo_fpu *)(sf + 1), env); + __put_user(sf_addr + sizeof(*sf), &sf->fpu_save); + + __put_user(0, &sf->rwin_save); /* TODO: save_rwin_state */ + + tswap_siginfo(&sf->info, info); + tswap_sigset(&sf->mask, set); + target_save_altstack(&sf->stack, env); + + __put_user(0, &sf->extra_size); + + /* 3. signal handler back-trampoline and parameters */ + env->regwptr[WREG_SP] = sf_addr; + env->regwptr[WREG_O0] = sig; + env->regwptr[WREG_O1] = + sf_addr + offsetof(struct target_rt_signal_frame, info); + env->regwptr[WREG_O2] = + sf_addr + offsetof(struct target_rt_signal_frame, regs); + + /* 4. signal handler */ + env->pc = ka->_sa_handler; + env->npc = env->pc + 4; + + /* 5. return to kernel instructions */ + if (ka->ka_restorer) { + env->regwptr[WREG_O7] = ka->ka_restorer; + } else { + env->regwptr[WREG_O7] = + sf_addr + offsetof(struct target_rt_signal_frame, insns) - 2 * 4; + + /* mov __NR_rt_sigreturn, %g1 */ + __put_user(0x82102065u, &sf->insns[0]); + /* t 0x10 */ + __put_user(0x91d02010u, &sf->insns[1]); + } + unlock_user(sf, sf_addr, sf_size); } long do_sigreturn(CPUSPARCState *env) @@ -356,9 +420,63 @@ long do_sigreturn(CPUSPARCState *env) long do_rt_sigreturn(CPUSPARCState *env) { - trace_user_do_rt_sigreturn(env, 0); - qemu_log_mask(LOG_UNIMP, "do_rt_sigreturn: not implemented\n"); - return -TARGET_ENOSYS; + abi_ulong sf_addr, tpc, tnpc, ptr; + struct target_rt_signal_frame *sf = NULL; + sigset_t set; + + sf_addr = get_sp_from_cpustate(env); + trace_user_do_rt_sigreturn(env, sf_addr); + + /* 1. Make sure we are not getting garbage from the user */ + if ((sf_addr & 15) || !lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { + goto segv_and_exit; + } + + /* Validate SP alignment. */ + __get_user(ptr, &sf->regs.u_regs[8 + WREG_SP]); + if ((ptr + TARGET_STACK_BIAS) & 7) { + goto segv_and_exit; + } + + /* Validate PC and NPC alignment. */ + __get_user(tpc, &sf->regs.pc); + __get_user(tnpc, &sf->regs.npc); + if ((tpc | tnpc) & 3) { + goto segv_and_exit; + } + + /* 2. Restore the state */ + restore_pt_regs(&sf->regs, env); + + __get_user(ptr, &sf->fpu_save); + if (ptr) { + struct target_siginfo_fpu *fpu; + if ((ptr & 7) || !lock_user_struct(VERIFY_READ, fpu, ptr, 1)) { + goto segv_and_exit; + } + restore_fpu(fpu, env); + unlock_user_struct(fpu, ptr, 0); + } + + __get_user(ptr, &sf->rwin_save); + if (ptr) { + goto segv_and_exit; /* TODO: restore_rwin_state */ + } + + target_restore_altstack(&sf->stack, env); + target_to_host_sigset(&set, &sf->mask); + set_sigmask(&set); + + env->pc = tpc; + env->npc = tnpc; + + unlock_user_struct(sf, sf_addr, 0); + return -TARGET_QEMU_ESIGRETURN; + + segv_and_exit: + unlock_user_struct(sf, sf_addr, 0); + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) From patchwork Tue May 18 05:31:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441146 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1793364jac; Mon, 17 May 2021 23:05:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEk+b70DNsmpN3J/j5hxYNTh0kRTymlP+TLYTvQ5JGmnGRsp6vZNvlj0fsuFaM8N0Kc6Q/ X-Received: by 2002:ab0:20ad:: with SMTP id y13mr4852999ual.105.1621317940087; Mon, 17 May 2021 23:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317940; cv=none; d=google.com; s=arc-20160816; b=cb1coHnNhUBLbgyaziCTm1xdXrjgfY9G1ZV9TzoUDz8qgn8etOiN/UoCl7frNN+LNJ fkvYGgHjrgSbEgy49n+IX/VK7uOHQZpVGSvlY9HkErI4itCR0ZjRXLeZpyfoKMgNENhp Fmd1/AniCqVPIZVOzabu/g+UrfmwBjcI/BvJZXMvNtZpwuFPmvNYKsWmJJhd7lfCHqOX 43AwZdKdH12rF48YIBh2l6C/Ctcl59bhAu33f+mjyvEDVu1Q8/RV9kxIgETA6klykL9q BTNpyip+9rmpVBV8lGdzZAvb2L+ctdbdGca0lk0x4lLqzU9y9HBGTay4Lr8+2izzfg/d jzjA== 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=vN0oDmsc3UjdjL1taGIQ6tt3WLAuELNqFNQqNdnFgB4=; b=xNtwMGsPJDbcf+sKCEhjLkFKxj5q++k8DS3TL6MviVUtl21sCSNAGiQ2/cpsflyTsh v9CR4y/xk5PtU4wrVvBEKIxCbmzEkehp+s3R/4xWcZIn2G8QtvM9ZYtezZJRBCwxT8LR qpw8gtFspCJ9g4dxDZSDHpuZzlPzuxQ1dZSWfPeVQ41WMyy0MmLFl5J1qcS2rpcIfAYP PJ5LfSxXJeiGDm/GXaSRu+bAIcMSfUSTo47nvvSr/SohQaiQ1vcDsAXz8/WNvM7+xJT5 3QXgd0LrXLpjMTTGiKhxLHKaRR1bHOila0YBYeE0on7/6UCWZUEN1W/KBnOujZCZEj4G GiCQ== 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 r1si4054767uah.155.2021.05.17.23.05.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:05:40 -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]:49198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisrL-0003ef-G7 for patch@linaro.org; Tue, 18 May 2021 02:05:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKo-0007ZR-1s for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKc-00076T-HN for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:01 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N1OsF-1lJxtv1x8N-012lfb; Tue, 18 May 2021 07:31:48 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 31/59] linux-user/sparc: Implement sparc64 rt signals Date: Tue, 18 May 2021 07:31:03 +0200 Message-Id: <20210518053131.87212-32-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:9qQKTiCwx+AMz9H92rw+WPETdOsjBQVsDKIF5oBd9PUW9lS92/s sUT1QUpF0RSW4rI4uvMwiyMhwxZS/K+sOpGDq56o4juQFJ+3n7VBgLfq+Dn6JYPl8yHWaeK 2m7GdC8XgKay74gdd3XQiuc/jGyJSnGciYbM2LR7UU865OZ58mE9I7lkaDMzRK6gZ2FIqLX 8Q40pLdwMKBOIiYFjXsxQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:SVKOrcXhP0I=:K/tUwSNmN/+38b75S7t1r1 kMLRwukGgdtCw1FdRCBwSk0X+cVwjfxQ8h6t6C0o8e0SaUtaVCK5cTVw+t8q0bm4sNT58PhRo QZ2Z/yjXkPdxJppRCaoHTSLKtkHD4N+qGQpmh0J1M3C9q3j9fVSYK9NdHI7r4mP0A6QNGGxeE cNMaSMyIsYFQhx/kH5rhnyxBv3gPL8Yv+qythzJ+3+yxnXRaOW/jE0Tiy3G7+K8xTaulnrTVp CL/yf4u+7fwwgdAqgax42Uo3RibJ/Fd2gAZsFq4VO4Jcqa7yynYSNAj/+sO4dxbLkAL1SWuip Q53OZ1acXz/D7J37OkdhAB61gKmnfHYU0ftb8cYCXv55XCDiia63kpruz4PAM4aU3eHaxRijt Anu/GcIvH0gwKt9H6xWUpuEW5BYIEuV8e+z9jNDGPaqQB3oZ5PjSXg5I5fITXWVozxPulArlI CWWJLFe4XmZ4eQtnDp8nXMCv/3o/45VdYU1TF57Qx2IqUf4mhJbfIuXWRLatAucs3bRUm8sGw NDFjvXmSV9cVXi9pyge0EM= 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 Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-25-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 27 ++++++++++++++++++++++++++- linux-user/sparc/target_signal.h | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 362993da0281..0cc3db5570e8 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -61,6 +61,7 @@ struct target_siginfo_fpu { #endif }; +#ifdef TARGET_ARCH_HAS_SETUP_FRAME struct target_signal_frame { struct target_stackf ss; struct target_pt_regs regs; @@ -71,16 +72,23 @@ struct target_signal_frame { abi_ulong extra_size; /* Should be 0 */ abi_ulong rwin_save; }; +#endif struct target_rt_signal_frame { struct target_stackf ss; target_siginfo_t info; struct target_pt_regs regs; +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + abi_ulong fpu_save; + target_stack_t stack; + target_sigset_t mask; +#else target_sigset_t mask; abi_ulong fpu_save; uint32_t insns[2]; target_stack_t stack; abi_ulong extra_size; /* Should be 0 */ +#endif abi_ulong rwin_save; }; @@ -232,6 +240,7 @@ static void restore_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) #endif } +#ifdef TARGET_ARCH_HAS_SETUP_FRAME void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUSPARCState *env) { @@ -291,6 +300,7 @@ void setup_frame(int sig, struct target_sigaction *ka, } unlock_user(sf, sf_addr, sf_size); } +#endif /* TARGET_ARCH_HAS_SETUP_FRAME */ void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, @@ -322,21 +332,28 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, tswap_sigset(&sf->mask, set); target_save_altstack(&sf->stack, env); +#ifdef TARGET_ABI32 __put_user(0, &sf->extra_size); +#endif /* 3. signal handler back-trampoline and parameters */ - env->regwptr[WREG_SP] = sf_addr; + env->regwptr[WREG_SP] = sf_addr - TARGET_STACK_BIAS; env->regwptr[WREG_O0] = sig; env->regwptr[WREG_O1] = sf_addr + offsetof(struct target_rt_signal_frame, info); +#ifdef TARGET_ABI32 env->regwptr[WREG_O2] = sf_addr + offsetof(struct target_rt_signal_frame, regs); +#else + env->regwptr[WREG_O2] = env->regwptr[WREG_O1]; +#endif /* 4. signal handler */ env->pc = ka->_sa_handler; env->npc = env->pc + 4; /* 5. return to kernel instructions */ +#ifdef TARGET_ABI32 if (ka->ka_restorer) { env->regwptr[WREG_O7] = ka->ka_restorer; } else { @@ -348,11 +365,16 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* t 0x10 */ __put_user(0x91d02010u, &sf->insns[1]); } +#else + env->regwptr[WREG_O7] = ka->ka_restorer; +#endif + unlock_user(sf, sf_addr, sf_size); } long do_sigreturn(CPUSPARCState *env) { +#ifdef TARGET_ARCH_HAS_SETUP_FRAME abi_ulong sf_addr; struct target_signal_frame *sf = NULL; abi_ulong pc, npc, ptr; @@ -416,6 +438,9 @@ long do_sigreturn(CPUSPARCState *env) unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; +#else + return -TARGET_ENOSYS; +#endif } long do_rt_sigreturn(CPUSPARCState *env) diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 911a3f5af55e..34f9a1251909 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -67,7 +67,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 4096 #define TARGET_SIGSTKSZ 16384 +#ifdef TARGET_ABI32 #define TARGET_ARCH_HAS_SETUP_FRAME +#endif /* bit-flags */ #define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ From patchwork Tue May 18 05:31:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441143 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1791949jac; Mon, 17 May 2021 23:03:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5tusDaQA6GnQWmIaCfzQTZHmOuNLAndsB1HOUODmX5Ci0Odo35D7lxOEfuoP2gOZJo5xG X-Received: by 2002:a67:8713:: with SMTP id j19mr4579739vsd.3.1621317808969; Mon, 17 May 2021 23:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317808; cv=none; d=google.com; s=arc-20160816; b=iHwApSe0qE1qjz7s4YP36JG/PW1JKvEQFZOspOv+/mfgiO/CGE51PTSkAgk9+4lS/z kVGKqC75T5H9kk+48zGWTwcpaOvkTaRFrsu/1N9jiWwigrUooel+Mmxx1JbGlGfAOGpy D8zGMoOtEn4YrQbfRP1ZUgH1QZ6Kb7two/g2j9gPWZ4BQVsO7xzr3rh43JDwsnBL+l8u Ht0Z7Y8klGvXMHGuo5VbP63lZXHO98fE0TBROH9Rux3kWMOXkDLoQ5VOfDxCXgoMnUNT C4LfRLHEJ5DCRVDPUiy8ehD9FYyJn5M4jXZDuvClGkd/gLkdWEXllA75+fp3pdW+pPd0 U7Gw== 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=VCEgtpMLXS1tTOklw90XyqjHvQAjSRfTzgH26PFWDcM=; b=ISIfiQ7jfginNPKy7Nnr8F5Rkn3z+HOpEkBZvk9nN4r+iCwo8GfSxtuQyJY08hH21D stxO57fGylbrz/3J6j0WAT87W2U08OngwwMUbivG0jGU77Z30S9nFcqqnR9NhG0JOQvd zHcM5zyf8z+17bwVt5TuV/7gzHEoHRhWW9X1oljNfESXj6nhGNoNauvzDy/NbCkIIZeB LKL3U2i511qMycT1uqQN7ZfFKv3fNO9uIbqSJS1btN9sWXnDXO84axxf6sq0iAsIvdWl 6fa9VCpoYtyT1ercy00pZ3RpaG5jtoIfghofcDrC3AY3UtpsG3RZRn4hUeacZZbJQyuj kD7g== 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 p22si8841719vsf.208.2021.05.17.23.03.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:03:28 -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]:47292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lispE-0002Hr-AD for patch@linaro.org; Tue, 18 May 2021 02:03:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKh-0007UO-CE for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:55 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:53953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKc-00076h-Sr for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:55 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MLRI3-1lza6R3iyZ-00ISV5; Tue, 18 May 2021 07:31:49 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 32/59] tests/tcg/sparc64: Re-enable linux-test Date: Tue, 18 May 2021 07:31:04 +0200 Message-Id: <20210518053131.87212-33-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:3olxtEH3pWqzRZ6Tb5mivIm/4g/Wwme/hu55yp1SW4lEVnu9h4r /LrbiD40lfW41DXl4gqtVlV3KyhRifYDRALrt7BmmdDLzFdLWkJ609Y82+LBTumFYVAdrQs 9/tk6gYj8c8c+Vbyo0Leu1LCmiscXCm2GscY9TtVL7xgQNZZaxZbtecP/QwmEmqlwofKaHO jvAtowWHtXR1iwB/z6zvA== X-UI-Out-Filterresults: notjunk:1; V03:K0:8FTbl/4BTac=:kt36rV2uUr/ld27gbGSUBQ Wws2PJ8M25d1AHehu0GBJjJbDSP8V4lsF7dor0v7fHTMZXTWk+6/NndTDOzUYMMEq4vvLhe63 /qBbLNecWDHNNOlyYlQbHYCdutSl31r912jFHYJgTTn1LPvh2EaiVhGW1VvTuFSdh9tV0M1Ax zWTqaBNGFoTayeerA9oRmiKVRNHQkda5GRoV9cO5yrfJCVfC3bFXYeoHHdo2W3A9pOmzok3Ew Hb20u493dJq370DDptHNze2G8t4j5kSQ3BLLhnw7jsmfI9ToQIlrV43DVS//19ZpqknT1zTmg D+P0K3ljFkP3m+6dbiHNsd/6oxNVJbZFa9UZ0dMLrwqQmMlVEWl2WZURZrNB5M27bTlhPVTF3 xLBBVE6NrpdyQs2FRVsL+mhjcrkdG2tbeo66s4UbuuQ7gcfuyXRJippG3xEEqXvqMHRcyYNbr I0KGqOl8D7cZ+YYVdDJXNHKu0ZpeqpT9FGuJcgLHcTFR48VtDWckT/mMtgSrwMpU9PjOCcQaF BcyMSKgOY0BKq6G+vjlc6o= Received-SPF: none client-ip=212.227.126.135; 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, 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 It passes now that we support signals properly. Signed-off-by: Richard Henderson Message-Id: <20210426025334.1168495-26-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- tests/tcg/sparc64/Makefile.target | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.31.1 diff --git a/tests/tcg/sparc64/Makefile.target b/tests/tcg/sparc64/Makefile.target index 5bd7f90583d1..408dace78394 100644 --- a/tests/tcg/sparc64/Makefile.target +++ b/tests/tcg/sparc64/Makefile.target @@ -1,11 +1,6 @@ # -*- Mode: makefile -*- # -# sparc specific tweaks and masking out broken tests - -# different from the other hangs: -# tests/tcg/multiarch/linux-test.c:264: Value too large for defined data type (ret=-1, errno=92/Value too large for defined data type) -run-linux-test: linux-test - $(call skip-test, $<, "BROKEN") +# sparc specific tweaks # On Sparc64 Linux support 8k pages EXTRA_RUNS+=run-test-mmap-8192 From patchwork Tue May 18 05:31:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441142 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1791473jac; Mon, 17 May 2021 23:02:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9+bGlIWdJ9Yd1RkSvwnkkgSfXlz2CV2teCHez4vVUB0NVtc+T2QotR5ehOXf6Ht2rwcOa X-Received: by 2002:a05:6102:238a:: with SMTP id v10mr4406424vsr.5.1621317770269; Mon, 17 May 2021 23:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317770; cv=none; d=google.com; s=arc-20160816; b=W2bF1eYciiHIeIoEN+ZGxj5nDcztTAYYfooqIpBO2GGokcMBzDBuq7BkzU01S/k12k GJVqTkHIo+qOhji6A6D30hfLeb07PcvwJj3pS7C6g2v2ZurchMkl8lm3XKBpHvtnT7HW aopp87c5Ms8LO9nlUMrUohcxD6lI/8YTWnm340aDADsyyXk5Gmo9HeIr7xi75sYCyiQd XX0qYwUqnVP4kTVFPxwzrPLzDjZ772MSqRwhUuGskNEa4NLSMcGV0oerw/eLQdsPUiio z66N9CQBZUofoByNTh0f+i8PO5Sif9Co4PYebukGFWqtMEFEK9bn40oneJcQUkAV/rJr 8jZQ== 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=kmj7LNwo354w2ZpxcboshtdjYyuQepdDlgh7nxNI65M=; b=ClMRjaT5z7gUP/1oGLk0zZfyzFaU7W15szrssiYi9zs/bVvJZn6qKUDgwa8K9KTJB3 XWuTHiMFqeU2VoBaZJazT2PXOjsjn76BBHr1F9zCzCBOMVtpWJwoRZzxj29eN5gGKqXo b5IdpZR/rbLy2EcvZwLpvr7SbzS/l9bS4WCupZkDznwZYXI/zZXiXpoLqgrzV4WVax3+ pGHzyQc+hZwWU8+9v45iMqCXD3qSllAkYt16F3KDqkmFdPDR6BrIyhcXMmdwmlFOQNC0 FifkVOADl/fy61NubjRLXnpWAoYD9d8dyUnuaJuQNEL4UOhaO68ccvYdZJnfbkbyeLH3 FLow== 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 5si4898490vsi.381.2021.05.17.23.02.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:02:50 -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]:42458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisob-0007Na-Fn for patch@linaro.org; Tue, 18 May 2021 02:02:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKj-0007W3-8K for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:01 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:49409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKg-00078T-05 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:31:57 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mr8vG-1l5zQB1YHO-00oH3a; Tue, 18 May 2021 07:31:49 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 33/59] linux-user/s390x: Fix sigframe types Date: Tue, 18 May 2021 07:31:05 +0200 Message-Id: <20210518053131.87212-34-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:0urGm6ZvufG+APtXNbvTbNiQkkhr65pbK5qMHl89WrrHqBe+g7g yfImRy2dfOA//JCcqNSN2p3GAPbjXLxR3B76yjF2wvP/xlUFcST+YEFTb6cw4nSt4zfnhZS b7S7WPZ4lG6xgncMSPHKkDhbLi9KkpPrenJaryRWTP+nmVGMvU5CBHqlJL59wDHxoHnCfH/ h9YYBg5EOKJR0q8kGXRoA== X-UI-Out-Filterresults: notjunk:1; V03:K0:w2nRTAjZVEw=:1LQszoWpBCu7qMeURyj617 opyawaflF9pJtYTWfYdLz8M8LLwp2goUIZZl8GwN/S2IO9A9cVBJfP5Ogrefr24I/bPWaavRN Z/rVNJedjFWVXCgfUGU9wPqJ6XbHMWjbACbthlaaQwqPmjy0eUfRlNxvuzCDdVVkhc21BdRCg BDoUgRB5p5sAst8hs6P1D/EYsUj5tv0ku3GvBfy+qxIH+iOwwxnRIyGddh5dagS6pmJ3nIeQg ed/jhvSQ9BVjZfXQVwdLsHsxlJTAXKshUn6On5VsZ2X3ARHyMlh8/APxYp1WxlD9urzx2WHAF d3ZL8lVDIN0khIEpE3uxrCHQl62sSg/YMyunektT6jLyv44K7Q0NYy54ZNYYAzgbfqNcJnve/ uyHClEsykCwIV3CpFFYmdAgVvmyQbiOavLSgWOFSdLe92433FKgA/XCtO+2omiD5xW0Bb2lhW 8Tf1OR2ec4eIZlsx3m3hxaj81TYR/3/XQ2u2JLNk7vx/FMyKczTk7hdsJXizlPAx/M6U0b/8f MOaunv/ZbVT47fMSoEYBq4= Received-SPF: none client-ip=212.227.126.131; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Noticed via gitlab clang-user job: TEST signals on s390x ../linux-user/s390x/signal.c:258:9: runtime error: \ 1.84467e+19 is outside the range of representable values of \ type 'unsigned long' Which points to the fact that we were performing a double-to-uint64_t conversion while storing the fp registers, instead of just copying the data across. Turns out there are several errors: target_ulong is the size of the target register, whereas abi_ulong is the target 'unsigned long' type. Not a big deal here, since we only support 64-bit s390x, but not correct either. In target_sigcontext and target ucontext, we used a host pointer instead of a target pointer, aka abi_ulong. Fixing this allows the removal of a cast to __put_user. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index b68b44ae7e99..707fb603d72e 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -37,13 +37,14 @@ typedef struct { target_psw_t psw; - target_ulong gprs[__NUM_GPRS]; - unsigned int acrs[__NUM_ACRS]; + abi_ulong gprs[__NUM_GPRS]; + abi_uint acrs[__NUM_ACRS]; } target_s390_regs_common; typedef struct { - unsigned int fpc; - double fprs[__NUM_FPRS]; + uint32_t fpc; + uint32_t pad; + uint64_t fprs[__NUM_FPRS]; } target_s390_fp_regs; typedef struct { @@ -51,22 +52,22 @@ typedef struct { target_s390_fp_regs fpregs; } target_sigregs; -struct target_sigcontext { - target_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; - target_sigregs *sregs; -}; +typedef struct { + abi_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; + abi_ulong sregs; +} target_sigcontext; typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - struct target_sigcontext sc; + target_sigcontext sc; target_sigregs sregs; int signo; uint8_t retcode[S390_SYSCALL_SIZE]; } sigframe; struct target_ucontext { - target_ulong tuc_flags; - struct target_ucontext *tuc_link; + abi_ulong tuc_flags; + abi_ulong tuc_link; target_stack_t tuc_stack; target_sigregs tuc_mcontext; target_sigset_t tuc_sigmask; /* mask last for extensibility */ @@ -143,8 +144,7 @@ void setup_frame(int sig, struct target_sigaction *ka, save_sigregs(env, &frame->sregs); - __put_user((abi_ulong)(unsigned long)&frame->sregs, - (abi_ulong *)&frame->sc.sregs); + __put_user((abi_ulong)(unsigned long)&frame->sregs, &frame->sc.sregs); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Tue May 18 05:31:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441148 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1795279jac; Mon, 17 May 2021 23:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJYlliHSvBjgdMqZLiwSYCHiD+fPbcYBXoK7qA//bCWj+1Le62mxnJ79GF0K7HRtOcUHgN X-Received: by 2002:a17:906:2655:: with SMTP id i21mr4384617ejc.389.1621318114134; Mon, 17 May 2021 23:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318114; cv=none; d=google.com; s=arc-20160816; b=0bNhu2tDgBnYTNKGVkLD3KgilO3koTBuvc53/PGnFD34zPixhqnhuT48paUZeU70iY J7DAPzNdYsLkrUQMSgk7p9QLe3D1J8QTEEhq1fX4HTt9HyT8FpeSB5M8c0cWRVyXAvSp mAsF2quATdmUHI3xEditpLNIOIVOOkAo7jem7mTF4KGUKPXVA4yLFXZDWD+fIQmhCUiT eddZmFHICNiqyXgDm3CbHiAh3cSE1GdWiF8ZQlTroXdmsQbkBYnYxpTMJqU1KV5aV+66 FTv+LBmV46G+yqusCJygjnNGT2gQgLS4eMHUwvPoJLlJW4zj6fDQtKMsqzwSqgnpW6KE D2Xw== 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=mOFjYe8TSRqUICWmZ48l3PKrMuY06Mmde7iB6GF5KLM=; b=bACuGkVsxsxdnxRGjW20VEiIHS+UI6PKkJ8b/hMgzgeycHlrgXsFKpcdxzrKSFO/w5 DMbnCChP4PH4X26SaR/3ZbF1/m2p7GuSorsu5DAH1QVXI7Q8qFBu0cVP2U6edEBEoEl5 6BvbG8Ls8ZMlzft8BsAsSE2KWk5L9VhRprjjhow/TF7mAFHEae36yJrq5xPXM8bh5CFm xwYi63MD5qo/UyFjwVDDFR3ABHRFtz+FlYSarSq8HEkE909maGOmoT5B4AlmF6LPsP0/ 0G5+oUxjPBzmwESqTac+VX89CWC8lMtlIF/zhYZU3BFJUaABXJR0qqzpssyg3+nhRDL2 SW0A== 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 ha8si7765853ejb.488.2021.05.17.23.08.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:08:34 -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]:53620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisu9-0006qc-7b for patch@linaro.org; Tue, 18 May 2021 02:08:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKo-0007cv-SK for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:45993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKf-000787-WF for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mzi3l-1lVS5M3aDp-00vfCn; Tue, 18 May 2021 07:31:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 34/59] linux-user/s390x: Use uint16_t for signal retcode Date: Tue, 18 May 2021 07:31:06 +0200 Message-Id: <20210518053131.87212-35-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:R7I6qJOMJApyo8nuNXT9G6m2GVwjPTLygGlLewcgtioSlHjXbpO PuQaQlvMNe4Z0u86JGhwQpvkhHI3O581Ux5COemMxSL4DFAGzNhtqG0BqomzdhW+5urbl1v Ubg98jjqiE4hWIkn997b97d0PtUox0+7QSvQWG1LLCf8dyl9hKJTNHjcRlpNX3ifVfHCfbn 35mNll0MZQzcU+CsUYcPA== X-UI-Out-Filterresults: notjunk:1; V03:K0:Y6UJKmLfMgU=:UBTVUmf9F7TNw9TBAOZBAU fXkv0mUr7kRCo/ByBhcwXFXAnph5P5mCkYdLTcXsArNt6ruIliKxFDBTS+1of8e2bI6XPlySx yaKSOEBOw5KCOEjhlW2V1hI0q9am9xL2eSamC5i8SJHMUIRCDlyXwrY6yDa2nE72KlQT869nf 2ehW5omF/48E9QNIC2pzfslgfHJjJ9Ux6HPWkrN2lksNqEFWQvqe9AXPXaQQouoC8gpdna/ev vFGLz7RfrewKYeSUBv2qdl5bpC/DFDhpScOD9htgua5pYSoHdaivdWeqM3M9CkP5/czdgfBCI hHveg0EO0Ot42pj497B/a3SDNwLgDpuItCAfmrbrjqFng5TIrKoaIBUU5lFp+6rSpT6qApnZZ V6JKKiOrIl+DXCDF7hiIy7DKHgoTkKmhPtGa7XiCd0yr9XTBLvWbFUXtix9oDTVx4DGBuudUg W9LkPulx3DZLatTfanULrW//w+6KidAqqN3iX8gHY4OCT8iaBLcAQb3yT6m+Lneq5rqZPdLR5 a+rOrYhrEY0B9xrVZnezxo= Received-SPF: none client-ip=212.227.126.187; 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Using the right type simplifies the frame setup. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 707fb603d72e..fece8ab97b3c 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -25,7 +25,6 @@ #define __NUM_FPRS 16 #define __NUM_ACRS 16 -#define S390_SYSCALL_SIZE 2 #define __SIGNAL_FRAMESIZE 160 /* FIXME: 31-bit mode -> 96 */ #define _SIGCONTEXT_NSIG 64 @@ -62,7 +61,7 @@ typedef struct { target_sigcontext sc; target_sigregs sregs; int signo; - uint8_t retcode[S390_SYSCALL_SIZE]; + uint16_t retcode; } sigframe; struct target_ucontext { @@ -75,7 +74,7 @@ struct target_ucontext { typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - uint8_t retcode[S390_SYSCALL_SIZE]; + uint16_t retcode; struct target_siginfo info; struct target_ucontext uc; } rt_sigframe; @@ -155,7 +154,7 @@ void setup_frame(int sig, struct target_sigaction *ka, env->regs[14] = (frame_addr + offsetof(sigframe, retcode)) | PSW_ADDR_AMODE; __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, - (uint16_t *)(frame->retcode)); + &frame->retcode); } /* Set up backchain. */ @@ -216,7 +215,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode)) | PSW_ADDR_AMODE; __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, - (uint16_t *)(frame->retcode)); + &frame->retcode); } /* Set up backchain. */ From patchwork Tue May 18 05:31:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441128 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1781566jac; Mon, 17 May 2021 22:46:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyCC3+Obha66+/QVwZLDYbSnpNGseCC9o6zoJsMFODipqWEwqV3w/Th6X8/8OAuqXIHPwr X-Received: by 2002:a67:af0a:: with SMTP id v10mr4505551vsl.1.1621316790315; Mon, 17 May 2021 22:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316790; cv=none; d=google.com; s=arc-20160816; b=nCUKWCxTsBIQc3+8mGw1guylkZeIWYUk/lztM5zvgyWMdFPZPIYY146krtv29Xw6x2 N8H3tP2CokqV66NsCho+DWg3vzjXjtgWiIB/kwPhdC5DoljBAG2Qc3miXgufHeF1ggVz a0m3GSTXkma5cOpz68dROmpqAyg+lre32l95BUitithUnI3QOqwdnzPXKsiPJSKPPrc2 tpGV1R9kQWus9BuD4BSmzQxrljWwwXbHKs3+OMma+jmtTf6fKjxvRgvAg6UYUN5UKw1j Pts3jyCtJnaNjDjWJVn/tx0kejy1eZBBuRFEi/5WVxV0nXlQVJxoZ8eZz9705Y8E15eM Fm1A== 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=+Bv26SxF605u1xBocVZ8U5WN7bzh+ew8VkXdHFmKrLc=; b=ciFMqF41XrkiKrQ8NZt26Rsmj1yNzhvr14qRZBeTvnFiCcTnULBq+aufdd3lw6IjpX bwegGLVIDB7LR7FZBI2TAFqreobC/kmVm7J+cvB0Cl5624WntSjwfx6VNe3fhmN580VJ rrrfVUJpKS0pO1QPoxvkouDmub9SKVvOLr0jLXN4WRKRu2vQjLmEou5hD3ReABJCu9Z5 yOG2vcdPXdR3BZgGDnVjcMhALuVA1rQc6glm4bIdoUkfPE1iXPS2aKSnktCQ78ME7rfH wRF+K9S8BrraoaeEzjOn0hRLLhXEKUaHPsFaZ+2r32aRVDHh5YIzzDKqG0w0o0rxo4Lf TPEw== 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 n11si7336742uae.132.2021.05.17.22.46.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:46:30 -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]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisYn-0001is-N6 for patch@linaro.org; Tue, 18 May 2021 01:46:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKp-0007dZ-1y for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:03 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:59675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKg-00078z-C1 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MLAAs-1lzrDY1NWk-00IBNu; Tue, 18 May 2021 07:31:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 35/59] linux-user/s390x: Remove PSW_ADDR_AMODE Date: Tue, 18 May 2021 07:31:07 +0200 Message-Id: <20210518053131.87212-36-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:kp4mlryV3qjT5ChB9M9n4ypqcCTW7mv72Ivd7tYnFl2Vfe63iIP WU9fWChv77VAwmeaQlv/IahWco/gnu0EfhbM6psPRI/r7N2c/toobM7XYHlID+LVhwWCecb 4lkJfhzXdIFhLjDSF5yO+gZ1wXktA/SlxSQFC58me4QNYtBQEBZK7WAL2S7zI155C868lzs gLd0c32FGPGAP7rHtrAUw== X-UI-Out-Filterresults: notjunk:1; V03:K0:ioyMpufQeHc=:N+fi7WRk9lOMnjXmAfFasI CoErEZycVZgS3qxgBvFQ08DHazg9ehUey7IN231HzhcvzViale+m5ZaKS6XmHHJzbGf/4sbUh 1bjzIXjP8AxsjxsHtbipFjzL1hPVFLkNT7oxVTTzUL+FOEDpopPQZ88HEus2+B1goYYRrMsut 9FXWHFMStwnUWsHs+ypeS8NAd5w0P5WK2UmvAgiNW6wsMEzgT2r4IHrTycwK4jXS86Fy2Kvu2 7kC0O+8/JFdb/Ieaufe3bRSsgRR1BnAJVZVhlP59DHtH4hJ7GJLFbzmH88/FzqisjbU/r6/Z3 HgRpyFpsVN9qouQDxFp9nQ8B4Xx4oaLEXDDsFmpeSIPvzortYim7L9E4gQGykX+IpakhJJX08 ghPCjC+FAmlZrChEc44VDu0uCHiYc6ShjAq5U+p/9TE0JKEyRrdGXhEsOkxwwjFtFQnwtcZdj AgAwNSPzety6/WP2NA9wT/QqJgZJJ7dYCWniBEsPQ+BrXDLcLMt6x4rWZYQ9lnZBqc4tdyjRJ 8X+KKj/7bqHqZm/pAvXEZw= Received-SPF: none client-ip=212.227.126.130; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is an unnecessary complication since we only support 64-bit mode. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index fece8ab97b3c..1dfca71fa9b2 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -31,7 +31,6 @@ #define _SIGCONTEXT_NSIG_BPW 64 /* FIXME: 31-bit mode -> 32 */ #define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW) #define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS) -#define PSW_ADDR_AMODE 0x0000000000000000UL /* 0x80000000UL for 31-bit */ #define S390_SYSCALL_OPCODE ((uint16_t)0x0a00) typedef struct { @@ -148,11 +147,9 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = (unsigned long) - ka->sa_restorer | PSW_ADDR_AMODE; + env->regs[14] = ka->sa_restorer; } else { - env->regs[14] = (frame_addr + offsetof(sigframe, retcode)) - | PSW_ADDR_AMODE; + env->regs[14] = frame_addr + offsetof(sigframe, retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &frame->retcode); } @@ -162,7 +159,7 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; - env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE; + env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); @@ -210,10 +207,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer | PSW_ADDR_AMODE; + env->regs[14] = ka->sa_restorer; } else { - env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode)) - | PSW_ADDR_AMODE; + env->regs[14] = frame_addr + offsetof(typeof(*frame), retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &frame->retcode); } @@ -223,7 +219,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; - env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE; + env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr + offsetof(typeof(*frame), info); @@ -248,7 +244,6 @@ restore_sigregs(CPUS390XState *env, target_sigregs *sc) trace_user_s390x_restore_sigregs(env, (unsigned long long)sc->regs.psw.addr, (unsigned long long)env->psw.addr); __get_user(env->psw.addr, &sc->regs.psw.addr); - /* FIXME: 31-bit -> | PSW_ADDR_AMODE */ for (i = 0; i < 16; i++) { __get_user(env->aregs[i], &sc->regs.acrs[i]); From patchwork Tue May 18 05:31:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441149 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1797037jac; Mon, 17 May 2021 23:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQqq7m2UZJYfoknB6BABPfCXnZmwiq0wAWCgcTN0Zkpj/qTDo/mF4/KmhQ3QJn61QdtGqD X-Received: by 2002:ab0:4042:: with SMTP id h60mr4738439uad.133.1621318290469; Mon, 17 May 2021 23:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318290; cv=none; d=google.com; s=arc-20160816; b=aFyZXn5O9/OT2XEMtX8RvWb4r/nQZ1bA2xozoeogBeCnaNhjWrGo0OK6KyYqohhjB5 iElTIT8anyRmTzgL/OfamkqmPwjdRwzfuMp1Ofhz6pNnAW572gYa7nxu1buq2C/ZCz0I 1gxmwX5w2zcGDgqsD+xoPPXZvQbYQN5O8H7P7ARGbeOzJPRXAHDFXCYFDYQzGKNVH0hM P5GZaWg1oBRO2uGG/cx42xMQWgINFdZsijBtzawCMMCS/6GQaw1+yFnCLR1i+OhNcdkK mJ6w6G/F/UXZcGFDXNZoyOdBysuCEnuUicxi+rDYhmYHS8KDwl9ZKykJp7JwVisz0sct DoRQ== 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=7SMseEfn+o74hdSlaIWSGim3Y0pchzh7J+VhjHNztRg=; b=UafpLX3eOW4Nz6Z/M0mW116KRh6wmtMbow18Miuw3AFGFJe/Ug4UtmyrkArnn3yp0U 6SK0oHmSgk/sAo95vE5daCPQvLv9BDyQHhOIfCZT7hNacWDrOwUZ8uZCaWUEPhqHyH0t +PnPsOCroTC2O9/EA5q55YQeCz3Z6MODMs+CtAZl7xNP2eI/pPU+2S1xiYwsQjvDzg0s XBlnPQ/psqSlnkKNt/yojGofk6wBTpt1/5L1zSX9iBujwi3gUqo/rOEqzsS0Gbex1HIQ MdMGRhYxpgoTFKGmSZCakhHqGPH7jxBOLNcHD0+vYLevq4EXJjZKA2wynW36ozS33zHv L6Cw== 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 125si903281vse.222.2021.05.17.23.11.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:11:30 -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]:57864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liswz-0001Q3-T6 for patch@linaro.org; Tue, 18 May 2021 02:11:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKo-0007bq-Mz for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:47409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKi-00079A-HY for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M6lUk-1lq1TU3InG-008Nju; Tue, 18 May 2021 07:31:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 36/59] linux-user/s390x: Remove restore_sigregs return value Date: Tue, 18 May 2021 07:31:08 +0200 Message-Id: <20210518053131.87212-37-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:/FuOqJgIwzA4g56oyGu+1qAr/manHOuUkGjYp810JRHaj5fTiTl qq+g0F1boYvb7HbbClLTpqi6wn/GiUcMPOfvJdwGd95Q5oV/JpeXKHoQqc+Fk5PQqJgLXXH BRhvN5cDZ5D05+IIhlkJeBMdmqiCYqRF9GrmxvoLjeZvF6KeGgDUFd1dt57tYAQmilEUs4q iGr4UUbMck8kbnqcGABbw== X-UI-Out-Filterresults: notjunk:1; V03:K0:oABa5l1xAeU=:0umannad+WmoHiUJkbI9yE ddMQNInzF+Pp2e9sWKsbaxUns7sI5ahFvOXM68Rf5+mXV7WI5BFoq+jTy2rXkbt/38cZF5iE6 +GcGfblhBYF7tdXHaBrX941zPufHjBXwj/OD2eHNhStvs8DCgu51rB+2FvCdtleVAH32kQW+x GrdqUn59ZLLIkw/39A9aqVKX3Pj23TnYrqwOvVgrmOEly+viydziIFgZ+4vaI0OVrP+QSln05 1ci9LUZ2+H+U93KeqxAEXrVeqQTjR/QJj52msjeRKQpfo375pJhIxNmhxIGSGBgdqaw16Xrn0 lKHqadd3dxmvreC7T13QCgDVgXrtY1TKZz9kPTD42Ncu6sisvdOCROBcAUYID57IbgeB6Uiv0 CgySdpSRuxP1K9AVGwYzCtv1Ek5Kvk/htoYsoh884v+kzxWMeLwD+l08ytZ05xMxXW//wYiYC iipZULSoWm85T7beFd0yBl4R2LI4Sgig6B2zDW1jnvX16hY1osy4/rGBCcDSZIMes7JvpARg9 hClsCHkzB+bk+9qMeaLg5w= Received-SPF: none client-ip=212.227.126.135; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The function cannot fail. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 1dfca71fa9b2..e455a9818dea 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -230,10 +230,8 @@ give_sigsegv: force_sigsegv(sig); } -static int -restore_sigregs(CPUS390XState *env, target_sigregs *sc) +static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) { - int err = 0; int i; for (i = 0; i < 16; i++) { @@ -251,8 +249,6 @@ restore_sigregs(CPUS390XState *env, target_sigregs *sc) for (i = 0; i < 16; i++) { __get_user(*get_freg(env, i), &sc->fpregs.fprs[i]); } - - return err; } long do_sigreturn(CPUS390XState *env) @@ -271,9 +267,7 @@ long do_sigreturn(CPUS390XState *env) target_to_host_sigset_internal(&set, &target_set); set_sigmask(&set); /* ~_BLOCKABLE? */ - if (restore_sigregs(env, &frame->sregs)) { - goto badframe; - } + restore_sigregs(env, &frame->sregs); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; @@ -297,9 +291,7 @@ long do_rt_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ - if (restore_sigregs(env, &frame->uc.tuc_mcontext)) { - goto badframe; - } + restore_sigregs(env, &frame->uc.tuc_mcontext); target_restore_altstack(&frame->uc.tuc_stack, env); From patchwork Tue May 18 05:31:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441150 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1797041jac; Mon, 17 May 2021 23:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD8A4cWhrxSQLYNJ+jJQG/ejRigoGbpL7pjF6OOOsP2Y9ql1YdgsqVrYDXwKDNGzyKou3d X-Received: by 2002:ab0:3403:: with SMTP id z3mr4706722uap.113.1621318290697; Mon, 17 May 2021 23:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318290; cv=none; d=google.com; s=arc-20160816; b=emTMPytLeL9g/LlZ9CYhAO0ELm5iwI+GwFtKFXWvg8gcUHTZFkxWkPk3rjJVhyFz93 oRFDRB1WNY8cs47IyNHw+eriCBOP+qou+wqj/yn5crIqXGqo22BK+aRwq6HoSYODTVWG j+35vDImy8jDe47p1JYFEopnIHPeISD2dQv0fbViF24OwAcrYJpq/kP9b4QspAPRp/hO T2yWEgFMreLmnaPj9rmG3uG8hTlftCtMVYPdS8ILob8kRnQNUeObK3fW+2wD4CU5eyWu yXbkK4rwQu/Af/J9G+7krCv0JfKvhX9nIfffXlyeOCXsG8EX3+P0HQc7tmK+nYEyIASi mZ6A== 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=fE6TmQjCnwYUvKRqprMae5Im/7A49/crteUSJSnovME=; b=WDRdXLbzKHzoW+U4WkLZd3LlPSy6eZh/GMmA+I/97E8QKBZptGrFHnfXIu6tnxPrda sxhpkhYWJdbRT7KEQ1wDZXJDUE0rKm0bP8STNP0u25P3OYWvrybVGhk3lzGW1u641bko GWH8AFvlg7gnXqbGy/vYx7kh5ljBo7MWWqPDzPpVs4m7zbgsE3B141u4QA8NgpeERkMA VD9dPZVKa2/jlcf8nnqrg1mh18ABtoNDM7TE70jQe56rcOdSeBMJqoxNqp5ggqLZAVj0 yy3kuLzrI/vIkhJf17KUgcTAgIdrb2qsXw/3EIhJxuYrPJTJxRNJtS4YOOaErPBTwwep NSmQ== 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 z36si1575874uac.237.2021.05.17.23.11.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:11:30 -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]:56576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisx0-0000S6-4n for patch@linaro.org; Tue, 18 May 2021 02:11:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKq-0007hy-B4 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:04 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:44103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKj-00079u-0i for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:04 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MGzI3-1ldfXw1Frf-00E6tT; Tue, 18 May 2021 07:31:51 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 37/59] linux-user/s390x: Fix trace in restore_regs Date: Tue, 18 May 2021 07:31:09 +0200 Message-Id: <20210518053131.87212-38-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:SgDryPu0UzDHpaSBa66ic8SRL9CsUkvHpgYIGBFBHels/EpfyxC BaBkkW4M9S4+b24E/dkBV2lxxIr5IyAbxPep0BLrZt4K0N3GZSZJ2iM+i0ZIToMy5QTU91Q 5qZj1KZ7DuZYtLC6kwAaWgZXCuzKW9MD/01NdUEP9Pr1izVEIJjnnuikpa96irfPGYRMvve rwQ18wuD6qVi4113Q/c2Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:CEwRVVLYIMg=:g8cTkuPw1f8UQLf2pazmit ZBTzw/5wTWDB1e2cpB+ByiHg74IOK/ZzIrbbeYb0LQfMQo11dkSM2HFO4uo0pPcCxNu65lMZH QHkmQApP0vAkeI0xDjux0txNQbZffWPjiNMx5RXspGf5J+FV6UPBCS9FilhuV4AE4Ymj0XRF5 9PQ1RZC7iYAeKDkQzvu/DXtzMG/bLMdT+YsASHRQVxcIP2hj3i8sGdNJ4cLocgEyhbMKxRnsX 6dtGb5gdsx8UlTR6V3I3iaFekVKAuy6ZYj/eOV1bXs+QbEyIw1+yM70Pir2/bWVEO7cpc/5p8 7NZCNfluSDeAxICHfoNXfAjjYvX9gatn3WebHq9kdOF6ToaeIh845FFR4cYv0VsYGpZAC1ubF K96j7tjUUeQVuUZ3RXB47n9pb4Xi0GlhPH+GjJlHmdE/7nno3MHiYhobllw1ny0lvJ1FvbGu9 XRbeSfuvxnfVgxGtytTWrZ9J1PuOMb0HLB6O5FD2vDVb+6lUfvfosniWKx+GCB2edN07NuzoP ia79rjkF/ZPdXtrI176pVo= Received-SPF: none client-ip=212.227.126.135; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Directly reading sc->regs.psw.addr misses the bswap that may be performed by __get_user. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index e455a9818dea..dcc6f7bc0274 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -232,16 +232,17 @@ give_sigsegv: static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) { + target_ulong prev_addr; int i; for (i = 0; i < 16; i++) { __get_user(env->regs[i], &sc->regs.gprs[i]); } + prev_addr = env->psw.addr; __get_user(env->psw.mask, &sc->regs.psw.mask); - trace_user_s390x_restore_sigregs(env, (unsigned long long)sc->regs.psw.addr, - (unsigned long long)env->psw.addr); __get_user(env->psw.addr, &sc->regs.psw.addr); + trace_user_s390x_restore_sigregs(env, env->psw.addr, prev_addr); for (i = 0; i < 16; i++) { __get_user(env->aregs[i], &sc->regs.acrs[i]); From patchwork Tue May 18 05:31:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441147 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1795261jac; Mon, 17 May 2021 23:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLraZXawwqnVgdZB1SwtT412XFw9mWo39/PJP6ezAoUI6sLQoDEbryohxsEskQ528q2WL1 X-Received: by 2002:a17:906:6c96:: with SMTP id s22mr4408489ejr.468.1621318113272; Mon, 17 May 2021 23:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318113; cv=none; d=google.com; s=arc-20160816; b=fX5WyVF9RJTCXTwZw1/xga/t+P1ZKih6NQWqiC0+QEVMHSRgvzN0XCgjtqAp1E0UeQ hfkXftMGQ0aMyNJIagNDVQzTP+Zs4ovqUWtDXj55cBy3sihvhYcKO312/ZgYWx9gkpcp wENv03oR0WeX31ek6W6+Tlg5i3GSGa2xLGTrZKgM6cKw8xp2g132+X74c4TYbOJStpQl glHOLYlN94VdmkF+ngculiaDwDE+xV1yImk/vwFqhPN79KdSctHwbelakXC++PpoE7Fd eE60vW3Zb6Wj3sIX+LCrNsscYEboI+ICELB/x4198e8XKYGeXZtaj5Tdx8gzhLMbqT9F aIOA== 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=KwT2AKgZHezFIvCf5CFVAJxflDRN58W0gf8ZoImqk/s=; b=vob9rLxyUqeUBozoFxbwMx6jgW6mcsVzBZFTUvuBmPpG9RMdtu3GwwkrVZ6Le9cUdY YfNMEsSalW7yMMRCJwLJn7O1uF5YxODbrH+m2MN8LRoUzH0Fh4AlDhZO4DFkL0DPeYak fMcZbKLY0Os59Ww9tPU0DwNYXC7DLpl7ZzwVO1uQEJF+U3uEcNJSqRiDz7HnKc9bEJYl B+y5Cw0XEIQC7JzQmbsOFk9dlRDSaHcdF7E6vSQ14cKITgSJLIpEvy6F3EV7jTHQNZ3R TPEb8QPwJxSN2WuCYfeJ1WRwv6Dt3ZU7chYr5o4pJPng5nFb348x/1tXvPL9MPFdu6hi 8rTw== 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 v11si16796620eja.569.2021.05.17.23.08.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:08:33 -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]:52316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisu8-0005v8-9M for patch@linaro.org; Tue, 18 May 2021 02:08:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKp-0007eO-9u for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:03 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:42991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKj-00079s-18 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:02 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N4eOd-1lIrRH3X1z-011mCv; Tue, 18 May 2021 07:31:53 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 38/59] linux-user/s390x: Fix sigcontext sregs value Date: Tue, 18 May 2021 07:31:10 +0200 Message-Id: <20210518053131.87212-39-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:K2cnqivSXpqMREgWAmXvvGKJ5rlVPDroJhh3o7GNj8qZM7Vq7Ga Em7WhoLtChjTUXQ9T/CeR/7jgNJcdfkzfXmrWp1KbNWWzLFr3DoNj+FRlqMjvS2uj/BsH5E Vy12KqojlJkdsXTUGcjpzGdu5GNZYECwYcqwZvKqUPifx27ICjqBcyxecdasSNnK5uz4HQP z+B1Ei5HfISb15hlb4ATg== X-UI-Out-Filterresults: notjunk:1; V03:K0:+s3L3Ny9Xxo=:b4r0zBPkUl5vHVVdUZC7td WDB+Nsip9FQusy+Nev3oZ3xgyRRaoLh3L3Xl413Au1pDt610vZPFLXNgJW1c7pvm97Q4oRWZp 07/ZG31wIW1CDVPC2p3GTYX4rfttZaZs0JZW1ZOWXvrfpPhNGt7HXAzfg/ICfEDmSOcTvNrVX c72q6V5BlnJ/0j7zK1TR5lgU3mzqdklr5EiE248SA2X8DUECHn08NBzIsn4GLVAcfPPZ8ZkJs S0epN/gzIFWyMC6/SwnDcJLKnNDDNo8PffWbznuvQilUgKSeDOZ2YT/ftJbjz9+GLJnoI7Vgt JNKNKy9t4+eBctrtYEBFRxYzfL867kqGDJffeEjDSSDjnVNH29mw45J6ktqQuSqxm2rf7QQwl tRApTv/z+IMkMZDA0XAD0x2b0HEfvKQRSmeyOxOhjimmOB2byxEiI0wP3ZcdznM+dXfytQDUD E4xsCl5+FXKgcfQ25YUcXMqbYXgK4PdYJNU5T9czgoOrzwEWml889NyrMxwgwNmfjah4rvDJl 0c7L+/IaMSLvlbXsbXm0uc= Received-SPF: none client-ip=212.227.126.131; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Using the host address of &frame->sregs is incorrect. We need the guest address. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index dcc6f7bc0274..f8515dd3329b 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -142,7 +142,7 @@ void setup_frame(int sig, struct target_sigaction *ka, save_sigregs(env, &frame->sregs); - __put_user((abi_ulong)(unsigned long)&frame->sregs, &frame->sc.sregs); + __put_user(frame_addr + offsetof(sigframe, sregs), &frame->sc.sregs); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Tue May 18 05:31:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441152 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1799567jac; Mon, 17 May 2021 23:15:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5tLeZ4pyq4ixGq7ZIgqrpA3u0+fJT9mRktXegqg+onFqNMTSO4m6SkDKFmR0IFobRg1lk X-Received: by 2002:a0c:9ccc:: with SMTP id j12mr3901935qvf.30.1621318526382; Mon, 17 May 2021 23:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318526; cv=none; d=google.com; s=arc-20160816; b=J83fixalJGDoDPnydZcJ4qm+mAw+iCNz5OFJpAImyuR42IYsEoJ8Kzdzbijwm2IBm2 lhDY26YVEb0wrPzDnASN/J4oNLc4EFmX5mQQcm7Yv1tbsqUCEVreyPU+Ke2giFBNbUZb +Wg7gMiVm9Ts5q+qgyyS0uzztlKIBylGUqjw1fXlb5nvMM19lFyQFqYPD+NoCrhV0WlA ZdJfOivvMAuy+7vZWbpQsE5Y3Fh40LADFEAQFO+8aZh729xkr+tdmeppb5SpsHib8+P0 4ff/mi0LzABz6NXWRBcJsdrunjYtUUJkMz/lY3S6TngMBVlV3GJ7iQASadCRHRIHJ9iz yxhg== 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=1XDkHvh/cCuWadzIi6xVKJJPPCiYB2bHW85iDtvupT4=; b=syIQI4xUD3pLfrzPgygtjJ04wD5Wv/pw9iYCf3108x1KTvF8e3HgJbwaBjk+VSFOgE +yLNgkmQSwS/H9r9/daHg+ZRnuPDGhGpgGJrEXqhmrCzaR1GmM1k1qGCrfBwAueVWlcD KFVm8bd8P6vTp2bCbZC+OcJRYJaJGF8pyr+3u66/3SqhjROMNAuj1AgdqQ9sj5c4lj3r g8G8MCOwXb3hUoAmJ6zx+QzpkiIYkdimJwR+tqFkRFcOXKWIEgmlsupAC9ODkrEI+k5F MTzdvay7RVPurhVYPwHVyvGIfQGXIEvs46AorMrLrHzKfABapRL1QBkgWzi3vWPkVeiP tpdQ== 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 138si12792606qki.21.2021.05.17.23.15.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:15:26 -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]:34392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit0n-0004g8-QL for patch@linaro.org; Tue, 18 May 2021 02:15:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKr-0007lq-9s for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:05 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007A0-1E for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:05 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MFsAJ-1lgyvu1Kf9-00HNgn; Tue, 18 May 2021 07:31:53 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 39/59] linux-user/s390x: Use tswap_sigset in setup_rt_frame Date: Tue, 18 May 2021 07:31:11 +0200 Message-Id: <20210518053131.87212-40-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:zpPewPl+HBqydJb4GvfK6LiPAO4n5oGHGO1VTIeuRreQfx2m6ez ILg8fhUrHNhobN2itW5TC3euW0f19tKet4s7R5ZkNg6hLuGtCTHqwSQh0PP37rO4PvLCuYQ rEVr6jlqiHn4igMF7OrAyluoH8ot5mi9ZIhZ7C+RBCNNOrkHxFhKbWcXYtmE7Q65gfsBFHc c7CgED8RQqZFzC2IbADCQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:r8mDENy0fIM=:gHse5YwmJcatcmGwmlJYRm hXBbOENqlHeKorRgZCDDyrlpn4AcIdSTus8vokhLSMy2HME130UAShNFY1iAVOxQ2Lk5IGJkN khJytdrpTCutX34kPZnBKIZRm2+D+KphhOhePnuce87mXlsix4DkKqAuOWejWo6GH0Yo2YQMo KeruxfR4iLpWhLrgtzfW7r6OefMQhAeivf9Q5s4gu6oAVAFQHOXKgDHMuHcxZAWbKzdm/ewT2 90YpMSmsvCB+NmFE29XTjNlfmbRttD8UnMQ8IzKgJt4qVOMR21is8ddC0H7Of/IY2evSN2cED MQ/CPVAWkN2foyaL5TU9txOAUHIJlErv56YD6+E0RR5rbz5lnl01sO5/c+ZpOFZrgt5CX4FIu EbIfKYPQbThvnU+Kr9qgcFxwTCvK+6vUE5g3j++Sd6PlaxN4OllSgYYa5eomJQIl8GAzCxrqn 0ZgcBbdodW7AnZxTKqdwVN7OJxrL3bgUtcjR+OFoR+ZAbu6FqHBhIdnTbdIIw4tWhv1r9jCA1 zJObgi+GR53GZTG4yDZbo0= Received-SPF: none client-ip=212.227.126.187; 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index f8515dd3329b..4dde55d4d518 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -182,7 +182,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUS390XState *env) { - int i; rt_sigframe *frame; abi_ulong frame_addr; @@ -199,10 +198,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user((abi_ulong)0, (abi_ulong *)&frame->uc.tuc_link); target_save_altstack(&frame->uc.tuc_stack, env); save_sigregs(env, &frame->uc.tuc_mcontext); - for (i = 0; i < TARGET_NSIG_WORDS; i++) { - __put_user((abi_ulong)set->sig[i], - (abi_ulong *)&frame->uc.tuc_sigmask.sig[i]); - } + tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Tue May 18 05:31:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441133 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1786693jac; Mon, 17 May 2021 22:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrhYkDDCYXveC7rCSWDFVdG8hH5m7g2sTdG+CoHP6iJ+5y8WgwHvr4pyL114aGKGYBEJT/ X-Received: by 2002:ad4:56a8:: with SMTP id bd8mr4242937qvb.9.1621317308251; Mon, 17 May 2021 22:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317308; cv=none; d=google.com; s=arc-20160816; b=oKxP20eBBydpu8QF4f3K6vLOONHee2vL9euqJR2eJZCaFXjKMCQq1o2aIxvwE1cyIf 6K/XD7eaE7IsBzROw2cLmxk3316XmCKSVpsO+NT8GDb1Bz8zrPAJpzdCoLrkgPUMwNrl jIinMPagEYbnKGYR8Yv5y/jxcfyBKt4JLe+ahI6FXQ8gQxQo6tilQ0YAuC54ECJHgZX+ TnS5H3qHD48ep7iJA6n1LXkCPiKaW5NOhioTwXk0X5sdGGQw7ey5fPCFTy92+DhlXmIc WiVzZJJoFN2jsPNHA9oBQNAcylRI3Sc+885s8F2OcICVwNr+OVS8z2NbcewfZJFbKehY Tr2g== 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=GGt3s9PH54kVNpLEGyCmqOOnWNqSPdUuVvGJzLZhWRc=; b=EWEXUF4PwvM+u3n2v597UON4HWuvRWCUxCoEpWq4CEDJnQb2AVv2O2fWcDvhZ2ek9I RS4+nUBVnI/FeGgF9Yf22qM75EAhp2AajoNMCf6DdXXf5L/kI7e6m5XZD7K3Cnly2GX/ TRBlWY9Exx11JyyUdahEvWJ76PlXGn/KvkQnkqpSuZ5F7iXgbPBYUkIGXKfm4lizBMbj GbSDkcM09G8OvoFd28+d2Ugq+LPMhSrI5cQ4XOH4LYqcO6Yl/crDE24Ij5BN+yrRdZrs 1folNhHA8bOo2FLKDmcDume40XKqWZCk4jMjNT2kZavGzb3SJnY12cA/kBhCYerMVjTs mtew== 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 k1si11952095qvp.193.2021.05.17.22.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:55:08 -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]:45580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lish9-00070J-Mr for patch@linaro.org; Tue, 18 May 2021 01:55:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKt-0007te-41 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:07 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:46027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007A5-2K for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:06 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M8k65-1lmywC3MeX-004hR9; Tue, 18 May 2021 07:31:54 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 40/59] linux-user/s390x: Tidy save_sigregs Date: Tue, 18 May 2021 07:31:12 +0200 Message-Id: <20210518053131.87212-41-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:mtO72gX66+0XimLplwT1W5/HE7jjUbsxrl2E8lKI+YqVTh9Iw2L 0zeaLDkqt/YPI3tGPveWtpr3gLQWVv++u5B83ONdmvqmcma7tRIjGdu5NCnMulppFhIvyqC HDiiLkKFfksJeVCim+EI3AkKuznIsGgv5kwfrfHtZIA2PLywquZqZyGXmtr1qW+Mhke/MTw tAza5L72ZVruRFFXBgfCw== X-UI-Out-Filterresults: notjunk:1; V03:K0:tLfhggQq0AA=:2DNGyYFhsgwjzU4J+4LPDN ICT3ugzzQGxMXk9ClDLH664trttQo42kUzlhjuVuRqkBqvxcJRJbnvVVKFJiKRH0ENw5cr4Sa AZBWzYe5WRH93Iqz+HKS70orC3h7VMdc8ZQgdFopm60AkxQIzcavfzMg7cMoF9f5euz9Y2m9p CseafcVscyOZD/hwb6c0Zo7i3TNBWeX8vwRfOn91qBTNoPnAVuzKur1llbP+FJcGgfZJbMYT+ 5FFOZ+utMJA5zuOz8Ku2ILkiUZuW/R1MeQ4WWjcCX56CxqnT4d21CpTcijfF5J7uziymPmbm3 HH+NnrekXOww4NEq63q1ciKJsqLcCkKdj22V7mHikECwWUgBfAep0S0tGOoCvKcN1XBKyNxsR gwkFSGWvyojz3UzWjOuNP3Ko5bWsnCl2NMVnVmvb21ZJbivQbmZgbgfjXbYxNmrddoYj0e8nD l+AzSQtzyxKyWLpXRILUsQustsUTi5fBU7SBZyr0sm96aXdvq5WmjmVAuzAeNpgpMpw6pODTw mA39RDIq8uCkyPfwv7k8Ac= Received-SPF: none client-ip=212.227.126.133; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The "save" routines copied from the kernel, which are currently commented out, are unnecessary in qemu. We can copy from env where the kernel needs special instructions. Fix comment style. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 4dde55d4d518..eabfe4293f9f 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -104,23 +104,25 @@ get_sigframe(struct target_sigaction *ka, CPUS390XState *env, size_t frame_size) static void save_sigregs(CPUS390XState *env, target_sigregs *sregs) { int i; - //save_access_regs(current->thread.acrs); FIXME - /* Copy a 'clean' PSW mask to the user to avoid leaking - information about whether PER is currently on. */ + /* + * Copy a 'clean' PSW mask to the user to avoid leaking + * information about whether PER is currently on. + */ __put_user(env->psw.mask, &sregs->regs.psw.mask); __put_user(env->psw.addr, &sregs->regs.psw.addr); + for (i = 0; i < 16; i++) { __put_user(env->regs[i], &sregs->regs.gprs[i]); } for (i = 0; i < 16; i++) { __put_user(env->aregs[i], &sregs->regs.acrs[i]); } + /* * We have to store the fp registers to current->thread.fp_regs * to merge them with the emulated registers. */ - //save_fp_regs(¤t->thread.fp_regs); FIXME for (i = 0; i < 16; i++) { __put_user(*get_freg(env, i), &sregs->fpregs.fprs[i]); } From patchwork Tue May 18 05:31:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441136 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1787928jac; Mon, 17 May 2021 22:57:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7snQxaEsYdU53iy3HfiLQ4PiwesSz74lM1vBpFlixHNV0l3LFBPNVJJ4x0tAAlwkX3Nw5 X-Received: by 2002:a25:6ed6:: with SMTP id j205mr4768018ybc.206.1621317437094; Mon, 17 May 2021 22:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317437; cv=none; d=google.com; s=arc-20160816; b=nAVShzKtQVXIgQO0zSOkCEJmL8HKBrGWqoL/70Me4EdnWADPsIXyv5HEoIGZZaCdwr 3xPhtbMItaZpy8IoM6P5A8Y5hXeUfCJdfMavEJVwIvb092nyKkvK/R0Z1dToK5wTbP9W 7U2v9A3x1Ug/tUKSr00K/PGrIb3p/uGVrJO2kRj48soOZdED7W1BEOKcnFGj2+XBfDYR H4hR2uHMU1c7QBT7ZMSmzn5gnL6ZbvCkAUz0dGTGzTGNAeYuShSFIcfSIlvC36+oWmDc 6BF4kVZJhFyczWpJssv+gbKQofr2VfRV7XAbO3vpzKNLxpC3t8HYxdIXMY6vKi4eZI1A sCWA== 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=WSaVOElFw7wdMDxEUPmsbL/HL4lxW5U/yC9txMPWVcc=; b=upiyt7NP28Myq5I0BDopsa7Q8IpIispxq8gJYLStBPFxDLAB2oQ1ovUb3kIf7162Is 5rgA3DioEMQ0mfjZg0t44JVGMNnSIyw97lVjskCJiqdduopdl/nQdpmV/JSNfHCG/3+A AcVi4r/NXrsYlOpZfuwBbcTIQeCXqqxQWC8sr0UcvuhwKk4WmUE5055o0H1JwZ544O+H fgrDuhDC2dhxyMFHdhT5CY1hgLnErMymNtC+K9mF3kbDvdRPLjE4KvN/fKWHa5WIwJwj WBvpNRAXn7FeubTxv7ZsqPG6o5RiTuHaIgR8HC5ki+FVuxQQ/kDfY5p66U09utyh4H70 zApg== 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 w4si18047157ybc.274.2021.05.17.22.57.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:57:17 -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]:53958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisjE-0004IH-Jn for patch@linaro.org; Tue, 18 May 2021 01:57:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKt-0007vm-HF for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:07 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:47293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007AD-2r for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:07 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MyNoa-1lZ2aU1DNU-00yizy; Tue, 18 May 2021 07:31:54 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 41/59] linux-user/s390x: Clean up single-use gotos in signal.c Date: Tue, 18 May 2021 07:31:13 +0200 Message-Id: <20210518053131.87212-42-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:C3gE75Od+oBlcgxFppGkxt2dL7Z0AMF9LS8MklpEC8D1PK1mJi1 l/+rhdctnjhg0S4oqNasxvO2NpbEgDaTvAheXU59umjBxpOGjSekvCPelFQ2btGehBsrDu2 jMjbbglauUeyzJSsuoiGIaJwBdI3DQAc1iBks1HyCAGAUi8vr8hxBNkBFw0BLmkR2R4olGW eATN/A/XJe0nwp4fLsoxA== X-UI-Out-Filterresults: notjunk:1; V03:K0:ONp4jwaAAuc=:IzeJRHYI2l0As8CnS6qxGI KGH5XRSdPYFe67z3ArhYjhEfmziSIJWqQiJ+AqTSXK1raR4tyYWRkyBuSHeyZHSwCrCmnsq0C KY2sO2UpSI76UqO8QlzFVDcb7L1xtFEdXL8msK75fUmVGyM5/XvJpsH3hIjWHlkViZUbk8ukd JJc4UWGpSzHu3Hbt7PIrnlDBGe3DcJJYc6bXQGIbD9NttVuklo2UMTgr2Dq5IK3SIRUaXegj4 dZb3cETXY2UXyvC74pTQRAaq+ViV/IM/7Ms/iWhjkAr59uqIYT3dZzU1xL5ZZmLn4utUN8BIZ i5dg9Glc1ePNnFwhRPepBQzqBhyRw01hLacqWUVnNR1gbyc9QsL5HEUmtGqdknW4EeI88e62t PhGrjJrYrQo0T/lCPxNoBQ3J5ckF59UHqQAJVEMrtsH72+xjFmPkwMdphCVCcNHG00+i3F7GV GDrQlh0EjI4BlgcZ1ube/t2OtQTnWHItObyHt4+zGxEqNymeGiTecLHt+w3fJEFCY8vr/JwJM oKrAAgMkhlf2UxdwnsShMM= Received-SPF: none client-ip=212.227.126.187; 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index eabfe4293f9f..64a9eab09770 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -137,7 +137,8 @@ void setup_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof(*frame)); trace_user_setup_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } __put_user(set->sig[0], &frame->sc.oldmask[0]); @@ -174,10 +175,6 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Place signal number on stack to allow backtrace from handler. */ __put_user(env->regs[2], &frame->signo); unlock_user_struct(frame, frame_addr, 1); - return; - -give_sigsegv: - force_sigsegv(sig); } void setup_rt_frame(int sig, struct target_sigaction *ka, @@ -190,7 +187,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } tswap_siginfo(&frame->info, info); @@ -222,10 +220,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr + offsetof(typeof(*frame), info); env->regs[4] = frame_addr + offsetof(typeof(*frame), uc); - return; - -give_sigsegv: - force_sigsegv(sig); } static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) @@ -259,7 +253,8 @@ long do_sigreturn(CPUS390XState *env) trace_user_do_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } __get_user(target_set.sig[0], &frame->sc.oldmask[0]); @@ -270,10 +265,6 @@ long do_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUS390XState *env) @@ -284,7 +275,8 @@ long do_rt_sigreturn(CPUS390XState *env) trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); @@ -296,9 +288,4 @@ long do_rt_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - unlock_user_struct(frame, frame_addr, 0); - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; } From patchwork Tue May 18 05:31:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441151 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1798129jac; Mon, 17 May 2021 23:13:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFtdAT0HCzo8uhotHWSRrph41YlEAV+cibB37gxtw9YsdUU5QlMnEq1eW2PRx3NYCofg/9 X-Received: by 2002:a05:6102:10d1:: with SMTP id t17mr4839299vsr.0.1621318399317; Mon, 17 May 2021 23:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318399; cv=none; d=google.com; s=arc-20160816; b=kKIG+Ygo5INEM5U//dfBRUm8NtfjVmMPcxzEEhPCwVkIa5Gw516MdputXQDhcIh768 ULymVIvWHoQ4ZePNT1O00iuh0ySEBWLUMBJisnu3MdrQ4NkcCQNcU3zFDVfGGHBbKfDZ 9j7pKBPNAS96C3LhaWFJ7Kj3jSwmsiQPddkGs2KIImIGwoWEBcvcMEtSsHdMjBHRcHjY zU9MT00tyrXvo5LcSI5W26ZBgMYnw5rNTKeXi4ZBMma7T9Ay4ZhX68sR+cKThZFsvqDz 243aTtjRGPQbT6I7aEg/P05dtypgBnKGnIGLUMfPHjYXdQI7yjzr9IvevmIRgFfo8Gxh NBnA== 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=Vo6Dl1Qp9eZdyZcBtl1QOozIJdh7pRc5aLtRTUKEkQ0=; b=tBQUKjaSjrrJ9iTe7M5V0P9IrAMYli6WfjErQE5yFgXmmERH22ztTVGMW8KIFxaNnG 0+Vr1WxRKv+YhFROM1O35KlZkvFvgrLYg7k1S/ZUJZipjepIxznutBvq/65XWzTkXFLu GqQ7Xt2g44xaAuEORQ0JU+eVZB7hOs2884l+5flTLN5slPBwJV4EkuHntu4V/+/c0s4R 6eDwCJEs+RzI7VqaieIbIUu1qKS3yHql2MhO0uwyW83ini2YeEgayWlC+acwZLxByrbo BCSkpIz7Q5bDdEZM/lu5J9FJRUgJ4DJxm9wkpPcHzJiL2jvJsMjFxCieh3uYwcm+554f zCgA== 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 w20si2864758vsk.264.2021.05.17.23.13.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:13:19 -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]:33062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisyk-0003ls-Mx for patch@linaro.org; Tue, 18 May 2021 02:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKr-0007n3-KK for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:05 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:50985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007AO-2f for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:05 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MS1G7-1lt1bF3Cgd-00TWmj; Tue, 18 May 2021 07:31:54 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 42/59] linux-user/s390x: Set psw.mask properly for the signal handler Date: Tue, 18 May 2021 07:31:14 +0200 Message-Id: <20210518053131.87212-43-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:qa/fa58/7CVeW+epwnsmG7QifkNJtcfhsspWlN1R1wbYIPDIs+a Qs7EOKsmJoryGsQW/MZoDA7usZ6cCnQTcXCIfPZ0D3tktQvOQ8FjmZdKndR9vff9WvOyJ7S L6krUKM00TGuc60ZCnqEibQjQ2gUCHq7/ajjVYI0FMbfkwiVCO7ZuOtDqMhrFll2D9M1nEB IcCK5p5FezP3q6Gbph91g== X-UI-Out-Filterresults: notjunk:1; V03:K0:FZGATEnyljY=:GUkpQOmk1lODYOzcGh/+Tn SjVMLUHVTdk/ZCDhuGyz2J+F9KBfEUXKfV5Dkps+6HQxTGZfTCxjkuAI0pw4NHRA1ZUC0X6GU xs85xbI3m+9OqnvhzpfCDAHfCkwy/iaKZFhqsFxScMGyKOu1mrLdkFsMFhVLyOxErOW/zL8D4 Omsv0zglZXDF0U5jcA4d2afsSdAVwg5WsDOZhDfx9VHX4Tqj4WLOvKBuJ4EPuWJRHebkDk0HH CGI4/WpmtI+oiUS2QP40f8YBkfrEkBVFWRij09f808c/1PZYsOxl0IsbYbh8yrL+uf7b8Cyed X9QzYsGGgjfw6vVavJ8WPuIraYi7Sxo1/f5VZN6blRo/5si8cQVa6s++29ss2ndwNXDUusFmT Z7BrAeq3Dr9AyDN4emi7rc0RiRT4VaBvbQE8onT1NmpgcR4MrRHRaRp2+o67N2H0DzPlkEl2h vOM5zU12hP4aMN3K57OqSfPBDTSxXKmokmRG++xTYiPyMZOCGugzTbcDeu9WBH1rR1AO8NZq0 WWWk29Vg2zbnsFivkhiY9M= Received-SPF: none client-ip=212.227.126.130; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Note that PSW_ADDR_{64,32} are called PSW_MASK_{EA,BA} in the kernel source. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 64a9eab09770..17f617c65581 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -162,6 +162,9 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; + /* Force default amode and default user address space control. */ + env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY + | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); @@ -215,6 +218,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; + /* Force default amode and default user address space control. */ + env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY + | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); From patchwork Tue May 18 05:31:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441155 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1802334jac; Mon, 17 May 2021 23:20:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh0Rwko2Cs1QwYf35tkU3s+BcX1957NoAMaYvoNoo/TiUtMI/z+L4omgsfdhde9leARMms X-Received: by 2002:a25:9d86:: with SMTP id v6mr5033773ybp.366.1621318800417; Mon, 17 May 2021 23:20:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318800; cv=none; d=google.com; s=arc-20160816; b=tcI2YfpOP6b+/pb6airM07XwQIDRA3PA8xvqT70IknszKC31H4E0OSDw32CY9T+jCK ofjJdUFn2cBafZ8m9hdkq2Wv2XFm1TW6zFsLeVvIoCNCO2qj68/EJ/BbyVreeomQ/Lcq lo9/OJocbnpxuMxsPaTeNQVTjtCr7Xmis9/iKmo7LTJfR6FuXHjNb8R6QVB/dNki0YDO dX1eiY639/OCpBa5S0LwcusxeWql+Itv5754TJUilNfQ/a07QL4WujGxl3HfSapWKLop o6BfNYeCcF2naSM/EZ4aAHNgp+/48QapN19AQuXOEcIZjeqx4WQDqA8UcGulOvQnwqwO yvwA== 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=XkPQmmEwCuu5xUszhkBehQaiYB97BAH08iNylEntFhg=; b=at73bfFW9wWYZIb5r8bAzXuRsxxSFLJzvDofxgpSvcVowxIIYyyHIaU0MrZHtswDud rkKsZgLPI3FpQkfzvJNPJTATxJFeFMQWKgqQBtsXGwK2diWsZhJ4Ayc0nAKklhuoUr5D ICxEFC2LVh8SOOoo8QqagIdZJgu2vrnewy39caZfrJphYi9uu9dncXyYHZEjRkwM8jId xRZB3lraZiah7hSNtibWw2QfKYSs8BDsqtFxCwqxNTN0BCYdUD6VhX0jlC+7TsWOnaIX va9ck81xsIxJe6tZBfV5nRcyseh8CTR8gHC2I67+RlwtWGKddmaoTWVWBW5JztBOD53J FagA== 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 c4si15464132ybi.210.2021.05.17.23.20.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:20:00 -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]:43248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit5D-0002NG-UE for patch@linaro.org; Tue, 18 May 2021 02:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKw-000877-Oj for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:10 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:51025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007AR-3U for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:10 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mxpqo-1lYUcf1HJ8-00zHEG; Tue, 18 May 2021 07:31:55 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 43/59] linux-user/s390x: Add stub sigframe argument for last_break Date: Tue, 18 May 2021 07:31:15 +0200 Message-Id: <20210518053131.87212-44-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:B8zeYb7QC5D25AedDnZGj3hnzb78tZEt7lAbrOmCnRPEQSK9stM emmiELAKRCIuyVoBtVEzmc65Jj52ja+a+ghh6CON2agri1UwS0FQa3UTykWE9fjZtXYd83h q0btGR5FYNHnIv6rwlGBtYriq/9uNqgH33B9elLL9R7pJpW6PwFq10yTM3YOjbQZmcVdkLK 2vqJ2XYYjTAqsXVwQE1hw== X-UI-Out-Filterresults: notjunk:1; V03:K0:5/s0C1ENJAA=:7Dx1dVOPKk/tYKzABMX/ii Qr1Xxe0FYTKpjY6iEoRm9oBHtgilSuAAFoNBtWis1MxFme5Kd7l46yM9hIhHSev67kT7rvE9V r3BXZVF6Jhc2ssG6Smg1YeKxRe49KbtsYTmlRXsVYr2gYoPdKfLYJbo06/wYvOJk3zyAQ0zZa zZ38+f7FkJrCE+ZWopLruNtuKU90RmmuIaeo7ep/F3MiQMav95Mn/kL9Vlk55kwSjKsZ/J6O7 xIrJW1e9X/Mki9HZBAyW8Yq+4rf/aNlc4UwihaWILW9/RRLigK0AdR89SUzeesTtS3PVlZkXJ Idjd2QlEU7bfZjqY8bEiR5d93iqSVYkhK7hbmz/s460VCqz6RgCYHId1uf+7Q4nWfeWSRnW7Z tkJmFhmEBD3BSGxMX36RQbvGCNPWHhS5M/Ooo07yGyLH3dYlar1lqwGjRnuO3blf8gatBWF1b hF9LlkRPUbTGa7/2dXD2dhy7dC7qPXJZjqyO+KzLBelCkb3zzu4N3xH8dhvpNqzRw6rJYLAoi f7bJ3qmYQLNoBZTjqTodJc= Received-SPF: none client-ip=212.227.126.133; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson In order to properly present these arguments, we need to add code to target/s390x to record LowCore parameters for user-only. But in the meantime, at least zero the missing last_break argument, and fixup the comment style in the vicinity. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 17f617c65581..bc41b01c5deb 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -167,13 +167,16 @@ void setup_frame(int sig, struct target_sigaction *ka, | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; - env->regs[2] = sig; //map_signal(sig); + env->regs[2] = sig; env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); - /* We forgot to include these in the sigcontext. - To avoid breaking binary compatibility, they are passed as args. */ - env->regs[4] = 0; // FIXME: no clue... current->thread.trap_no; - env->regs[5] = 0; // FIXME: no clue... current->thread.prot_addr; + /* + * We forgot to include these in the sigcontext. + * To avoid breaking binary compatibility, they are passed as args. + */ + env->regs[4] = 0; /* FIXME: regs->int_code & 127 */ + env->regs[5] = 0; /* FIXME: regs->int_parm_long */ + env->regs[6] = 0; /* FIXME: current->thread.last_break */ /* Place signal number on stack to allow backtrace from handler. */ __put_user(env->regs[2], &frame->signo); @@ -223,9 +226,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; - env->regs[2] = sig; //map_signal(sig); + env->regs[2] = sig; env->regs[3] = frame_addr + offsetof(typeof(*frame), info); env->regs[4] = frame_addr + offsetof(typeof(*frame), uc); + env->regs[5] = 0; /* FIXME: current->thread.last_break */ } static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) From patchwork Tue May 18 05:31:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441154 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1800727jac; Mon, 17 May 2021 23:17:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeUbfhahc2EPcuAJpw9Vo90qwrNz5GIk9wvhgf2KTumc0hpdVgmKXLn7Oq9jQvudhBwV62 X-Received: by 2002:a25:ad9f:: with SMTP id z31mr5007791ybi.130.1621318640901; Mon, 17 May 2021 23:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318640; cv=none; d=google.com; s=arc-20160816; b=voWfKaNiOgiiR1OIroxRjnhz7dkB9+UAHjJoirKvHXRwOeNKS9sZ+BZg+r2V/BMNvC UtPFX/mCKah2XsREecpYyUKMmsskDkthZxgKqDD7yFc7U4EQEEQ8vi32Tjr69ByPOZOT ixju7r0J6R4uOYi3kbXnXqJGTSvxtyVpsTkaAHwOaWy2FdfbU28H2qHyHioxt1IfoRj2 D/APzEKMcdYCsuW52PzL3DNIn1nZBptcbmGTYqO9tiZOhEI9unLS8ls5qxXfazKwtVdI IJFK8InDkS6utJz5bB1qQV+OovJuDedbfHWWL8VqaBpqjgy5xwWpRaHGYcc5bVqQIz4l 04nw== 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=MKaTiylhNCjUv3zVUeGHxIwA0dfSM8mAfQL0F9dhnhA=; b=PezQU/V5vaV13mfI/ikjqnDqpZQd3WGNM4J4f5S2XNWC0k/aqvff9H2/8N3Ifvx4fv G3K+Po+fcG8hlxqAhwe2TeS2NZ78gucxaeaF6Vz+7XVuRGogCPW3zzhdaKDVyaQRLK7N IABD0XJyZuh+3HKpQR+XsMr8+IJddaeA+nsIYLq8jOFKw7/N71SHJfOvM2/dmjr1XOTW J3IOQbmcQfpUxHo4NDnP11/hrwEgiU1UadK0VW6yRN/FRS9OJXgwFjt32lCqCMeIkYQX hN+kLSjNnrmhbj2UuXgNE4PT2zBCfQaxWyzvE6Aw/jQBxu7sJmiCxvqzdSXOHXEPpf9Y pCtA== 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 u17si2070190ybu.151.2021.05.17.23.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:17:20 -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]:38850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit2e-0007oq-D1 for patch@linaro.org; Tue, 18 May 2021 02:17:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKs-0007rv-O9 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:06 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:35477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007AW-3C for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:06 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N4eOd-1lIrRE3dxP-011mCv; Tue, 18 May 2021 07:31:56 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 44/59] linux-user/s390x: Fix frame_addr corruption in setup_frame Date: Tue, 18 May 2021 07:31:16 +0200 Message-Id: <20210518053131.87212-45-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:SZ7kuAOZ0C6B91UsjZ4NYREWa4kcI9+Qh+fUMvnTFnFh1Qgvhfh LRJpoFdflRaNVwO22o50ZCKPgDLrjlkYGYgU8KlQDTboqYVNaRKBnz+ecwY5Sryu5dFxxrx ruUKXmGnMDXtT3xPDtj44lz4QjABz/xfIP+9FkH6/meSWGBvnn3jsWmBSLsJ3Pph2R1RudY iHFT4ypIXxmtmHpVJoBRA== X-UI-Out-Filterresults: notjunk:1; V03:K0:EgUM2E7ZBaQ=:CbPm2d6+KlnQOnQXdK/XnT /BxNIlpkYwLP5kYRAhFBq+tmIl8ayigwgeakoF6bKJAJWq2rPWbRfj98pMXxr5ngY+2iSx6IS ljcKzNde2UhSCLdPLkoqsO2rZPbonbxpBw1zV7CqTaSa3nPatU4I3TsYlkmq+v+YT+i2aQ2ZE w6JevCbUv4fLUVCJ9F5F1ai/PA6fx4be+xb3kIYtwxkP3f0KV2fjzEAjhV23KPrBIxqzWpe8Q BSpUBmOi8sq/pqTwL3Y1Mzv2hPSEU5Ey518hmgHioKV3CvvHsjc7wgLxgqG3xPefbFs7zd3WQ rxnLzx+Q5RSTIwsDvCwkx8oTCDYGOmpxySlOODBvx0zYyFeU/VQzNJhbjHqn/ATa8odt0LXrc oQtgSzW+Cb6PS7sbaphBdTF/320J46LWbtv7bLfQzHMJDSfN7Il40d4NRp3TnLEYHuoH7TVoG rN6Z0fLOTRVOSsnCeYABrsUj1M58psqCR23qBeA+GwiaV7xvuhWj9aIgNWztTox9g+lUTgkYg FIj9E9P2/7kSHmgonByZG0= 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The original value of frame_addr is still required for its use in the call to unlock_user_struct below. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index bc41b01c5deb..81ba59b46af5 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -168,7 +168,7 @@ void setup_frame(int sig, struct target_sigaction *ka, env->psw.addr = ka->_sa_handler; env->regs[2] = sig; - env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); + env->regs[3] = frame_addr + offsetof(typeof(*frame), sc); /* * We forgot to include these in the sigcontext. From patchwork Tue May 18 05:31:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441153 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1800716jac; Mon, 17 May 2021 23:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKevFPrpduZoJvtRXVJcl72Cbf0QjMO9DuKrK9bWAnkWK/NO2uc19AJ+vKPK4SPCAPPOTA X-Received: by 2002:a25:8543:: with SMTP id f3mr5207886ybn.80.1621318640062; Mon, 17 May 2021 23:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318640; cv=none; d=google.com; s=arc-20160816; b=L0fum4XwY4lOKHC1ifmPSpbvZe2FVOYR++e5Jwpk1an15DpATHXrnhL8iYzwXGU6ak ti5x4kyujS+Q11Q50Ya0Y87aUW0Xr8Wb1Gw0waWsWw282taj4FTSrH/5M/1/3VGti6Wn kuiQzzSPvB9h48BYLxABlHWm2RsWtxeL2jM4R3DATDl4yoDONc5kQ2TW2C48yizfMuTF lWUs7/9KH6nYQWPxM8J3PMut1D9fXz6fmWBGhp0TGTskUojtlvCw+AjlXY6jya+y8gZH Ty6n0wrL2fUUxNb9qBZU/a0G2zmZn4N1haXqVdaAIkNBV21Nal0egWv3AkvUCzYAsBjP 9auw== 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=njA1vIsCq4RtA6O2hMBIync3H+LHwCosZAH7cFlzsH0=; b=t5vaT3NINMXBc8e8uM9kPydc0v92bcF13XO+zqOMDc1TsOYXBPc2N2sSy/RkEqzzcI 7Fac17em/Wq5Ev8OxIdiijaSbnkUtddPDbvnvnR0okcTvA/kpQPDJIW7qOTt42HGhppC qTu+rq/TfWYzdEljSjzFYIpSOaLwfQliQ7O7a+IYkbsYgLWM7WwLcmZWa5xZhHbWYr4h Wu+iDh1ApCDTRwv2j0Q6OViB+rlkDPW+uRP7MnSn/WRMsc3VNekFJ5kneuw4Jy/KE81h 3Uc3duwpZjAxy/YrNvuC3YW9+XtuwuV6/kNxDVQN9L1/QS4hpO+G+BjRMisopNyUToa4 X/cQ== 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 137si393090ybc.357.2021.05.17.23.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:17:20 -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]:37492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit2d-0006s0-IF for patch@linaro.org; Tue, 18 May 2021 02:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKs-0007oK-0G for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:06 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:48807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007Ad-2x for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:05 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MHEPI-1leUd21PzE-00DG9u; Tue, 18 May 2021 07:31:56 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 45/59] linux-user/s390x: Add build asserts for sigset sizes Date: Tue, 18 May 2021 07:31:17 +0200 Message-Id: <20210518053131.87212-46-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:67j5AqJGsbL04czHgkpz4p5+F0BEW+pTridcSZoViXMHLJcRnxS HG83q5NBR7IjB/8BWTmQSQRUMUkHMpMEKHyhcyXCYBBMivYv34alENyzlbZbUyZODMD0V4t ta0D/F94a+NH0jpoYXbJY+ksiEoPzOGieI1sYqNrv84cxKXU7aEQp0QgiQBCJ9/sqJzt7M5 lmhOo501069D7FYif0pLQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:ofUPTZ16NJ8=:FmQsXo5RtrB+NzZA/Cqqx9 abK6+2y8tJIMNyJ3bH/qwsB5f7B+ouN0KDvsGhNpq77ky7T/+p9B+MjghjlPLXRJ9kXAocRDT ZHoQDlJWx2uNyiI2seEC3V2Xzc+583IP3hQAIZgNjG8o8dfTq/KSCPC657+02rRBEFcHdb8CE r28D4U32vUXkQ6aRJFa4s4xuZvSDGWpjgDKHGsaJ9RDom8K+alJLCMipeRkSsI3tXrIXPRKuD Quh76OibVkl+DT4tZBYaF7culrzB600rB+LzrfSFhxPLOHavpNbsufT5v6OXYGpDY2JQoFx2y R5PsYpd5ePGAarhsVBEgnLsvluM7eyVemRsMLOh23FokiUHfNwgd4l4Uiy8FSQaJ1LRuBCuTu L+6qm2muolaxz75oW1JWlw1juDBd9CWHF8Ed8inWAGeiqFUezy6S53Gnd3UHfaABDRk7nr5dv xoRlgNofFD5oCjJcaiXvhh5qm1auAZ4hMxTtMoIrIU/cw9fFAjSmxOPyv7RelofUGFjponH0g Iv2zQ639WLEMS9yOrtPH0g= Received-SPF: none client-ip=212.227.126.187; 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson At point of usage, it's not immediately obvious that we don't need a loop to copy these arrays. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 81ba59b46af5..839a7ae4b3d6 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -141,6 +141,8 @@ void setup_frame(int sig, struct target_sigaction *ka, return; } + /* Make sure that we're initializing all of oldmask. */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(frame->sc.oldmask) != 1); __put_user(set->sig[0], &frame->sc.oldmask[0]); save_sigregs(env, &frame->sregs); @@ -266,6 +268,9 @@ long do_sigreturn(CPUS390XState *env) force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + + /* Make sure that we're initializing all of target_set. */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(target_set.sig) != 1); __get_user(target_set.sig[0], &frame->sc.oldmask[0]); target_to_host_sigset_internal(&set, &target_set); From patchwork Tue May 18 05:31:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441126 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1781149jac; Mon, 17 May 2021 22:45:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBuTXRvv/V4xJAbvueEvj551yxcu00aQGDL6IxUFfowFh1nO0nppJxkWoqJiw600b0xOTU X-Received: by 2002:a05:6102:32c8:: with SMTP id o8mr4442027vss.20.1621316748594; Mon, 17 May 2021 22:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316748; cv=none; d=google.com; s=arc-20160816; b=cx+9cxFYBp7+fvfusYdtoUXee6/tFf3vjY2XZ0KgJT3uyfyCbp4c1WRUcvDar2RXB2 Xu60eajffKR5fTxAyd7hEHMMj11Dqyw5MPTWsKf81vBah1Kga6afsgUBw0ffeVi4sH2o JTsBsPegXSwipqjp98vmv4wDMM01ZvwgbLpChZk6UQ8b+S8IwUTw3y9SdiQ/STverGlS lYI7Xrx+G67J/WjiaRqPl0iA2pYzxWfqwJ1Lj1go64ELm6bY/O6bPtA4gwpRXd1dGE6x TtKvsz1s7Qmmx+vTPcopuOjdX+ux8EHT92pKrpqtFWL5UQXnww7KZGcBSGpL+7TolAVQ 75rQ== 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=fjU0QaOwhlfOwCDWXKYMd5ILKcmprMipYdWURQqx3Kw=; b=PpwQanb8ZIy14MlAWQnsx5J5HMWDtujm5p77ol4gN0N0IYaZnTlM5OqBfj4mVGtgUh ZOzziVGnmCLSQs6Y658VPYhOX9qhOBjc//3kOjqw5JeQb8tQu9hlbuGua44mcxy1fo0r iMCUCi9lBVDBeRYZGtRC/GGERVMpXC40NU3MoVz5fYk3vUvkmUUSPGe+/LhA6Z3hSjd2 KNVXdkTPgqQDDCX7B/hn1FF4otRO8aQIgoYXRYnpCZq6Q76pUFyVWCsdbAY4sDlKxYwl 1E8Yq0Ljg90qwXoVKToWdRHwffPDZhWj/4C1fDXch5b7Q/3jg2pwCEN+XagR02AMG0m+ 4/vg== 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 l3si10004460vse.24.2021.05.17.22.45.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:45:48 -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]:54060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisY7-00020A-V5 for patch@linaro.org; Tue, 18 May 2021 01:45:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKq-0007ii-Gy for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:04 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:35795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007Ag-21 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:04 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MPK73-1m7pAn3RGf-00PfAB; Tue, 18 May 2021 07:31:57 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 46/59] linux-user/s390x: Clean up signal.c Date: Tue, 18 May 2021 07:31:18 +0200 Message-Id: <20210518053131.87212-47-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:aF01Q0c1rPkGnQ23tgwGNdebELuEzZ8xhHxMhWwu+us3Mz1WpYN MHmD9D7XNKBslsN9VrHQMN7Zx8N48fpHZ1FpP2Xm9Wh+vvy2sU7VWCXa+SJ4hI0AZxsIS2x lP9uhbbtsY5HELTHOBLhKXKz28nUGfl/Whm7sO2jzLLBSZ8BET7NwSDlLtM2yYozhnJttDW GAj3Du/9vcEUWiu8EnhDw== X-UI-Out-Filterresults: notjunk:1; V03:K0:dt3sB+B6qk0=:kAtX3DkjoKRJH9v7IeaxnE nxU/YeG/vWxquBEo8bXOGITxfE0r7cVaKyS+b/njDBJpba+QYV/hCix5ALR63jlfVnVldQbUE UegTlt/ug+tR+JxCWakEMr03lHqbcqOHC2IsXy7cKXBk8v2uo6ssXlhneBGXm7PqRFlh5xHEH HH1ChwO8V05CYXDB5AjtGYgB8BRzXTFXSgsD5UvXg8lVItEtFodWusnqFnvAaDdxq3cXt0l4d 4IGLvrMh42T4FhIZWVwhdFlGL529hGD6rKzMESioKOSB7WzRuY3ihstdEuuSL+2bHQB0Vzt5W ymkbl1hhCsgHwb4T2SSZzRP14lW4ICEZ64mPlUBeqpi11VcBbgHmgc7IHB3dKCPMzg4c2cPm9 kul1IO1FrKICFw9Gl6/JOmbqvNQjvAfloqcPOtRVe5d3hbeGKR39c+oPr3Fk0xYIExgiRHXYd ryW3mLhhuCjyxU2OqLYWY9V2bNWWgz2LGSWOY9PwOek15QmxVud5MH30Gum4r5srHvchucpkf TQ3SbFdQ3x3r4DRE8PgBxA= Received-SPF: none client-ip=212.227.126.131; 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, 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reorder the function bodies to correspond to the kernel source. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 63 ++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 24 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 839a7ae4b3d6..9d470e4ca069 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -133,6 +133,7 @@ void setup_frame(int sig, struct target_sigaction *ka, { sigframe *frame; abi_ulong frame_addr; + abi_ulong restorer; frame_addr = get_sigframe(ka, env, sizeof(*frame)); trace_user_setup_frame(env, frame_addr); @@ -141,28 +142,39 @@ void setup_frame(int sig, struct target_sigaction *ka, return; } + /* Set up backchain. */ + __put_user(env->regs[15], (abi_ulong *) frame); + + /* Create struct sigcontext on the signal stack. */ /* Make sure that we're initializing all of oldmask. */ QEMU_BUILD_BUG_ON(ARRAY_SIZE(frame->sc.oldmask) != 1); __put_user(set->sig[0], &frame->sc.oldmask[0]); + __put_user(frame_addr + offsetof(sigframe, sregs), &frame->sc.sregs); + /* Create _sigregs on the signal stack */ save_sigregs(env, &frame->sregs); - __put_user(frame_addr + offsetof(sigframe, sregs), &frame->sc.sregs); + /* + * ??? The kernel uses regs->gprs[2] here, which is not yet the signo. + * Moreover the comment talks about allowing backtrace, which is really + * done by the r15 copy above. + */ + __put_user(sig, &frame->signo); - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ + /* + * Set up to return from userspace. + * If provided, use a stub already in userspace. + */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer; + restorer = ka->sa_restorer; } else { - env->regs[14] = frame_addr + offsetof(sigframe, retcode); + restorer = frame_addr + offsetof(sigframe, retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &frame->retcode); } - /* Set up backchain. */ - __put_user(env->regs[15], (abi_ulong *) frame); - /* Set up registers for signal handler */ + env->regs[14] = restorer; env->regs[15] = frame_addr; /* Force default amode and default user address space control. */ env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY @@ -180,8 +192,6 @@ void setup_frame(int sig, struct target_sigaction *ka, env->regs[5] = 0; /* FIXME: regs->int_parm_long */ env->regs[6] = 0; /* FIXME: current->thread.last_break */ - /* Place signal number on stack to allow backtrace from handler. */ - __put_user(env->regs[2], &frame->signo); unlock_user_struct(frame, frame_addr, 1); } @@ -191,6 +201,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, { rt_sigframe *frame; abi_ulong frame_addr; + abi_ulong restorer; frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); @@ -199,29 +210,33 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, return; } - tswap_siginfo(&frame->info, info); - - /* Create the ucontext. */ - __put_user(0, &frame->uc.tuc_flags); - __put_user((abi_ulong)0, (abi_ulong *)&frame->uc.tuc_link); - target_save_altstack(&frame->uc.tuc_stack, env); - save_sigregs(env, &frame->uc.tuc_mcontext); - tswap_sigset(&frame->uc.tuc_sigmask, set); + /* Set up backchain. */ + __put_user(env->regs[15], (abi_ulong *) frame); - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ + /* + * Set up to return from userspace. + * If provided, use a stub already in userspace. + */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer; + restorer = ka->sa_restorer; } else { - env->regs[14] = frame_addr + offsetof(typeof(*frame), retcode); + restorer = frame_addr + offsetof(typeof(*frame), retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &frame->retcode); } - /* Set up backchain. */ - __put_user(env->regs[15], (abi_ulong *) frame); + /* Create siginfo on the signal stack. */ + tswap_siginfo(&frame->info, info); + + /* Create ucontext on the signal stack. */ + __put_user(0, &frame->uc.tuc_flags); + __put_user(0, &frame->uc.tuc_link); + target_save_altstack(&frame->uc.tuc_stack, env); + save_sigregs(env, &frame->uc.tuc_mcontext); + tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up registers for signal handler */ + env->regs[14] = restorer; env->regs[15] = frame_addr; /* Force default amode and default user address space control. */ env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY From patchwork Tue May 18 05:31:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441132 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1785745jac; Mon, 17 May 2021 22:53:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb1c93mykY+dt+JzKPjEfgQlYetqSBzhixzo1xHdbXDhLXYRxz9RyxPZmON2lEmT7+o7wc X-Received: by 2002:a37:a2c5:: with SMTP id l188mr3726875qke.413.1621317213261; Mon, 17 May 2021 22:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317213; cv=none; d=google.com; s=arc-20160816; b=FVs9Sw6nDAd7hPQo194hCOSM1eU7f8vXscAbCmIFnbSdbT0P9oXPPzRVcIkYT1B18E HHV0lHZl5Hasd/vhrstWqSLluDOET2XS9MMKLfAk0kpeBe5Ctz5xu0Jc0LfMjbm7AuSv UJMVYo64zz/5afF8Z838Y8W7Kk3O5jnqBwwOfR3MyLaKWb1cQoArFT8wqnDrAMyy/vBU Ei5NYoiQtcSvLNqrNJ6hxinzSISX6AF2Lly5nDKrPLhnkZCORQIASWyNcep3aTBbmgDP CYpq42dQ8bGkukSQbddhpDpzrGFcRRRT0tSxYCBA4cD0y7veFT+50E7hrqUeZTUCyD9C 0wcA== 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=c6LPnyio8Cv+TSghNAq5xCG139DThUAiHcH9HMINg68=; b=GqCC+EGQzKbtfquAP6hCh4/dEmBY0aFAKJkQg94XGP76Zab5gSzfCSBsFB4sIeQC1b 2CM+lniSIM4Bu67JDxI/IhXw28HIvt8ha1WLndxnGeZhmIVHtHqbaAwo/Pg7d8Xd0o6u YHYTMRAy061Ro4Le6nPZp4iTl92kXIvvH5lkfucO8XFI6S3LTdeA5EfGSvnA7lCFoTuS G9J72DJlFRA6IMD6VAsgodwCSc3xblIiC/WknRi4GJZZNDHtLTwegPKYDE56Thn7aR+f qiZyk/EQPHSQjOtK4uZQHbAH3vXWg7s0UrCMb0EGKrRIGDZjbYN8OUBhkyTnAWTgg7tE CZgQ== 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 r127si12565825qkc.364.2021.05.17.22.53.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 22:53:33 -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]:42748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisfc-000557-KV for patch@linaro.org; Tue, 18 May 2021 01:53:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKu-0007zl-GF for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:08 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007Ap-CK for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:08 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MpCz1-1l7vEI1HAN-00qiVV; Tue, 18 May 2021 07:31:57 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 47/59] linux-user/s390x: Handle vector regs in signal stack Date: Tue, 18 May 2021 07:31:19 +0200 Message-Id: <20210518053131.87212-48-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:pduDJBBa1j5WPg2tbxd0kzTYo3QwAuSCsOz4rlxPUwgEnVg+AEE LJpbYsVCkvvPMs/NuVj9ANsiMT/c+6wWdyiLVfDGugjXSpeWskKp5R5Jk+v/TrC4QzPIkpL VSKYq0aD+91admWhBOkPeniHzOnL0O5QJxj7BBsS7UwH81j5tY0mwcpTg28mABPE9gNoxT0 YEqh/afnmsMJhMj+wo11g== X-UI-Out-Filterresults: notjunk:1; V03:K0:A6io08Te8Bo=:oXg6fa3ITkINEKenSFhoBK uo+qihW+pOWPcQJ+SJ8Ky5AbtP9WxwtINoz3+B631Fee47ErhuLQfx3bp5HNhJo3njx0ToGyW 3Sx11exjflrj3/wMLIRAvSQjSv6EPArX7pKC+BE/dbWT6x789BBS464j6YT5zNU2NpYV4vtbo WPPWCXbWa3F9rQCABDynqUPdfG37NHkMxDErG3J3c85YsD7P/PXve4rYlhdSYPWWzms8XuITg NKTap23Fcd1Z2H0yv0A/Ipi8rghc+xdElXqazVmIlCWwf6AsPDDvtHNLjy8jbN75ZBG6s6F5L S7kQSe67b1FvIFHduO0A8X/RuRAvFxrckIj73lSWHCoIki76oZWinHFfHyhQnobtVVrzqvO9S Ygz+1IzTrqEw+dI1syuhaC2W2UtBdPXoou5UgCKXj8PJYekjws3PM6V5sB4X/9Z16B+k1Xcpf QenNi7IKdZXcy8HKRMLPqUlrCgcmfHyGOtWZ1/s2NovscET2O66Bqkq40DUx9I3NsvrbsKV1P ga9L2EqHd9O6KzE069ddVw= Received-SPF: none client-ip=212.227.126.187; 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 , David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand Message-Id: <20210428193408.233706-16-richard.henderson@linaro.org> [lv: fix indentation] Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 62 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 9d470e4ca069..ef136dae3348 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -50,6 +50,12 @@ typedef struct { target_s390_fp_regs fpregs; } target_sigregs; +typedef struct { + uint64_t vxrs_low[16]; + uint64_t vxrs_high[16][2]; + uint8_t reserved[128]; +} target_sigregs_ext; + typedef struct { abi_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; abi_ulong sregs; @@ -60,15 +66,20 @@ typedef struct { target_sigcontext sc; target_sigregs sregs; int signo; + target_sigregs_ext sregs_ext; uint16_t retcode; } sigframe; +#define TARGET_UC_VXRS 2 + struct target_ucontext { abi_ulong tuc_flags; abi_ulong tuc_link; target_stack_t tuc_stack; target_sigregs tuc_mcontext; - target_sigset_t tuc_sigmask; /* mask last for extensibility */ + target_sigset_t tuc_sigmask; + uint8_t reserved[128 - sizeof(target_sigset_t)]; + target_sigregs_ext tuc_mcontext_ext; }; typedef struct { @@ -128,6 +139,24 @@ static void save_sigregs(CPUS390XState *env, target_sigregs *sregs) } } +static void save_sigregs_ext(CPUS390XState *env, target_sigregs_ext *ext) +{ + int i; + + /* + * if (MACHINE_HAS_VX) ... + * That said, we always allocate the stack storage and the + * space is always available in env. + */ + for (i = 0; i < 16; ++i) { + __put_user(env->vregs[i][1], &ext->vxrs_low[i]); + } + for (i = 0; i < 16; ++i) { + __put_user(env->vregs[i + 16][0], &ext->vxrs_high[i][0]); + __put_user(env->vregs[i + 16][1], &ext->vxrs_high[i][1]); + } +} + void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUS390XState *env) { @@ -161,6 +190,9 @@ void setup_frame(int sig, struct target_sigaction *ka, */ __put_user(sig, &frame->signo); + /* Create sigregs_ext on the signal stack. */ + save_sigregs_ext(env, &frame->sregs_ext); + /* * Set up to return from userspace. * If provided, use a stub already in userspace. @@ -202,6 +234,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, rt_sigframe *frame; abi_ulong frame_addr; abi_ulong restorer; + abi_ulong uc_flags; frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); @@ -229,10 +262,15 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, tswap_siginfo(&frame->info, info); /* Create ucontext on the signal stack. */ - __put_user(0, &frame->uc.tuc_flags); + uc_flags = 0; + if (s390_has_feat(S390_FEAT_VECTOR)) { + uc_flags |= TARGET_UC_VXRS; + } + __put_user(uc_flags, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); target_save_altstack(&frame->uc.tuc_stack, env); save_sigregs(env, &frame->uc.tuc_mcontext); + save_sigregs_ext(env, &frame->uc.tuc_mcontext_ext); tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up registers for signal handler */ @@ -271,6 +309,24 @@ static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) } } +static void restore_sigregs_ext(CPUS390XState *env, target_sigregs_ext *ext) +{ + int i; + + /* + * if (MACHINE_HAS_VX) ... + * That said, we always allocate the stack storage and the + * space is always available in env. + */ + for (i = 0; i < 16; ++i) { + __get_user(env->vregs[i][1], &ext->vxrs_low[i]); + } + for (i = 0; i < 16; ++i) { + __get_user(env->vregs[i + 16][0], &ext->vxrs_high[i][0]); + __get_user(env->vregs[i + 16][1], &ext->vxrs_high[i][1]); + } +} + long do_sigreturn(CPUS390XState *env) { sigframe *frame; @@ -292,6 +348,7 @@ long do_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ restore_sigregs(env, &frame->sregs); + restore_sigregs_ext(env, &frame->sregs_ext); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; @@ -313,6 +370,7 @@ long do_rt_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ restore_sigregs(env, &frame->uc.tuc_mcontext); + restore_sigregs_ext(env, &frame->uc.tuc_mcontext_ext); target_restore_altstack(&frame->uc.tuc_stack, env); From patchwork Tue May 18 05:31:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441140 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1790801jac; Mon, 17 May 2021 23:02:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG2SzByg6SDjr0vte73AwpgLfEe9mqW8WAYMq6keuhX/ZVTPBxmhWgtRPFrpYdLLFfJ4iV X-Received: by 2002:a05:6402:652:: with SMTP id u18mr5007820edx.388.1621317720722; Mon, 17 May 2021 23:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621317720; cv=none; d=google.com; s=arc-20160816; b=jo4NFw9YSOUVIaK3Q2R0xJ6K66Xj8d4BMbKq287Ixrn0LuQTAu0p1uHliKwMkOifdn hXDrIQbxEmS/kaHVhoVZUsylalkAtkHw9SRLIVR4D9qUYHwQZfZM4LCAsKLkw5up0k/g 3WNJ0C6MBsa/nVNp43PQWv01vf+UQIvqc0pjPPVO7Uv8q9UkBdlg1Jy+oggCB1swEmuo lSPY0yRN+VH8X1RsscqWtSNiZuM5pJH8/b3UHQe2qCu799yQgW6ZGb+7WJonSEfCW8qU 5nQPS50ycoHEwlKbcbDJPGNi6yrwrx7WctXtNIMNhN5SPu2dqmzRMAeCFlHgw6PHGzwX kQxw== 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=SHXFw/lm441ltxVIH7llVHQUK9TP/BYp89V2Bh55SSw=; b=uUjT7MN69H4QthNdEjh/HEPiQFfzGyVEqrDCJriHVZ+P6HXj235KF9gjNkO8Cw17oG QGLzhUyRA0LHCkJiL+wn6rxBvgidiBWuF9cWmCIVNyG9Dwy2Xcyj57F+ZqtwtSy4RJ+D cKEPY3XJCeZ7dp0fiKcQLs6kGqHMnTYqwsBnBtf2cJY2jzTmMkYsgjRiOQc1Iyw7Ow+/ ootMbgUageldkKxBgFzA3cz8qYsr1q9HB4rNRhl/B/5NLsFFniHSzMM9umpFNdzheE0N np43Qx4HRmH1Gb89t9gBCUxv4ENas2s9goF6ApYmpzlvb5uUQxBm4cLxdfNG47uB8cKo dVgg== 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 j23si19379148eje.99.2021.05.17.23.02.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:02:00 -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]:42180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lisnn-00079K-QH for patch@linaro.org; Tue, 18 May 2021 02:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKz-0008K9-Pg for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:13 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:40871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKq-0007Ck-1r for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:13 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MQ8OG-1m4muF1Vaa-00M5ra; Tue, 18 May 2021 07:31:59 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 51/59] linux-user/alpha: Fix rt sigframe return Date: Tue, 18 May 2021 07:31:23 +0200 Message-Id: <20210518053131.87212-52-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:e5OnsQY3zjS3zMosdWV40i3jmzJBdzyTDdM9Ze2ij5XIG1i0Afk AAkOS2tzxmWJZ1rNUVcFzabr1zmT34HqiswPWiVFDAKITH9ErFNE7oeGOeYiStc8sh9TxZm S3Wlds/asirNWFqb8Y17v8AkTVJqyb++gEx9gxn7CpoERtHNaMSV6RPSFkVCiQujdroa0tn Rk5gnaleSsvYKMOMaLbRg== X-UI-Out-Filterresults: notjunk:1; V03:K0:qqe6ScYZYxc=:Do0dWQqs2sCC/rxhNQUVGH vY+xf+PnauMLfJdX2IXVNyklQqSvcb6An6Bc4GKDiGAvytfwHag1bOzW66FhGKCvQN4eu6zhN AeuLCTyqMSMLq4xzAAWw+0FeeoRhaj5RubKyryCuSp3OGc0I5btO66VuF2FAWWXHX00zLkBmF AevO7S3y9KasA5GH0/dOIxjdRY68I1a4F0XIpd/WKKjpYTn6ALCC7T0MspVwE22jEExkofFBw NzgVzsAxxWZ7qdjXaGMezit/j8Uw127qxzurOsVHM0mLZoB0Z+M/J527vhne05UATh16r24LC 6KeKbciBII+YuMpqMKR8hH++QA2rMRTPAiAd7X7kTjyQ1Z+R7/ZhYXi4uBVoQWb5WFOsGX4Ef pkJmAZOgXMsOTIK6sEY4QNI8WNDGgRyR7Ab0WkD3ZiBwyRrYb5hhuHI6ZDFbiVOI8DvRSLunS YDzsa9uCvp0GLmNtGsc2FGu1l6VvBkerNZfBcFwP6m5wGTMLsPyabblcC7a8ziD1BaKG2XRH1 ZpUayWrL9CfTCdfCkNvROw= Received-SPF: none client-ip=212.227.126.130; 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, 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We incorrectly used the offset of the non-rt sigframe. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210422230227.314751-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/alpha/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index d4e4666874e3..0eec9ba3fd82 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -200,7 +200,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, &frame->retcode[1]); __put_user(INSN_CALLSYS, &frame->retcode[2]); /* imb(); */ - r26 = frame_addr + offsetof(struct target_sigframe, retcode); + r26 = frame_addr + offsetof(struct target_rt_sigframe, retcode); } if (err) { From patchwork Tue May 18 05:31:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441156 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1803702jac; Mon, 17 May 2021 23:21:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDjpGepq6HeNp1rYqiCyykGtGeesVqx+nqRHUPcDE9aTrUAcCbs68E66cusOVEFRk9QJy/ X-Received: by 2002:a5b:787:: with SMTP id b7mr5207392ybq.243.1621318918377; Mon, 17 May 2021 23:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318918; cv=none; d=google.com; s=arc-20160816; b=Bn4fH3p7HvITwpu1fynnRFsx+lV8Bch94DFdTHeEe38z8op/8OLDM5aaUv5ocThbtP TQ+No0Y9+C8oX91KPoRUb67JMMAUlzqS0WDX1hCXKqKGfwO2jkYDJzSSMQVaILxzKsjg /4K/krJ8Cj9tCzgT/oBwuJasgwLYkqhQ4OqT4XMSaTML6a5+VJhjZ1iMuDtJnuBmwgyd IWGXuUphVzZBDIXYfAo6Jabk83eXlGm2KBIcLdboJRsv/rNzc4WKGxgguc4GFiGPq7BG dohj/3B5LmysXfbP1BkvRE7cXd+AgyrT25GY/iyDBHWP4v9ypG7lZO2p008kyfxWhmzY HvYA== 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=RJ+sW+zzu1E0vb86Cj/GRhjd4ax6PDfQ4xz4vzCw+mI=; b=0cAlFlTImteP05kMotnh+SEUgyWLmb54Utz4IdTB83Z9MwCO0uaMqkzI0N0d4WeOCf cALpQ42WrCf0i4g0N9zXXc8i6zQ214hv5BsedDsQHYVYjGFr8sC3fz6KvT+rw9t37a1j UNyegwM112kXcuLj32L2yT/bWiEjGj8L25sPzvfudLZWlgtOLO3SVNr9XDm+SMhdVMGU PSIC1q0VQ+P1813Z+tS6pbWrTgX6LOFnCDJa4faKYErRQ1ICyWH2SEg7jjAeE2qbbUKM CqceLXjJzgFoRs2k43RA9p9jtiRSj6oucAk48Y46yNYhC9goutKJPYQyvYO57ERAwN8w 1WsQ== 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 x15si16989039ybj.361.2021.05.17.23.21.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:21:58 -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]:46218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit77-0004Pb-Rr for patch@linaro.org; Tue, 18 May 2021 02:21:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKv-00082c-Js for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:09 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:36443) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKn-0007At-TL for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:09 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MY5XR-1lz3kQ3ZOv-00YUrr; Tue, 18 May 2021 07:32:00 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 52/59] linux-user/alpha: Rename the sigaction restorer field Date: Tue, 18 May 2021 07:31:24 +0200 Message-Id: <20210518053131.87212-53-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:K2psfa9jXqEEivhDCg+2n6aQTY9DWHOizqKOq3PZCCjgYx2pY4h i7g8TDkRNxflnWxZ1LgzMlQ6rtE9VSmCY2Er6udjyW29Wf+6zOJb6XUR0CmCTUTrxdTNSNh YxGswmwviR8RDi6vHP+9ADEED871dKPWktc6Z/ctmeXaGJWnidmV2TbYU15N79gOXL+xnLs ZKLRXsbqHnVI3hmFfDGCA== X-UI-Out-Filterresults: notjunk:1; V03:K0:i3+9xms7wIg=:Dz5kCIVe6H34KCYiYKhPE4 g74QqcE5myoZT74nBs+4Igfi06VGOL4eDxhbwmhQLE2RC0or0gvE99nVj9a9tVIOj9rZFPUql 1Cwe6FKn8GmLfGAi6+uyqRg379+hDyNYwylmV0EOB3TmoiZAH4RQfJR8LoTImhJkxzBWbrhwh fQmFtgy7jktQ3rApDZxBt+XKuXJ3NpjjQPCViwNw+ZFX+g+yn9wd0HD6cBbJwdNFJlQCxSSiR 22D875CG62Hl3+Nb3fwUtxxIL+YtAsCR06vgWQGJtWQIurRqlnB9bKKuIW45SJZO+zf+rzUMk Y0RYwLgix2QdoSSlZUbuUv1deYcT7vwd1Lg6H04Vr+KGSSQl9XHeimOupBonDQPYIjdtLN1+d chsJFripOM2JOehtqB/u1PIGR/bfbicqVDNWPk9s7O9bCF4ufwFEqVMx3lBcrOXCMcqakxgMx M0wgKjV6trMd00F63PXY1kHeIrTdTvMw6VOSWNPefOdchliN3sssEc1KpG6ePLnSUb23YAcho E/IRwEllqwNGdkxHHqfhT0= Received-SPF: none client-ip=212.227.126.133; 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, 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use ka_restorer, in line with TARGET_ARCH_HAS_KA_RESTORER vs TARGET_ARCH_HAS_SA_RESTORER, since Alpha passes this field as a syscall argument. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210422230227.314751-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/alpha/signal.c | 8 ++++---- linux-user/syscall.c | 4 ++-- linux-user/syscall_defs.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) -- 2.31.1 diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 0eec9ba3fd82..1129ffeea1d8 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -138,8 +138,8 @@ void setup_frame(int sig, struct target_sigaction *ka, setup_sigcontext(&frame->sc, env, frame_addr, set); - if (ka->sa_restorer) { - r26 = ka->sa_restorer; + if (ka->ka_restorer) { + r26 = ka->ka_restorer; } else { __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn, @@ -192,8 +192,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } - if (ka->sa_restorer) { - r26 = ka->sa_restorer; + if (ka->ka_restorer) { + r26 = ka->ka_restorer; } else { __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e05870c33884..82736540ebcc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8989,7 +8989,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, act._sa_handler = old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags = old_act->sa_flags; - act.sa_restorer = 0; + act.ka_restorer = 0; unlock_user_struct(old_act, arg2, 0); pact = &act; } @@ -9085,7 +9085,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, act._sa_handler = rt_act->_sa_handler; act.sa_mask = rt_act->sa_mask; act.sa_flags = rt_act->sa_flags; - act.sa_restorer = arg5; + act.ka_restorer = arg5; unlock_user_struct(rt_act, arg2, 0); pact = &act; } diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 25be414727f5..693d4f3788d4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -519,7 +519,7 @@ struct target_sigaction { abi_ulong _sa_handler; abi_ulong sa_flags; target_sigset_t sa_mask; - abi_ulong sa_restorer; + abi_ulong ka_restorer; }; #elif defined(TARGET_MIPS) struct target_sigaction { From patchwork Tue May 18 05:31:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441160 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1806718jac; Mon, 17 May 2021 23:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxXpFD3oSOVm2fTqahtu07PH8iRvLGHWMrva7jc73hidLsSdLbk09hCqrCglVnWe3v/1up X-Received: by 2002:a05:620a:208a:: with SMTP id e10mr3914721qka.112.1621319199407; Mon, 17 May 2021 23:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319199; cv=none; d=google.com; s=arc-20160816; b=Ma8ab44ZtwPmUbSJRJYDFGlRJjPryjfdeRrB2MFRQRynhJ7VYXKZ3qqj5gzOCDJiXc H6mQf3+NEnB3tBpFOla7qLTux++Vstd6iQ95KSf5WLftYIQurW+QgJbTttgRJjJTWRvs 197aSCccoHqe6KWMWUZE7Wuf9ZlhZMutnLku+hM4ao6igpVSiakMOyS2J356XeSBQtbG JPhJBeduJjdMyKTMHSsihzTNhVhj58wqz5QuJ/qZAoHH5AEszV2/BGs5EPPm8tQq3AGD oNHeQsN1n2sFOlNUJHcClpyoxZsvQ8ZqRxiTJoWS2IVQYpnzGtPU4ZDSA8u4Bmi2tMRP /a/Q== 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=+buWlw1rGnP1RkVvsXNxp6KkzCSwGW3LfoTCKFY28iE=; b=Dh34xruoDDZVgMLey3gXPOGct0f2j9FHZuSNZACWG9a32xznPZehZ8JrPXND3Z8DD3 6E6BNmJ/cS16UngtnDxfhWUwTG3u0e9kpgqjdPzqVyDAZhxWPS6uifaIUKp/kTmjdB8p ablUS1YWeM2uLewB2q/ufMuRmhEWpbjw1/Wkxi/hfwBuGUtHdnHlCRKMxc/jKwAZQi7q 4NBIgci20mlcInhVnkWbfGzaaTdNyKit+74iCVtYzfNmvqgrksWTr4z4LXBHVVwE2BUS AKOWzRBNEC0lmZud3SktBBokG23LFDo8Nx23ZvQZMu+zG+oXG0e+ubqag7Ie1Ftel6Eu yKpQ== 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 o16si7681065qtv.66.2021.05.17.23.26.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:26:39 -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]:56680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1litBe-0003VK-Ni for patch@linaro.org; Tue, 18 May 2021 02:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKw-00085N-9X for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:10 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:40853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKo-0007B7-Ew for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:09 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M9Ib1-1lnXQl1NFX-006M81; Tue, 18 May 2021 07:32:00 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 53/59] linux-user: Pass ka_restorer to do_sigaction Date: Tue, 18 May 2021 07:31:25 +0200 Message-Id: <20210518053131.87212-54-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:u0DZmha5GcjAO88SvCoHsHfehkDLTONIUtdiqV69nf58rJi/J5n JLXBDenbZtCaKAQ4in73uYzSOuZdgaywFOGr/E9RLBp1R68h3WGby6mtqHccIqKisGSBJs2 1B4mtrqPSMP9EndJYk+K6oVzj5LGzTtK1w4k/rdh+HKQeHuXjK/lze6PB1i5pDN+rFY5Inn IThiJ/qJA85gvKdfAVBaw== X-UI-Out-Filterresults: notjunk:1; V03:K0:zg2Kb7W5opU=:YhUDY3QU5cBVWYuRfmIutZ Fe7AXK2240mXXNp1qnnp4NrVbAxj51bs/s0qYOjHdD8k5n2IZvEcOZU1hFAam+DFU7rYm5C7y 7PSqgDTAvP0QXcYuK2d1ibUh1v82pldLKq/zfurWgBVtQr89BgHaYDrRtFNHzwUGdFEJJmSuM c3MzRLFP97VPutrE7GXinj0zyK7ulvJxurORt5S8x5ME+9WbGePmFVvwWO42E+mWgpLhwCHiO Qav3mfraymHlTpYkyrCpqe8fdcSe8BmV3NG3tIUC6LMSuPRj/E4/SOfFOQGh1JqspgP7eSRHZ Wlp9l9Okm1esXQ+JwIar49Hep6lvenY0H7hB7PL/hji2ytQuKV6tuVwqMkBReFddhM/JtNEZp mRRkX+sn7iXIwDRtjoLrblF+fhk+Jr4chWGm/ctgZ93qfA603jUcXCpEaUXAVo0vW/gvvdCoZ dZct71DUViTdF+lO4lVsNFhqEjf9gsKuIUtAO4jUoOJW+yQ3Qxt6Dm4fnzfWD+2dSeZe4jGA9 OD2t4/tZoGS+TEcHynv0Mc= Received-SPF: none client-ip=212.227.126.130; 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, 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The value of ka_restorer needs to be saved in sigact_table. At the moment, the attempt to save it in do_syscall is improperly clobbering user memory. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210422230227.314751-4-richard.henderson@linaro.org> [lv: remove tab] Signed-off-by: Laurent Vivier --- linux-user/signal.c | 5 ++++- linux-user/syscall.c | 19 ++++++------------- linux-user/syscall_defs.h | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) -- 2.31.1 diff --git a/linux-user/signal.c b/linux-user/signal.c index cbd80b28cf5a..9016896dcda0 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -842,7 +842,7 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, /* do_sigaction() return target values and host errnos */ int do_sigaction(int sig, const struct target_sigaction *act, - struct target_sigaction *oact) + struct target_sigaction *oact, abi_ulong ka_restorer) { struct target_sigaction *k; struct sigaction act1; @@ -875,6 +875,9 @@ int do_sigaction(int sig, const struct target_sigaction *act, __get_user(k->sa_flags, &act->sa_flags); #ifdef TARGET_ARCH_HAS_SA_RESTORER __get_user(k->sa_restorer, &act->sa_restorer); +#endif +#ifdef TARGET_ARCH_HAS_KA_RESTORER + k->ka_restorer = ka_restorer; #endif /* To be swapped in target_to_host_sigset. */ k->sa_mask = act->sa_mask; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 82736540ebcc..15b3af257bef 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8989,11 +8989,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, act._sa_handler = old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags = old_act->sa_flags; - act.ka_restorer = 0; unlock_user_struct(old_act, arg2, 0); pact = &act; } - ret = get_errno(do_sigaction(arg1, pact, &oact)); + ret = get_errno(do_sigaction(arg1, pact, &oact, 0)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) return -TARGET_EFAULT; @@ -9017,7 +9016,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, pact = NULL; } - ret = get_errno(do_sigaction(arg1, pact, &oact)); + ret = get_errno(do_sigaction(arg1, pact, &oact, 0)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) @@ -9040,15 +9039,12 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags = old_act->sa_flags; act.sa_restorer = old_act->sa_restorer; -#ifdef TARGET_ARCH_HAS_KA_RESTORER - act.ka_restorer = 0; -#endif unlock_user_struct(old_act, arg2, 0); pact = &act; } else { pact = NULL; } - ret = get_errno(do_sigaction(arg1, pact, &oact)); + ret = get_errno(do_sigaction(arg1, pact, &oact, 0)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) return -TARGET_EFAULT; @@ -9085,11 +9081,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, act._sa_handler = rt_act->_sa_handler; act.sa_mask = rt_act->sa_mask; act.sa_flags = rt_act->sa_flags; - act.ka_restorer = arg5; unlock_user_struct(rt_act, arg2, 0); pact = &act; } - ret = get_errno(do_sigaction(arg1, pact, &oact)); + ret = get_errno(do_sigaction(arg1, pact, &oact, arg5)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, rt_act, arg3, 0)) return -TARGET_EFAULT; @@ -9104,6 +9099,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, target_ulong sigsetsize = arg5; #else target_ulong sigsetsize = arg4; + target_ulong restorer = 0; #endif struct target_sigaction *act; struct target_sigaction *oact; @@ -9115,9 +9111,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { return -TARGET_EFAULT; } -#ifdef TARGET_ARCH_HAS_KA_RESTORER - act->ka_restorer = restorer; -#endif } else { act = NULL; } @@ -9128,7 +9121,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, } } else oact = NULL; - ret = get_errno(do_sigaction(arg1, act, oact)); + ret = get_errno(do_sigaction(arg1, act, oact, restorer)); rt_sigaction_fail: if (act) unlock_user_struct(act, arg2, 0); diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 693d4f3788d4..e4aaf8412f56 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -492,7 +492,7 @@ void target_to_host_old_sigset(sigset_t *sigset, const abi_ulong *old_sigset); struct target_sigaction; int do_sigaction(int sig, const struct target_sigaction *act, - struct target_sigaction *oact); + struct target_sigaction *oact, abi_ulong ka_restorer); #include "target_signal.h" From patchwork Tue May 18 05:31:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441157 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1803743jac; Mon, 17 May 2021 23:22:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcVQA81GkSEsKZ5hlfCEwudFJ7keOjOucgXjGo9Frb2bf+1qxzn3vTgGbs0V62Kg/LDwW0 X-Received: by 2002:a25:109:: with SMTP id 9mr5641673ybb.143.1621318921653; Mon, 17 May 2021 23:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318921; cv=none; d=google.com; s=arc-20160816; b=W1ykUhC/23bvSt2fruFDjSXHS8pzLk3EndF9WTFN5Z+M9HsUIDfC1d7Pe9X+UNUQ5X f/cugXWpAsp2CeaZFKS6KUguN7oZjLzZKh9DkNJzd7dBUxmG/qtM+Yfsf/5hNt7Pq7xW nRMN+9LohpJcU+h3TKWgeRKXehTJ3Jq+GvIHCQ2fEEMCJnvVHb9mFLli3QpvRGSlhGDG lsUKgZ2BkUBTpwbPS5YAa8LxZ9thHW8zDwZYiNZ0+tWKyGmTD6ti4PR/0YmiKu3wMgNI XGBYTkZ0NyNOWozPVEjQqhmtsTPS3lABPdS6orKygixo5UJVq9XRz5oJsjzWv/R7drb8 D1Eg== 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=o+2L/p0vY4L0OYe+s14M14GRCRFMBNVlNabU7QwqzY4=; b=AVEz8R2VFapmRw1wd/X3motZ8rEj7mo85ZDXmJebjpy7N1T5FXmiBQcqPtT5OrGEs2 fBRCV/XV3uNoVAz0VnidOaNc8B4gSEjgMv3etSgtmOL2k49Fgx4uEqvjESDhMjbFyaID oteBl0CVbP1uZS8HDNMmrHwcq6C9UMC15DYKHZaw2uxZ+w27dahhfkj2s7SN9yYEkEYS mLraoKrdj355KF785/nmxkGSLe9PzC+S8cw1fU6M+GX5wgmEqpclC3h9oe11l1eUTrAJ 2aNPdlLMC9XrGuQkJRw/8KWvIDbtpmU1+4LtGNvurfvT62Mz+TiAKK0GCYOgnPYJXyLB u4OA== 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 q9si19608004ybc.150.2021.05.17.23.22.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:22:01 -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]:48154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit7B-0005nh-4E for patch@linaro.org; Tue, 18 May 2021 02:22:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisL0-0008MT-7X for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:14 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKy-0007IR-Dd for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:13 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MSqbe-1luPBW3iWM-00UMGO; Tue, 18 May 2021 07:32:01 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 54/59] linux-user: Honor TARGET_ARCH_HAS_SA_RESTORER in do_syscall Date: Tue, 18 May 2021 07:31:26 +0200 Message-Id: <20210518053131.87212-55-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:nvqSL6gxEHAc+nguF+PfS0UyMO/WP0J0GgvwFFU6/1X814G5vvX vfFSiIMzqnnYxCu1qqu1H/bZhrqg6+aR8XX/9aaHwr6upFrLGIxK5v3i9p+G0bidwQA+RVL TGDOjIBWlLhxZQ8TchkOELpw7J6FUg6+8HzIdkwCxAv6RS0fqvDwkEEUuOtwHMmHST8+MhX eIWwtbeCGfOvhsu/3NKDg== X-UI-Out-Filterresults: notjunk:1; V03:K0:u6PTpLtkKKE=:qMCVVDO0CYR0WP9BLrYYXR Yr3ARthjuKeIvgInu8dFryAL7O674wyvP9J0VnxQGdIRGuC+ffjigtSgtdfLl/5bvw84OelCH Py1at2lIildOdSfZMJBF/8TQufF7Pa0fFbolK1Vowr2OmoYdYXeuPatlVlqu3GK5SgP6D9CmA 6ZrKQiLPeMEvqHaWSuhTBBio+nuwpDOXp/4FfkdARAec0Sv4QOB99L8ckx94utL6TEVQ+O+gz 2EjePoqc2zbCC0Ainw2YclplLwFG+hNhHMCl+fTA2pcqDFh+kYKdbCuAyorgz65wZaVC3tV3p S2ACR+WxZCtZLZWby9R/93erisdrSVESm614I1kfQCs7DmKW6UgG4qMJhXqdk8tZwG/rQGkL1 M1/bcarlVNCQHSetPEpShgxIyV/Hc0Iy5S47dxScOs01sd90Se3d39OwyC7EU9u7Ci9ZIiDOy u8n9xALw6M4ASfQq3yTsyAMQEZss7hFSvvAgNgyzMvI+CECgbDmJFVnOZ85EMFmKXer6U2jD4 22qV5Jpcbw0CLfh70Yq1PM= Received-SPF: none client-ip=212.227.126.135; 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, 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Do not access a field that may not be present. This will become an issue when sharing more code in the next patch. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210422230227.314751-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.31.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 15b3af257bef..a2e18b06c6d0 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9038,7 +9038,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, act._sa_handler = old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags = old_act->sa_flags; +#ifdef TARGET_ARCH_HAS_SA_RESTORER act.sa_restorer = old_act->sa_restorer; +#endif unlock_user_struct(old_act, arg2, 0); pact = &act; } else { @@ -9051,7 +9053,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, old_act->_sa_handler = oact._sa_handler; old_act->sa_mask = oact.sa_mask.sig[0]; old_act->sa_flags = oact.sa_flags; +#ifdef TARGET_ARCH_HAS_SA_RESTORER old_act->sa_restorer = oact.sa_restorer; +#endif unlock_user_struct(old_act, arg3, 1); } #endif From patchwork Tue May 18 05:31:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441158 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1804817jac; Mon, 17 May 2021 23:23:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ1wvXXP4Is2bTf7grRl8b2b1m11nbAbOGH/mLpM1rHzmiyVOWc1lrjCKMCdevgYQYUVy+ X-Received: by 2002:a25:4246:: with SMTP id p67mr2293308yba.519.1621319018356; Mon, 17 May 2021 23:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319018; cv=none; d=google.com; s=arc-20160816; b=JzfMBEsK6vR5RtoJmYbK+oxuNDVVoY2izMYdlWVca9//eMwFkA7yALYZrnY7uSvFh1 Us4lBcBrcO5mnoLXMGf+fhS8jiszPlDIaS7w7lSEjYR3RcahSJYHK0PkJxbVrOFPBkbt Oj0Z31tug5io7jeZ53YwEmXBfR8H9MmlVIFcewPQRnrR7Igx4tvLhhQkvMQon/aX6ohS MSQ9Mr3hH20hcHjpBLQ9CcNrT77TwLlE0IDrCW6YfyjO/9YbC8KeYJLRYrOOOinFRLK3 NDuWd0HsKiBB4h++FC+8rWupjr8/fXidNcEkOHiIDKT47JEqURevzA8hiLr+r4t3s33I U2mQ== 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=6GGDUGC4+EPVab1541Yf4IgduBHvJOxhmCKUjVUX+Uo=; b=A/lJl/uRnqDZ2c/HXnjW1kMCJtrJiWAQhb9laTV7YPgdc5kxn0ONmHQZC5ue62LPjo sWX2P0gOOMXEgvuBkPO0XJ82kMNpLqPYPEo1wfbwfnZICKHtkXIeoaNJw6Lrhr2B1etS 8Inba59uYVO+IIkPfSdVl+YLF9nJjuLOOkRKyBGwqK5hs+Fy32sck9tnGUnbOVDJsh3Y KTu+oVdDXpqa1vQSRH/RfVDh4ZdxxFN858+OirMpmih+N4xIqLCjsrBlAHMVP8xIeA6/ MaPA5F8sTGDEvwAeb6xAyY5OtWSUVW0zaYKOP5ta009Cc1ABtBKXOxih6tcyiykUg5ub hzdg== 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 g72si21664462ybf.140.2021.05.17.23.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:23:38 -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]:52418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit8j-0000HJ-MY for patch@linaro.org; Tue, 18 May 2021 02:23:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKw-000841-0G for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:10 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:46019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKp-0007CS-Dy for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:09 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MfL5v-1lFaBu1ZL1-00gmLF; Tue, 18 May 2021 07:32:01 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 55/59] linux-user/alpha: Define TARGET_ARCH_HAS_KA_RESTORER Date: Tue, 18 May 2021 07:31:27 +0200 Message-Id: <20210518053131.87212-56-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:Fqsxo95B62MFNOBM4N3vYpdEHIqIfN5zeCw5/MK1IWn1XSNgGhI RiXI/bCSCXY0x+3J/U/xkGuZT7xf+D3hh5ts/KHM9g9+TEwFg8gGVVx/06YevU6S3g6jeBL RDqG1okDWj5JE1QB4uKeb1aoA/+brIu019qo9OZCX0l3j4xiYi38ObvBMpl1bECpUgVnKfX 1KwEchLgqDKkMgzi+ZrWg== X-UI-Out-Filterresults: notjunk:1; V03:K0:BHKz87otMNo=:hirpCJuzHZ75PiXdXoZGbh 6ssCb1/EbkCY78mftXGYo1iaacmBDvFxRr+536QtbXAj9qohnfzpK3Cdwq1pr6jSuvX1A5fIu 7pCb8g2/V0E5mzm3NQCrGzKtVg4/RXulXw4wEbo7IeKXRJRuh3PEk4hNMU1/S5a+MAp2AbY1G L8fq1mn9H+KXif3QtViyeK+b8HsTC1/Bju1GU0kXNdYzDkEJtbKcaS+K9XABrJ2ROGulmNVE5 DvM+AqEVdOHQ+tc+r9UxgpX7KrBeyj4glbzugzTFB5kNfpvk8ppMwKnKLVAJeZM8ST1FaG+/M GRpObhphB6xyhv8zSJW4GPWOxhT+beNmW7DefEyGhTTFNIgK7jYYpKqsnks+zsuyKouGjQ9Cr Zo0k15LXtUX3rTSIwHSoT+ZzgT+UT9LF6x041xT7YOO1lqz2Cd6CRMawWKZHA3smsgTmtDS/5 o7pbsB6Ks3rmeUMYqlSSw1J/oHhVwPTwSzmsbYJl17G7qICVnnWSCaW5tI7cSS2CCivMM85fc 7MbOc3OlZheI5TgpbfUJ5Y= Received-SPF: none client-ip=212.227.126.135; 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, 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This means that we can share the TARGET_NR_rt_sigaction code, and the target_rt_sigaction structure is unused. Untangling the ifdefs so that target_sigaction can be shared will wait until the next patch. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210422230227.314751-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/alpha/target_signal.h | 1 + linux-user/syscall.c | 37 ++++++-------------------------- linux-user/syscall_defs.h | 6 ------ 3 files changed, 7 insertions(+), 37 deletions(-) -- 2.31.1 diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 0b90d3a89701..250642913e2a 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -92,6 +92,7 @@ typedef struct target_sigaltstack { #define TARGET_GEN_SUBRNG7 -25 #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_KA_RESTORER /* bit-flags */ #define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a2e18b06c6d0..048056ba2bf2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9064,41 +9064,17 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #endif case TARGET_NR_rt_sigaction: { -#if defined(TARGET_ALPHA) - /* For Alpha and SPARC this is a 5 argument syscall, with + /* + * For Alpha and SPARC this is a 5 argument syscall, with * a 'restorer' parameter which must be copied into the * sa_restorer field of the sigaction struct. * For Alpha that 'restorer' is arg5; for SPARC it is arg4, * and arg5 is the sigsetsize. - * Alpha also has a separate rt_sigaction struct that it uses - * here; SPARC uses the usual sigaction struct. */ - struct target_rt_sigaction *rt_act; - struct target_sigaction act, oact, *pact = 0; - - if (arg4 != sizeof(target_sigset_t)) { - return -TARGET_EINVAL; - } - if (arg2) { - if (!lock_user_struct(VERIFY_READ, rt_act, arg2, 1)) - return -TARGET_EFAULT; - act._sa_handler = rt_act->_sa_handler; - act.sa_mask = rt_act->sa_mask; - act.sa_flags = rt_act->sa_flags; - unlock_user_struct(rt_act, arg2, 0); - pact = &act; - } - ret = get_errno(do_sigaction(arg1, pact, &oact, arg5)); - if (!is_error(ret) && arg3) { - if (!lock_user_struct(VERIFY_WRITE, rt_act, arg3, 0)) - return -TARGET_EFAULT; - rt_act->_sa_handler = oact._sa_handler; - rt_act->sa_mask = oact.sa_mask; - rt_act->sa_flags = oact.sa_flags; - unlock_user_struct(rt_act, arg3, 1); - } -#else -#ifdef TARGET_SPARC +#if defined(TARGET_ALPHA) + target_ulong sigsetsize = arg4; + target_ulong restorer = arg5; +#elif defined(TARGET_SPARC) target_ulong restorer = arg4; target_ulong sigsetsize = arg5; #else @@ -9131,7 +9107,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, unlock_user_struct(act, arg2, 0); if (oact) unlock_user_struct(oact, arg3, 1); -#endif } return ret; #ifdef TARGET_NR_sgetmask /* not on alpha */ diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e4aaf8412f56..7a1d3b239c02 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -507,12 +507,6 @@ struct target_old_sigaction { int32_t sa_flags; }; -struct target_rt_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; - target_sigset_t sa_mask; -}; - /* This is the struct used inside the kernel. The ka_restorer field comes from the 5th argument to sys_rt_sigaction. */ struct target_sigaction { From patchwork Tue May 18 05:31:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441161 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1808825jac; Mon, 17 May 2021 23:30:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDrgfdbIoOtA0/ibhB2tVGYdypHgxTJm7fos9uIv3eq410jh3E/D2sqczORKNa8pRtbzXQ X-Received: by 2002:ab0:4042:: with SMTP id h60mr4787395uad.133.1621319410249; Mon, 17 May 2021 23:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319410; cv=none; d=google.com; s=arc-20160816; b=L+UkAa/xgyNg40711OK7GCNBrcrDt1Gi59fTNyyluA3L2n2A4JIRHUb6k8h9R4mwX5 lgk12E9E+PVSIWsAM7YwdSSubVRJejK/c1mJlI/RY9C5x5hYruldzyQlNtsHkEG42hMd FSdlUKp9IWXCsgSIr3DUdAlTGanconuuTEl2yTHZMnHVLn/vwqXGGUQ3OvG8gNggu08K OQS8xhkM4GQWY/qb5g7lCIBO5LZnzfYKqtOV/w4AtS1MoEQf8B3AKkNILng6bbi/ftkA PK9AtIXlM6ecyhJ+TlpqajyhNwPouieT4TTtL2iJ5ce29XrZgQwztw635eG5Bmf8TcoD J/IQ== 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=jraTE8C2Cn0DILXp2S88ngHuefL7C3T2GBEF4dSHFQs=; b=fIXYUvHcP5dd3iWkq2thG1YtieyYCpy+aWRys+9NWWxXt4FebLQ0NnnUg9pIAxZ8gz 6BpIrKSrXoo1nV2VloOpyECvDSLSD9hlJxZ+x76AM910IXdThQ4NPpp4bmgIBgz7jaJM VihnK3q3Nm0PbEtZPFvc4j7dAKPtVoJpg5yb5fbxvG/hsSLVEJdQNDgNqBVxRJRBAsZD Y+2K2XKsxPySP07sA7ClIRk6c8w6LhYldaZcWe1miyVDEyiLQppPgEiphldDiBlizc9e DCQVizZOutKQfw/WZSMSmrGTe75UnC7S0gcr6pFRClgZMqSlviSkTmvnzPdj0A5K6YHu VA+g== 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 a12si1015252uaf.188.2021.05.17.23.30.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:30:10 -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]:60714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1litF3-0006JT-MX for patch@linaro.org; Tue, 18 May 2021 02:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKx-00088Z-17 for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:11 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:42591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKp-0007Ce-SJ for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:10 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MEUaQ-1lg9aF3Vik-00G0FI; Tue, 18 May 2021 07:32:02 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 56/59] linux-user/alpha: Share code for TARGET_NR_sigaction Date: Tue, 18 May 2021 07:31:28 +0200 Message-Id: <20210518053131.87212-57-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:uIe5Oi1LqiCOTOhl/5aXtZNXe6NL5mR8sAovxAghsJO/Bonhbum rqsQs8HghicY3ynqZIgJ8sLTlnCA32dseuKPR7nUW5edQN3tDWI6pL7W23ZVkRlN6hRBFRy vZbRU/9O5b198BWw87Af05K9y9H8lwyQr1ONzH7hOsRtrdDXmOsWoJiRIzF1keUFsVA6+aS bsPh5NUuNDwfeaA64J1MQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:VnsybytxsFY=:YEJm3fSrnSzrPwvj7ZNnUL +gUXa/K1PvsEp+5XhQvuaE7d1PgDRL96e0Znpua/6iPHIalCNs7tVSWjuXDeQu362Y+JwtjFP dSSI2ZjjbMYDn/p0CuNFA/6G+wGIe+gitVOVaimxmn3LTpPu+PQe6svseY6+CkE5Qygwn67oL yDxEYeP44vK/Xo1Tn8m4yQCTHsj0zuZApL0EeaGAvtHtpqv4cvLZaczr1mGmdwBWjPdaOgzoC O5HBbRGjSd2AhoVkrGXl3Kqm90epkHfHfAAgaZh1s6VKhoTnmBou9Ua0HnD6b8VmXU3MjIv4N Gm0UsIaK6ks6jgoQ2q2tdyQ7Tx4NlUXoxwOU8CrOtFrd6dIFiSpc9vFAQR0zg33H3ZRsTv4wY iXPqo5EEtyBJMC54Pwvke0WdEUh7419yYZ4rx3bk+9WRcgxLAXvqDBen1Yy443M0py5lnQKx9 JCHemb3HLe0HKZukehouDoqrr+bQqDsy3xK+MOKd+2aiDBrKWMiN4qDs3jAImzJfTJ10M9gQV QZA6ItAe7EiEsSm7/LMP8A= 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There's no longer a difference between the alpha code and the generic code. There is a type difference in target_old_sigaction.sa_flags, which can be resolved with a very much smaller ifdef, which allows us to finish sharing the target_sigaction definition. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210422230227.314751-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 23 +---------------------- linux-user/syscall_defs.h | 21 ++++++--------------- 2 files changed, 7 insertions(+), 37 deletions(-) -- 2.31.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 048056ba2bf2..8d7ac1ebcffa 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8980,28 +8980,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_sigaction case TARGET_NR_sigaction: { -#if defined(TARGET_ALPHA) - struct target_sigaction act, oact, *pact = 0; - struct target_old_sigaction *old_act; - if (arg2) { - if (!lock_user_struct(VERIFY_READ, old_act, arg2, 1)) - return -TARGET_EFAULT; - act._sa_handler = old_act->_sa_handler; - target_siginitset(&act.sa_mask, old_act->sa_mask); - act.sa_flags = old_act->sa_flags; - unlock_user_struct(old_act, arg2, 0); - pact = &act; - } - ret = get_errno(do_sigaction(arg1, pact, &oact, 0)); - if (!is_error(ret) && arg3) { - if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) - return -TARGET_EFAULT; - old_act->_sa_handler = oact._sa_handler; - old_act->sa_mask = oact.sa_mask.sig[0]; - old_act->sa_flags = oact.sa_flags; - unlock_user_struct(old_act, arg3, 1); - } -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction act, oact, *pact, *old_act; if (arg2) { diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7a1d3b239c02..18b031a2f6a8 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -501,21 +501,12 @@ int do_sigaction(int sig, const struct target_sigaction *act, #endif #if defined(TARGET_ALPHA) -struct target_old_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_mask; - int32_t sa_flags; -}; +typedef int32_t target_old_sa_flags; +#else +typedef abi_ulong target_old_sa_flags; +#endif -/* This is the struct used inside the kernel. The ka_restorer - field comes from the 5th argument to sys_rt_sigaction. */ -struct target_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; - target_sigset_t sa_mask; - abi_ulong ka_restorer; -}; -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction { uint32_t sa_flags; #if defined(TARGET_ABI_MIPSN32) @@ -533,7 +524,7 @@ struct target_sigaction { struct target_old_sigaction { abi_ulong _sa_handler; abi_ulong sa_mask; - abi_ulong sa_flags; + target_old_sa_flags sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER abi_ulong sa_restorer; #endif From patchwork Tue May 18 05:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441159 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1805555jac; Mon, 17 May 2021 23:24:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRrpo+9aScVXbyER1ULcDnazaFt7SuED8MxMbPHejXL+4tyF6NyFcddg9t73zQMAMzQJKt X-Received: by 2002:a25:2645:: with SMTP id m66mr5263916ybm.65.1621319089322; Mon, 17 May 2021 23:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319089; cv=none; d=google.com; s=arc-20160816; b=jyZX2Jp8d/806CjKekD0DCI2o13SQm9ZJgZ8BJJhIKpIcmHkn00qo/9T8kN0l7ndF1 bDJi79jP0xii4bVNiL0OdaVM3pwVGvB168pUHAhlRuQGVxDyGhriaHbnaNlLJgX/rTWW KROzHlCK1ok4KJehOhi5umNp6zGEloDA0QEbcudbTplyFSy6X+h0EigNGFrTxdj3wQgR D5RiJcfaH/CTZiGJfONMsJBTrtGu9bXU6u80mSFNWc0z0bQGjFCfvKwiwbGEnJ0wvZf7 AKyCNL3nCiNfF6QEjCvLr3h5LsVbYpKvpYoNk8L14ga+OrUuRRbohtuOFLGYWhanqJ0F j6xw== 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=5EwMjvs1oXNiy+eDtodNLNQ21OiPDF6PStx666kZFR0=; b=z820XdT20pnI0X9bkVGPLy8Jg932PzqXHd9WU8VB3N9aTw2bufMsUSRMuRHzdUCU2/ AX0d6uKNwEjiEY7QmDZbi0NaikwqpFsga6y4E50rOvRRv8R3vgVaQLfSOIpwrLr0iS+v BdhNbEbcxVq/Siqi34aJRjxw47oluXIcETWxfskVHZ9LaDNpgnAB5J3djb1du+iZY/d0 RD0OlTWxfOdTNkY59uyx4CYV9TXecc77q9ZaKdubeaClsuN5scGMyjubVptLTL4o1IdD OT2mlC717K9ML/hqDisAdzbqHC486gChm89HD5D48r122hfDRPqeqRaHiEjjXLj5OkXc eUpQ== 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 d13si2671969ybq.436.2021.05.17.23.24.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:24:49 -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]:53844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit9s-0001MY-Rw for patch@linaro.org; Tue, 18 May 2021 02:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisL1-0008S2-KC for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:15 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:43111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKz-0007Jn-Pe for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:15 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mqro7-1l59nu1A6T-00mpip; Tue, 18 May 2021 07:32:03 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 57/59] linux-user: Tidy TARGET_NR_rt_sigaction Date: Tue, 18 May 2021 07:31:29 +0200 Message-Id: <20210518053131.87212-58-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:0pe3gBwIz6emDT9fggT5RQr/jQo58spTr4RgIxpGqL/TG9Z4cUd Us7JSbtXuvIDmnvjow4BMUW/eI/CAMTQhNI6Jsj9HtVRgcQdnXMy2XOGRxS4169TwkH2Hmx 2ZB78gzhw3Ly2zixnsLrIFnaJIFVFW+GcSJ6CUJ5afV5tuqDB3OgSQG3F03LjLbbZwTJi6G xxU+PZGvh1OUQWoBW5MlA== X-UI-Out-Filterresults: notjunk:1; V03:K0:1QfqtfjQhwk=:1XQv3s3mSM2b6dYj0HtNp7 WmjxbaZwv0qKqLfqW4GP4m2Ut/6lAN/v07UVFcs7CB0/sJTdif6VBFE0XNELVqC7l61HxvjQx EC0tG5pxSYYZgwrhMUC96OaCOq8pnOflxa76rvdksQePjxkat+6HqfwMj2tAx/Cj6moIruk7q gL4O6xFiihhca85+lblB5ZWO3WtecZn0xUi3DfHL8LjXvvoWj5H0ke6CNyFI38Sqiys4Zp3N9 h8zqi6Cj1fKUq1M9rV6EH3XlGjVoQLwuouAB9dEtpOkUnx9FYxFrCgXmcM6VHLoMjQvnUAYHE dhETxysqoNL7ziYYeAWsvj6yw7jmlQ40sX+iXbWXPtxpJKOfm7+uciospmy4JZbVGApA9O6i0 XQjK3F9YMj2C7arGpN7NLd6wCT2krP0+o7lGFgbXMIzDTY/H24wOPMignSp9KjCU98BcSJgID JyEmaMoBqQkmKUZHSDPlwldYaxTGYPhQXHa7w58BIV4vOtnCmXpM6gdVefb6Z6dTtbxsbxEYk 4BNt7GZ2A2Liwx47jVLGp4= 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Initialize variables instead of elses. Use an else instead of a goto. Add braces. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210422230227.314751-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) -- 2.31.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8d7ac1ebcffa..c9f812091c3f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9060,32 +9060,26 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, target_ulong sigsetsize = arg4; target_ulong restorer = 0; #endif - struct target_sigaction *act; - struct target_sigaction *oact; + struct target_sigaction *act = NULL; + struct target_sigaction *oact = NULL; if (sigsetsize != sizeof(target_sigset_t)) { return -TARGET_EINVAL; } - if (arg2) { - if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { - return -TARGET_EFAULT; - } - } else { - act = NULL; + if (arg2 && !lock_user_struct(VERIFY_READ, act, arg2, 1)) { + return -TARGET_EFAULT; } - if (arg3) { - if (!lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { - ret = -TARGET_EFAULT; - goto rt_sigaction_fail; + if (arg3 && !lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { + ret = -TARGET_EFAULT; + } else { + ret = get_errno(do_sigaction(arg1, act, oact, restorer)); + if (oact) { + unlock_user_struct(oact, arg3, 1); } - } else - oact = NULL; - ret = get_errno(do_sigaction(arg1, act, oact, restorer)); - rt_sigaction_fail: - if (act) + } + if (act) { unlock_user_struct(act, arg2, 0); - if (oact) - unlock_user_struct(oact, arg3, 1); + } } return ret; #ifdef TARGET_NR_sgetmask /* not on alpha */