From nobody Tue Oct 28 12:15:22 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 1514936761158226.32734881568615; Tue, 2 Jan 2018 15:46:01 -0800 (PST) Received: from localhost ([::1]:59618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWWFs-0002Sv-CA for importer@patchew.org; Tue, 02 Jan 2018 18:46:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWWBL-00071h-Dz for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWWBJ-00035S-4f for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:19 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:60474) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWWBI-00034q-Qo for qemu-devel@nongnu.org; Tue, 02 Jan 2018 18:41:17 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Lsdqf-1evDyV1y49-012KJ2; Wed, 03 Jan 2018 00:41:14 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 3 Jan 2018 00:40:54 +0100 Message-Id: <20180102234108.32713-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180102234108.32713-1-laurent@vivier.eu> References: <20180102234108.32713-1-laurent@vivier.eu> X-Provags-ID: V03:K0:LBXf/A6ysXhv3J6Z+YGRo44+zSyqZres3+Ybx34BMIcQcNWMTjs 61SX5JihkB85bJFClbmut1M89tHcU4cbjUaalonPa2zyNqol8XLTOxix0tzVHBiUN8ABjYQ neEyowYb4uo7+lHlnXxsDM7ErYwjN374wXg9H/sfpvuM/dgITwWXJYmXMDnOLoP7NV4Dy7z f/MvonbB75cE/Dz5pCwOA== X-UI-Out-Filterresults: notjunk:1;V01:K0:rQ4/DMzaPJY=:i8yCoFA8cBAs8RUeBn4F7a GuRsUSHyViroCkanKzYg69oG97XuzRHNFxvKpswDq8+ddvkunS0aOOrwb475LjHqopGetiZB7 1U3Sw4Lx90zhkXwBIVRQbwMmIH7ciZAbA7SzWWlPCWAA0QiNAKf9HaEZIrZbx2HKuXeZYKIj9 HfYvKrB5T0tXP8OQ2H99xfItzeB1B+ofqbSGuWD7+HksEzhX6TMh4W9kFSzYEZSfkwE+mP6fa utraMlqR5W0BJGoWKHdocVZHLc5mDOfja/eGWWGlROEwkB6mrT1RPgfJNXPdlN7XHR9qJqlhl UDY+B9O33ynIshbJ+M6x2+jM3k3B2go8lXxxBv4Vvr5+pH63I95jE1RRX5iTJ4vxniRKvaUrh 9ag0JaMWUDTqh6eXE3ynwCcEQ/Zwzx0CejMuG3MDp3gDP/00UpqidaGi710UeY1SJ/DQ63PVM jBNL5RU/3eCFS+QYlG57UmU3GvEF1PVzztB70I5g46y2tpxNJqCQaUohJXpWFlQybMXvsrkjH TgagpVvc27/WBc+XmohHIqFh6IM128ukZFMM/6M8a35Z7LWfuKdtHci5EiOwkiTgdVSQG37km FVv6pzQfGzQAw5mSEfPx4VuTL/E15eCpeR3QKpOxYWDJDXTQL9aupTtpL7R1dGy7y0l9qnfRz rX9V3hR08YR0L8BdWeX13zJxyr0/Bg3pUm35IGLYlRA1ACo9YxglKErS0tbDpWKexc31oRaEl 5va4e5KFXNb9xVskLdHG0oPj1OISGAR9YK36Jg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PATCH v6 03/17] linux-user, m68k: correctly manage SR in context 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: Thomas Huth , Richard Henderson , Laurent Vivier 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" Use cpu_m68k_get_ccr()/cpu_m68k_set_ccr() to setup and restore correctly the value of SR in the context structure. Fix target_rt_setup_ucontext(). Fixes: 3219de458c ("linux-user: correctly manage SR in ucontext") Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- linux-user/signal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index dae14d4a89..74fa03f96d 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5612,13 +5612,14 @@ struct target_rt_sigframe static void setup_sigcontext(struct target_sigcontext *sc, CPUM68KState *e= nv, abi_ulong mask) { + uint32_t sr =3D (env->sr & 0xff00) | cpu_m68k_get_ccr(env); __put_user(mask, &sc->sc_mask); __put_user(env->aregs[7], &sc->sc_usp); __put_user(env->dregs[0], &sc->sc_d0); __put_user(env->dregs[1], &sc->sc_d1); __put_user(env->aregs[0], &sc->sc_a0); __put_user(env->aregs[1], &sc->sc_a1); - __put_user(env->sr, &sc->sc_sr); + __put_user(sr, &sc->sc_sr); __put_user(env->pc, &sc->sc_pc); } =20 @@ -5634,7 +5635,7 @@ restore_sigcontext(CPUM68KState *env, struct target_s= igcontext *sc) __get_user(env->aregs[1], &sc->sc_a1); __get_user(env->pc, &sc->sc_pc); __get_user(temp, &sc->sc_sr); - env->sr =3D (env->sr & 0xff00) | (temp & 0xff); + cpu_m68k_set_ccr(env, temp); } =20 /* @@ -5726,7 +5727,7 @@ static inline int target_rt_setup_ucontext(struct tar= get_ucontext *uc, CPUM68KState *env) { target_greg_t *gregs =3D uc->tuc_mcontext.gregs; - uint32_t sr =3D cpu_m68k_get_ccr(env); + uint32_t sr =3D (env->sr & 0xff00) | cpu_m68k_get_ccr(env); =20 __put_user(TARGET_MCONTEXT_VERSION, &uc->tuc_mcontext.version); __put_user(env->dregs[0], &gregs[0]); --=20 2.14.3