From nobody Sun Apr 28 08:43:04 2024 Delivered-To: importer2@patchew.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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622570694; cv=none; d=zohomail.com; s=zohoarc; b=D8MZEbA4A8zptNw5eWSZIBlVnGovoxMO7ENwgYcPvWZ/c4u+raDNH5u6JpZbXcwMmFf561OZGd3rb04V8KZa3z3gCWz0EAS/xznExRgoxski/YZVKbDpXulh7vN6oORvyuyDMJZEknhFfAm1sGIgrJhOtISugiFqv6GKgPEKpIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622570694; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=uJ4F/E5KDIqE3f6Qq9w+HwpBpAl/mtrj+aFgaTdQyno=; b=RGcacI6Y0cqKpgqiRUUGqJuq2s5vDS4ambqxqD9Cy2pe4Rzz5URnMEAXMadrTWl8wrhm/x9e347JnD52fIm3gYpwE4ug4XPKond4eDr//njGr1mkuykU/lriPGU1MANJwIQpbBTnN6E+wLBSgb+jCU5qsblpvO5GaBRiXkp0n00= 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+importer2=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 1622570694643666.6689885704573; Tue, 1 Jun 2021 11:04:54 -0700 (PDT) Received: from localhost ([::1]:54810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lo8l3-0004QG-IK for importer2@patchew.org; Tue, 01 Jun 2021 14:04:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lo8j6-0003Yq-23; Tue, 01 Jun 2021 14:02:52 -0400 Received: from [201.28.113.2] (port=45669 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lo8j4-0000D7-1t; Tue, 01 Jun 2021 14:02:51 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 1 Jun 2021 15:02:44 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 5A80580148B; Tue, 1 Jun 2021 15:02:44 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org Subject: [PATCH] target/ppc: fix single-step exception regression Date: Tue, 1 Jun 2021 15:02:37 -0300 Message-Id: <20210601180237.296402-1-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 01 Jun 2021 18:02:44.0528 (UTC) FILETIME=[52760B00:01D75710] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: richard.henderson@linaro.org, groug@kaod.org, Luis Pires , qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Commit 6086c75 (target/ppc: Replace POWERPC_EXCP_BRANCH with DISAS_NORETURN) broke the generation of exceptions when CPU_SINGLE_STEP or CPU_BRANCH_STEP were set, due to nip always being reset to the address of the current instruction. This fix leaves nip untouched when generating the exception. Signed-off-by: Luis Pires Reported-by: Matheus Ferst --- target/ppc/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index ea200f9637..0dd04696a6 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -4646,8 +4646,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx) if (sse & GDBSTUB_SINGLE_STEP) { gen_debug_exception(ctx); } else if (sse & (CPU_SINGLE_STEP | CPU_BRANCH_STEP)) { - uint32_t excp =3D gen_prep_dbgex(ctx); - gen_exception(ctx, excp); + gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_= dbgex(ctx))); } else { tcg_gen_exit_tb(NULL, 0); } @@ -9128,7 +9127,11 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cs) } /* else CPU_SINGLE_STEP... */ if (nip <=3D 0x100 || nip > 0xf00) { - gen_exception(ctx, gen_prep_dbgex(ctx)); + if (is_jmp =3D=3D DISAS_EXIT || is_jmp =3D=3D DISAS_CHAIN) { + /* We have not updated nip yet, so do it now */ + gen_update_nip(ctx, nip); + } + gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_= dbgex(ctx))); return; } } --=20 2.25.1