From nobody Wed Nov 5 05:24:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532970966780951.1893382708571; Mon, 30 Jul 2018 10:16:06 -0700 (PDT) Received: from localhost ([::1]:53892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkBij-0000Zu-Gv for importer@patchew.org; Mon, 30 Jul 2018 13:12:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkB5S-0007iu-K3 for qemu-devel@nongnu.org; Mon, 30 Jul 2018 12:31:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkB5R-0004t0-Lv for qemu-devel@nongnu.org; Mon, 30 Jul 2018 12:31:58 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:50040 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fkB5R-0004sa-Bv for qemu-devel@nongnu.org; Mon, 30 Jul 2018 12:31:57 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 266021A1FB4; Mon, 30 Jul 2018 18:31:56 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 098AE1A1E6F; Mon, 30 Jul 2018 18:31:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Mon, 30 Jul 2018 18:12:45 +0200 Message-Id: <1532967169-22265-73-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532967169-22265-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1532967169-22265-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 72/76] linux-user: Add signal.c for nanoMIPS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pburton@wavecomp.com, smarkovic@wavecomp.com, riku.voipio@iki.fi, richard.henderson@linaro.org, laurent@vivier.eu, philippe.mathieu.daude@gmail.com, amarkovic@wavecomp.com, pjovanovic@wavecomp.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Dimitrije Nikolic Add signal.c as a dredirection of regular mips' signal.c, but also amend regular mips' signal.c. this is done to avoid the duplication of large pieces of code. Signed-off-by: Aleksandar Rikalo Signed-off-by: Aleksandar Markovic Signed-off-by: Stefan Markovic --- linux-user/mips/signal.c | 25 ++++++++++++++++++++----- linux-user/nanomips/signal.c | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 linux-user/nanomips/signal.c diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 6aa303e..ab66429 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -21,7 +21,15 @@ #include "signal-common.h" #include "linux-user/trace.h" =20 -# if defined(TARGET_ABI_MIPSO32) +#if defined(TARGET_ABI_MIPSP32) +struct target_sigcontext { + uint64_t sc_regs[32]; + uint64_t sc_pc; + uint32_t sc_used_math; + uint32_t sc_reserved; +}; +#define TARGET_ALMASK (~15) +#elif defined(TARGET_ABI_MIPSO32) struct target_sigcontext { uint32_t sc_regmask; /* Unused */ uint32_t sc_status; @@ -43,6 +51,7 @@ struct target_sigcontext { target_ulong sc_hi3; target_ulong sc_lo3; }; +#define TARGET_ALMASK (~7) # else /* N32 || N64 */ struct target_sigcontext { uint64_t sc_regs[32]; @@ -61,6 +70,7 @@ struct target_sigcontext { uint32_t sc_dsp; uint32_t sc_reserved; }; +#define TARGET_ALMASK (~15) # endif /* O32 */ =20 struct sigframe { @@ -100,6 +110,7 @@ static inline int install_sigtramp(unsigned int *tramp,= unsigned int syscall) =20 __put_user(0x24020000 + syscall, tramp + 0); __put_user(0x0000000c , tramp + 1); + return err; } =20 @@ -116,6 +127,7 @@ static inline void setup_sigcontext(CPUMIPSState *regs, __put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]); } =20 +#if !defined(TARGET_ABI_MIPSP32) __put_user(regs->active_tc.HI[0], &sc->sc_mdhi); __put_user(regs->active_tc.LO[0], &sc->sc_mdlo); =20 @@ -137,6 +149,7 @@ static inline void setup_sigcontext(CPUMIPSState *regs, for (i =3D 0; i < 32; ++i) { __put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]); } +#endif } =20 static inline void @@ -146,13 +159,14 @@ restore_sigcontext(CPUMIPSState *regs, struct target_= sigcontext *sc) =20 __get_user(regs->CP0_EPC, &sc->sc_pc); =20 - __get_user(regs->active_tc.HI[0], &sc->sc_mdhi); - __get_user(regs->active_tc.LO[0], &sc->sc_mdlo); - for (i =3D 1; i < 32; ++i) { __get_user(regs->active_tc.gpr[i], &sc->sc_regs[i]); } =20 +#if !defined(TARGET_ABI_MIPSP32) + __get_user(regs->active_tc.HI[0], &sc->sc_mdhi); + __get_user(regs->active_tc.LO[0], &sc->sc_mdlo); + __get_user(regs->active_tc.HI[1], &sc->sc_hi1); __get_user(regs->active_tc.HI[2], &sc->sc_hi2); __get_user(regs->active_tc.HI[3], &sc->sc_hi3); @@ -168,6 +182,7 @@ restore_sigcontext(CPUMIPSState *regs, struct target_si= gcontext *sc) for (i =3D 0; i < 32; ++i) { __get_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]); } +#endif } =20 /* @@ -185,7 +200,7 @@ get_sigframe(struct target_sigaction *ka, CPUMIPSState = *regs, size_t frame_size) */ sp =3D target_sigsp(get_sp_from_cpustate(regs) - 32, ka); =20 - return (sp - frame_size) & ~7; + return (sp - frame_size) & TARGET_ALMASK; } =20 static void mips_set_hflags_isa_mode_from_pc(CPUMIPSState *env) diff --git a/linux-user/nanomips/signal.c b/linux-user/nanomips/signal.c new file mode 100644 index 0000000..86efc21 --- /dev/null +++ b/linux-user/nanomips/signal.c @@ -0,0 +1 @@ +#include "../mips/signal.c" --=20 2.7.4