From patchwork Wed Nov 6 13:04:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 178686 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp587139ilf; Wed, 6 Nov 2019 05:11:17 -0800 (PST) X-Google-Smtp-Source: APXvYqymgXGEar8Dqx4jM2m1mN6h4W8hkIR0KjMNN4MmZnBhU2rq0tx0t9CMoMAvwd015IzkAGFs X-Received: by 2002:a05:620a:120e:: with SMTP id u14mr1884541qkj.325.1573045877097; Wed, 06 Nov 2019 05:11:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573045877; cv=none; d=google.com; s=arc-20160816; b=B1MGxA2piC7msPgtl3zHvJaRRPB3fhcAMsgkvtjDoknvOhQtP0SDIta5W30ssCf0hX HgL9c1uyeZedrbtVbu3asTvjkzCM+L0dZY0uiKyMBeI/V5T1N+fv2pPuRb8iSCIcQP4x NW9A/E+pDH6ivDY6dF7JNu7ik8c+K8QPtmHGQYAY0dW/KPMfTbFQkr4ZYz6kJgGGS6EW vbmK4DUeqCmf83yZW7mNN33yEq+uo1fAijfl+PH8dfh6rQpg76KWi4Gip9+aoLW8FJcD tpD1iorpfcOechyVrNVs+XcBZirU108JJvllpgmQ/LgWE0i5t8gcTN8yjlP8vgGAhI4W Ok2g== 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=krqbwxRafu0SCqY50OMGiElBB80q+ISuAgB3pQt7Vdk=; b=VstA6Ay7O+veQzpfWMd1Kb91k9nZbtms/l9m0FUHEXG5ehDdgjKGc3MytcntbMbJcq oyFbIoSvSHwPdlp80XhU7HcYritiH1waBjseBTN4+VJRT1QIy8R3uQvvBDcSMhOhJLml cWoEuLZoioR6cYD37OCJXnwesLr5BMgc/z9BvA09lFVXQGX98HKen+1KhFXqAqM2ZBdZ WC5Lc0uFuFaVZIzyxkH7UjLb9tTybY6HbGA7vpCBi0JOfUGuhbP9NG1CRHoGeUMIqMqn m21wXDVQGsZnyp2h256adu5luZbEV+TIh9/y+HV404dailRI/dNck7RB6RAaGG8dD5+f oxFw== 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 r6si4601395qvp.98.2019.11.06.05.11.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Nov 2019 05:11:17 -0800 (PST) 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]:57886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSL5g-0002dC-1v for patch@linaro.org; Wed, 06 Nov 2019 08:11:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36480) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSKzw-0003X6-5p for qemu-devel@nongnu.org; Wed, 06 Nov 2019 08:05:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSKzu-0002xq-Fx for qemu-devel@nongnu.org; Wed, 06 Nov 2019 08:05:20 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:48433) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iSKzu-0002x9-6O for qemu-devel@nongnu.org; Wed, 06 Nov 2019 08:05:18 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MXp1Q-1iRE1z0uZY-00YB7Z; Wed, 06 Nov 2019 14:05:11 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL v2 06/13] linux-user/sparc: Begin using WREG constants in sparc/signal.c Date: Wed, 6 Nov 2019 14:04:49 +0100 Message-Id: <20191106130456.6176-7-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191106130456.6176-1-laurent@vivier.eu> References: <20191106130456.6176-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:or0UTK77VSjZt9enkydS3C5H4YSLm8PPhqPV6TUFsKFu8RDy5Dc 5h8x2PZX6TZr51+ISXC1Wmw+nPRlVj/A0gRnomYuhscIrTGk7y6MN3NI26Lx1a9tzC/zlYx loLSpz3GSjyh/zreRFBbjQ0ELLwwaculR0ej32vY1/Du1p/YApQW1m9Mp+tyQd866mrnEON hhzqAvLuL7N0fILPYrY6g== X-UI-Out-Filterresults: notjunk:1; V03:K0:QAsLTu2KgeM=:JOQUI1GUDx75A26tTNNLkl ZbunOi0HAHcr0+qSsAY7x1KDPQW/9lp6OqCj9UCMxS5B0QThAlYYnQdXyu3QFsgSyjR+b2AVt oSzAR/uruYa7N6EAQU0TpalhskuNdCzLnpx7+awTDt6BS3DKDO+kG2atTN2sygib7NIPYM9nT b5EXFG8hJLvgYRQDBP6KLT9yDD2Es01cx4OazC61im3eWu97sImTDOs+1a5vKZ5KzkG+ZthvO rMYUrI/DrukCGBnxSD+88oOzyqGDvE3Kd8B9bekxmzyxFU9aEdS1u/b56TtJ2gWhBtQmhNMKl kk5A1pVy/ASkALGmV6I24WBn3cbS+OmFFDyJ2/bpZvIuNvnE5Mui3rTcSAdpmi7OQ35yWm7r7 VXM3LpmM31nWcOYFYcgbqHeluNkQ9WKsXrCTs30k8VRDYNdGQWcSA2DjjiAm+qBZ3GlJ9fXT8 Iy0frLgGtKuYB8AchkMqn2HAV+UPeSkjdKaI5EFZtUg0gVKLMqqPstoS9inzfU4b+eWyf/AsT 6IZwO02Oi7qSy78/JKYNnOqo3rqSGRGkFqtfYwmLSeEbzUYUBqNFxnGvom4XTvaogA3BJBLSI 2fJwtSfR49rSDMs1OzY9wITC6rz4C+nwMoSzFTaeZnQBJG1nu/GI6/CylurdbzzuZ+6hsJWE5 tGRkYsJE1zmSsYhJs6e3TgLAf+MFWenw45ZrZ9phpA8YN8PJ7KssULCUOOVcHprq9dEbJx80Y 776oK4YM1h4TL0ldU5ug0sGfZLYIWxQiRQs/PEb7Sk8JsnkbA3huAblJz/2bJ9SgnUCXTzCG7 N/32dutA4unKEBnyH4ipNFYW2f9CDfLstzIRyoyZ0snsNrVWIvgMIrk1hJg1VoFyBbX415noa puLARgXGgJA8a5PwbA7Q== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.134 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 , Riku Voipio , Mark Cave-Ayland , Laurent Vivier , =?utf-8?q?Alex_Benn=C3=A9e?= , Artyom Tarasenko Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is non-obvious because the UREG constants are in fact wrong. s/UREG_I/WREG_O/g s/UREG_O/WREG_I/g s/UREG_L/WREG_L/g These substitutions have identical integer values. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20191106113318.10226-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 95 ++++++++++++++------------------------- 1 file changed, 33 insertions(+), 62 deletions(-) -- 2.21.0 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index ead169fbaa26..aac37da239c1 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -104,19 +104,8 @@ struct target_rt_signal_frame { qemu_siginfo_fpu_t fpu_state; }; -#define UREG_O0 16 -#define UREG_O6 22 -#define UREG_I0 0 -#define UREG_I1 1 -#define UREG_I2 2 -#define UREG_I3 3 -#define UREG_I4 4 -#define UREG_I5 5 -#define UREG_I6 6 -#define UREG_I7 7 -#define UREG_L0 8 -#define UREG_FP UREG_I6 -#define UREG_SP UREG_O6 +#define UREG_FP WREG_O6 +#define UREG_SP WREG_I6 static inline abi_ulong get_sigframe(struct target_sigaction *sa, CPUSPARCState *env, @@ -159,30 +148,12 @@ setup___siginfo(__siginfo_t *si, CPUSPARCState *env, abi_ulong mask) __put_user(env->gregs[i], &si->si_regs.u_regs[i]); } for (i=0; i < 8; i++) { - __put_user(env->regwptr[UREG_I0 + i], &si->si_regs.u_regs[i+8]); + __put_user(env->regwptr[WREG_O0 + i], &si->si_regs.u_regs[i + 8]); } __put_user(mask, &si->si_mask); return err; } -#if 0 -static int -setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/ - CPUSPARCState *env, unsigned long mask) -{ - int err = 0; - - __put_user(mask, &sc->sigc_mask); - __put_user(env->regwptr[UREG_SP], &sc->sigc_sp); - __put_user(env->pc, &sc->sigc_pc); - __put_user(env->npc, &sc->sigc_npc); - __put_user(env->psr, &sc->sigc_psr); - __put_user(env->gregs[1], &sc->sigc_g1); - __put_user(env->regwptr[UREG_O0], &sc->sigc_o0); - - return err; -} -#endif #define NF_ALIGNEDSZ (((sizeof(struct target_signal_frame) + 7) & (~7))) void setup_frame(int sig, struct target_sigaction *ka, @@ -221,20 +192,20 @@ void setup_frame(int sig, struct target_sigaction *ka, } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + UREG_L0], &sf->ss.locals[i]); + __put_user(env->regwptr[i + WREG_L0], &sf->ss.locals[i]); } for (i = 0; i < 8; i++) { - __put_user(env->regwptr[i + UREG_I0], &sf->ss.ins[i]); + __put_user(env->regwptr[i + WREG_O0], &sf->ss.ins[i]); } if (err) goto sigsegv; /* 3. signal handler back-trampoline and parameters */ env->regwptr[UREG_FP] = sf_addr; - env->regwptr[UREG_I0] = sig; - env->regwptr[UREG_I1] = sf_addr + + env->regwptr[WREG_O0] = sig; + env->regwptr[WREG_O1] = sf_addr + offsetof(struct target_signal_frame, info); - env->regwptr[UREG_I2] = sf_addr + + env->regwptr[WREG_O2] = sf_addr + offsetof(struct target_signal_frame, info); /* 4. signal handler */ @@ -242,11 +213,11 @@ void setup_frame(int sig, struct target_sigaction *ka, env->npc = (env->pc + 4); /* 5. return to kernel instructions */ if (ka->ka_restorer) { - env->regwptr[UREG_I7] = ka->ka_restorer; + env->regwptr[WREG_O7] = ka->ka_restorer; } else { uint32_t val32; - env->regwptr[UREG_I7] = sf_addr + + env->regwptr[WREG_O7] = sf_addr + offsetof(struct target_signal_frame, insns) - 2 * 4; /* mov __NR_sigreturn, %g1 */ @@ -316,7 +287,7 @@ long do_sigreturn(CPUSPARCState *env) __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } for (i=0; i < 8; i++) { - __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); + __get_user(env->regwptr[i + WREG_O0], &sf->info.si_regs.u_regs[i + 8]); } /* FIXME: implement FPU save/restore: @@ -433,7 +404,7 @@ void sparc64_set_context(CPUSPARCState *env) abi_ulong fp, i7, w_addr; unsigned int i; - ucp_addr = env->regwptr[UREG_I0]; + ucp_addr = env->regwptr[WREG_O0]; if (!lock_user_struct(VERIFY_READ, ucp, ucp_addr, 1)) { goto do_sigsegv; } @@ -443,7 +414,7 @@ void sparc64_set_context(CPUSPARCState *env) if ((pc | npc) & 3) { goto do_sigsegv; } - if (env->regwptr[UREG_I1]) { + if (env->regwptr[WREG_O1]) { target_sigset_t target_set; sigset_t set; @@ -474,19 +445,19 @@ void sparc64_set_context(CPUSPARCState *env) __get_user(env->gregs[5], (&(*grp)[SPARC_MC_G5])); __get_user(env->gregs[6], (&(*grp)[SPARC_MC_G6])); __get_user(env->gregs[7], (&(*grp)[SPARC_MC_G7])); - __get_user(env->regwptr[UREG_I0], (&(*grp)[SPARC_MC_O0])); - __get_user(env->regwptr[UREG_I1], (&(*grp)[SPARC_MC_O1])); - __get_user(env->regwptr[UREG_I2], (&(*grp)[SPARC_MC_O2])); - __get_user(env->regwptr[UREG_I3], (&(*grp)[SPARC_MC_O3])); - __get_user(env->regwptr[UREG_I4], (&(*grp)[SPARC_MC_O4])); - __get_user(env->regwptr[UREG_I5], (&(*grp)[SPARC_MC_O5])); - __get_user(env->regwptr[UREG_I6], (&(*grp)[SPARC_MC_O6])); - __get_user(env->regwptr[UREG_I7], (&(*grp)[SPARC_MC_O7])); + __get_user(env->regwptr[WREG_O0], (&(*grp)[SPARC_MC_O0])); + __get_user(env->regwptr[WREG_O1], (&(*grp)[SPARC_MC_O1])); + __get_user(env->regwptr[WREG_O2], (&(*grp)[SPARC_MC_O2])); + __get_user(env->regwptr[WREG_O3], (&(*grp)[SPARC_MC_O3])); + __get_user(env->regwptr[WREG_O4], (&(*grp)[SPARC_MC_O4])); + __get_user(env->regwptr[WREG_O5], (&(*grp)[SPARC_MC_O5])); + __get_user(env->regwptr[WREG_O6], (&(*grp)[SPARC_MC_O6])); + __get_user(env->regwptr[WREG_O7], (&(*grp)[SPARC_MC_O7])); __get_user(fp, &(ucp->tuc_mcontext.mc_fp)); __get_user(i7, &(ucp->tuc_mcontext.mc_i7)); - w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; + w_addr = TARGET_STACK_BIAS + env->regwptr[WREG_O6]; if (put_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; @@ -534,7 +505,7 @@ void sparc64_get_context(CPUSPARCState *env) target_sigset_t target_set; sigset_t set; - ucp_addr = env->regwptr[UREG_I0]; + ucp_addr = env->regwptr[WREG_O0]; if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) { goto do_sigsegv; } @@ -580,16 +551,16 @@ void sparc64_get_context(CPUSPARCState *env) __put_user(env->gregs[5], &((*grp)[SPARC_MC_G5])); __put_user(env->gregs[6], &((*grp)[SPARC_MC_G6])); __put_user(env->gregs[7], &((*grp)[SPARC_MC_G7])); - __put_user(env->regwptr[UREG_I0], &((*grp)[SPARC_MC_O0])); - __put_user(env->regwptr[UREG_I1], &((*grp)[SPARC_MC_O1])); - __put_user(env->regwptr[UREG_I2], &((*grp)[SPARC_MC_O2])); - __put_user(env->regwptr[UREG_I3], &((*grp)[SPARC_MC_O3])); - __put_user(env->regwptr[UREG_I4], &((*grp)[SPARC_MC_O4])); - __put_user(env->regwptr[UREG_I5], &((*grp)[SPARC_MC_O5])); - __put_user(env->regwptr[UREG_I6], &((*grp)[SPARC_MC_O6])); - __put_user(env->regwptr[UREG_I7], &((*grp)[SPARC_MC_O7])); - - w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; + __put_user(env->regwptr[WREG_O0], &((*grp)[SPARC_MC_O0])); + __put_user(env->regwptr[WREG_O1], &((*grp)[SPARC_MC_O1])); + __put_user(env->regwptr[WREG_O2], &((*grp)[SPARC_MC_O2])); + __put_user(env->regwptr[WREG_O3], &((*grp)[SPARC_MC_O3])); + __put_user(env->regwptr[WREG_O4], &((*grp)[SPARC_MC_O4])); + __put_user(env->regwptr[WREG_O5], &((*grp)[SPARC_MC_O5])); + __put_user(env->regwptr[WREG_O6], &((*grp)[SPARC_MC_O6])); + __put_user(env->regwptr[WREG_O7], &((*grp)[SPARC_MC_O7])); + + w_addr = TARGET_STACK_BIAS + env->regwptr[WREG_O6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) {