From patchwork Tue Feb 13 20:57:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Seeger X-Patchwork-Id: 873176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zgw155Qbgz9t2c for ; Wed, 14 Feb 2018 08:00:41 +1100 (AEDT) Received: from localhost ([::1]:49391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elhgq-0003Ga-NL for incoming@patchwork.ozlabs.org; Tue, 13 Feb 2018 16:00:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elhdj-000149-0q for qemu-devel@nongnu.org; Tue, 13 Feb 2018 15:57:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elhdg-0004uP-0B for qemu-devel@nongnu.org; Tue, 13 Feb 2018 15:57:23 -0500 Received: from p3plsmtpa06-06.prod.phx3.secureserver.net ([173.201.192.107]:45889) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elhdf-0004so-Qe for qemu-devel@nongnu.org; Tue, 13 Feb 2018 15:57:19 -0500 Received: from wirbelwind.localnet ([204.197.155.4]) by :SMTPAUTH: with SMTP id lhdcea3fidERalhdceYV0f; Tue, 13 Feb 2018 13:57:17 -0700 From: Steven Seeger To: QEMU Developers Date: Tue, 13 Feb 2018 15:57:14 -0500 Message-ID: <4476423.I6xtnU8gSc@wirbelwind> Organization: Embedded Flight Systems, Inc. MIME-Version: 1.0 X-CMAE-Envelope: MS4wfD5h6FPf1+qeMxmElPACSSnJcFL78UvpGl7QHLQmTNj4zX5IcF24Ih7+TluKMkfLF2XwmS5APCBgVOT74qXVxjTaJ1Q4D/pcp7bWdjwaojbtyyAc4JAT D2o+KSzmkzl9qhznKTDfwlBLIZM38IpfulOlwYSAy4mHT5gYwX5KDmSxomC/mtLKAIm7wXGbawe++14WHbvARz8UzIlWUyTgzXs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 173.201.192.107 Subject: [Qemu-devel] sparc branch to pc+4 issue 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: , Reply-To: steven.seeger@flightsystems.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Consider pc==0x100: 0x100 b 0x104 The uncondtional not-annulled branch will go to 0x104, which is the next instruction anyway. do_branch() will leave dc->pc and dc->npc both set to 0x104. This causes gdb to have a problem when single stepping. It will be stuck. QEMU will execute past this somehow, but I'm not sure with what side effect. It seems to me the following patch will fix this: } I apologize if I am missing something with this assessment. Steven diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 71e0853e43..95ca90b51a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1464,6 +1464,7 @@ static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) dc->npc = dc->pc + 4; } else { dc->pc = dc->npc; + if(target==dc->pc) target += 4; dc->npc = target; tcg_gen_mov_tl(cpu_pc, cpu_npc);