From nobody Tue Oct 28 12:14:04 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1514855576552687.247414546515; Mon, 1 Jan 2018 17:12:56 -0800 (PST) Received: from localhost ([::1]:50737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWB8I-0002iB-UL for importer@patchew.org; Mon, 01 Jan 2018 20:12:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWB6I-0001Vd-0o for qemu-devel@nongnu.org; Mon, 01 Jan 2018 20:10:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWB6F-00052P-5h for qemu-devel@nongnu.org; Mon, 01 Jan 2018 20:10:41 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:51782) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWB6E-00050v-SV for qemu-devel@nongnu.org; Mon, 01 Jan 2018 20:10:39 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.167]) with ESMTPSA (Nemesis) id 0M9S0c-1edLqE0klK-00CiwX; Tue, 02 Jan 2018 02:10:36 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 2 Jan 2018 02:10:18 +0100 Message-Id: <20180102011032.30056-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180102011032.30056-1-laurent@vivier.eu> References: <20180102011032.30056-1-laurent@vivier.eu> X-Provags-ID: V03:K0:V5JPPsg3cEGZM4ln1JghLZ82ePkOM7qFjFAON4OyZxeFJC4tS1a l3QLI3owGWB751t458H51Ss9VKA5uI3wtPl1h6+/5ePgMJ5CtPTHgtqXgSEEXfT0EKTnoHB lV+4FTzRlwkf2aPC4usR8UYZtvLXnx8hd79EWWbYgD0orXMtIYRBdRiPf50oYwI9Y83Tc1g v/QAyLzQnzD0NhJMajYKw== X-UI-Out-Filterresults: notjunk:1;V01:K0:DiP+Q3Ix0gI=:nFRKkBKoDWV592lY/QLYVq A9NBoiZycWp20HaWR7pA0yJ/h5nN3RTc4LZsShisUl8KiiKIr09B3HdiUHZHZV7g+u0JMSbQX 1l4YpIk39BngElJ1ryh/q4GmUmciUJrbNeKFn64oq1rlmfcYK32IZyc8eaWxfNPQwlaO5yzGh ZMbbq9UJ5sAaFZsZxm/kBHvozjVhQKMuWyLko00bacthJizUi6BjYoJi9ahtJ2YNILCVjP7k3 HQlLjxlSF8ZYYkLtS6TzBeZpfRrxN2OFwaSSaab+kK6hOAYJJPWr0K3Sl4jFHtLVIYrsYrTOx FWjRPoOTgF4qw2jFujuiOOmx/m3i1C9oSLLzgIMN7/sJTGiu2NlY+Nx0IKTmaIn6/T8TDnWmY bgYYTNxzBPK0VVvIOqIstA6Lt5Omw0UDzdbBmKKf9NvBdT8Fb/JeIQ4T65ec0wGrDG5Jov0Q+ 9lHY3fawG5v+LxflkepJ7WKoF/t68+bArfGHd+Im74mK31nTRkxmpCm5SmmnDWpsb/OdtUVwA NU/O+3Uxen1D8Z80HKHitD/NPkyxwPOqtBbUSK/i+BUVqKDpepgek6tC9vHtJrKh0qBT/9NMU x5N/wDg2lj+/pAJuMmmMIA0Xc3daVagVBuoOiJSuHOzukJ6vA26x7+/SI35jKddsNP8hhjoH1 dUfRpyhxM7BJ/LHa74zIPpWxA9/vIGKcirrc8NvH9AkUcBfvzizWPYcE1qDxNxAXPWcue792t OJddq6NBNcB/5NzyIg+JPo95syBXP+cK2vHj1Q== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PATCH v5 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 , 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