From nobody Wed May 15 19:04:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1579609371; cv=none; d=zohomail.com; s=zohoarc; b=jhGvrZgnI9gnSGFO71qWgo3lGPy+MfSILJcRltd2y8RK0SVjF9oVEdL4wnTBo6XCwDn/mHfS++fY4mQ34W1ufNe5gCeE5BAV/SeTK8iLpqeJ7A+Izvg0l1xnSCIydIGyxbLOy8APTXNUZ7dfVm4B51Je8e98GTzH3pWos9UxyEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579609371; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nwue1MLpF6124VhlwFHX11oFDj+vy8ANt2InQoQLHyw=; b=E5hkkKNs82LtuD7Psl13QhlKz+k0aQ0KKQeWvjCE2tkf6RXIhS5LttoYpmEJRSIRHp3dRjFWyejWEu7ehQ8CLmwn86u2Z/tXA5ctmv/1B7af2tjHryeIr9p+qS5FnwKZ3oHzXUqV28GUhSa4dDMsbMlgzsLAvXsYtSJclDkvA3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579609371291904.2033566647367; Tue, 21 Jan 2020 04:22:51 -0800 (PST) Received: from localhost ([::1]:52780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itsYT-0003HW-TA for importer@patchew.org; Tue, 21 Jan 2020 07:22:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50533) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itsXa-0002Jy-SL for qemu-devel@nongnu.org; Tue, 21 Jan 2020 07:21:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itsXR-0008LS-JA for qemu-devel@nongnu.org; Tue, 21 Jan 2020 07:21:54 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:55645) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1itsXR-0008K5-Aa for qemu-devel@nongnu.org; Tue, 21 Jan 2020 07:21:45 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5W4y-1jhh8w3u4w-016v1V; Tue, 21 Jan 2020 13:21:41 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/1] m68k: Fix regression causing Single-Step via GDB/RSP to not single step Date: Tue, 21 Jan 2020 13:21:38 +0100 Message-Id: <20200121122138.1708193-2-laurent@vivier.eu> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200121122138.1708193-1-laurent@vivier.eu> References: <20200121122138.1708193-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:qzrNAX6JMR+f4z69eXdGkPGxL5Na+DPPy1LwlDIxm0/DBehz34V gvzvgf1NBtbxoEDHA3CMmfgqLyex3sXm+NNtox9cvXronXaQ8dS4K2o37Bl7hxRd1J/iPme SGKfpJXPNQSA21zrxuHG3Iziq5oT6iUjKACEXzCn3P8S7ju27d2mrt7znKW2IIW171L/RoA trZ3U0T6/k+4GXWwNNffA== X-UI-Out-Filterresults: notjunk:1;V03:K0:rqWASo689eY=:ErxkVLp1PIzbs6rbVITRgN 3Zy8uVlFSE+T4Ej13IYypUj1yOZkrmxmtKHi0dq/jVwKGRU8npaRjamlrlGBJinf8X7MZdTyt iN3p5c+hhNj4gXSvgqvHptjJ4WBa3JzRbf/MuWU3Eb2OvjS4LQgwlRKjf4D8xZQLHuYcFcUov z9y3qHN9WNYqFUgrQ/kB+PCYo+r3x98Hl1HjS+qumUISpCQbGkJBXoS2qxSA1Gx6aj3bPQtNt +LS7j/SgGJmzyLASdFhvFQK/37cLXMpH5esGILmNqBQfhO4oGMozfrD7YXco3vTl0u2OFTiYp m/SCbr69kwFei0ZKtfOOkrMsOLN54kcmbOrJAfCDKJXDeJ5ahEuZv8heFI1za1e9MWtyNEy8p mFYnrRt5s+UMotdPJx4tVMVq1/HdW/rX/isjqZJimxxwGQ2glwp2vUfcdg07PbQfUvKLqvLPm FWSVzVGIUuEeLtzUDhMya1urq8/x+N/w9j/yfIFK5eCOy3wcXLoQ+GVFamxnGdvZCOlVfKhMP MwRcUtHd16hVVLwAumZ8hoh+JQij5G0ceTAd/PfTXSraUoh2NL9i8pS5FlICZxa1gE9qKFEZx s/n4Dfi87CVXGr2x14xzuW3hHVvWlzQpWPtXYuKkl5dzpehTj84KszxOMJneKZCZRCmQO+5+F 5Pl4YZwaeW5Z4ImnicgofmhQvv7lPws7RchAkm4cFAMyY4EDlGaaDIvA9ocqt5g6dildnWDxX lBNoOZ6nwJK9v8v3X14t+TY1htE1C2oxG4JUhGw30ocaRT7gslcaWecXl4HaA9schh3Qw4FcV /2ew4+fCVGodUf8cD6UGl9pNwzkDBRQ7UPwEUirWT80Wbc6BObgvyreUjlOQed6pVdK1232K2 Y4S6Yep3svKR4PS0GP0g== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 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: Lucien Murray-Pitts , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A regression that was introduced, with the refactor to TranslatorOps, drops two lines that update the PC when single-stepping is being performed. Fixes: 11ab74b01e0a ("target/m68k: Convert to TranslatorOps") Reported-by: Lucien Murray-Pitts Suggested-by: Lucien Murray-Pitts Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Laurent Vivier Message-Id: <20200116165454.2076265-1-laurent@vivier.eu> --- target/m68k/translate.c | 42 ++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 31b743717e..0f80888203 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -289,16 +289,21 @@ static void gen_jmp(DisasContext *s, TCGv dest) s->base.is_jmp =3D DISAS_JUMP; } =20 -static void gen_exception(DisasContext *s, uint32_t dest, int nr) +static void gen_raise_exception(int nr) { TCGv_i32 tmp; =20 - update_cc_op(s); - tcg_gen_movi_i32(QREG_PC, dest); - tmp =3D tcg_const_i32(nr); gen_helper_raise_exception(cpu_env, tmp); tcg_temp_free_i32(tmp); +} + +static void gen_exception(DisasContext *s, uint32_t dest, int nr) +{ + update_cc_op(s); + tcg_gen_movi_i32(QREG_PC, dest); + + gen_raise_exception(nr); =20 s->base.is_jmp =3D DISAS_NORETURN; } @@ -6198,29 +6203,36 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) { DisasContext *dc =3D container_of(dcbase, DisasContext, base); =20 - if (dc->base.is_jmp =3D=3D DISAS_NORETURN) { - return; - } - if (dc->base.singlestep_enabled) { - gen_helper_raise_exception(cpu_env, tcg_const_i32(EXCP_DEBUG)); - return; - } - switch (dc->base.is_jmp) { + case DISAS_NORETURN: + break; case DISAS_TOO_MANY: update_cc_op(dc); - gen_jmp_tb(dc, 0, dc->pc); + if (dc->base.singlestep_enabled) { + tcg_gen_movi_i32(QREG_PC, dc->pc); + gen_raise_exception(EXCP_DEBUG); + } else { + gen_jmp_tb(dc, 0, dc->pc); + } break; case DISAS_JUMP: /* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ - tcg_gen_lookup_and_goto_ptr(); + if (dc->base.singlestep_enabled) { + gen_raise_exception(EXCP_DEBUG); + } else { + tcg_gen_lookup_and_goto_ptr(); + } break; case DISAS_EXIT: /* * We updated CC_OP and PC in gen_exit_tb, but also modified * other state that may require returning to the main loop. */ - tcg_gen_exit_tb(NULL, 0); + if (dc->base.singlestep_enabled) { + gen_raise_exception(EXCP_DEBUG); + } else { + tcg_gen_exit_tb(NULL, 0); + } break; default: g_assert_not_reached(); --=20 2.24.1