From nobody Thu May 2 01:05:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1568103434; cv=none; d=zoho.com; s=zohoarc; b=lA4hayZshl0ZKapE7iwkL1VE3WjQ3A24AOXhASXIwb3vm5wNDA2L8B+NvOwgMMuQUuXrgDz0hX+IpWZeC/7bOK3V9YMDMytzrwE5LpqVbhwiAQ7bXGJMBDj4IvwCHRzf0Yqv99ijqvr19yldazk/u36YcmDJUe2l6jjvQijTE2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568103434; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=ZLwDW8/SdcVwu9RlqeEVH9fFpSCX1ZG+rG6X15XyUSY=; b=iQsGKuKPcpBQikqSlOMIBmyv0A8ivDl45bugusD/u7LClMC/SPq/4GLt74oXrpqM6xqZK1svTHmFrCHHBGm1LGxBuLMsyAFcc3fJCBj18qTd3unAOabu08exQokt6YRwCpBAQRgOsadShN3eINorzwDdTL0URkc9YRee8/hKcGo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568103433845276.6480118477872; Tue, 10 Sep 2019 01:17:13 -0700 (PDT) Received: from localhost ([::1]:34986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7bKf-0008Hc-4H for importer@patchew.org; Tue, 10 Sep 2019 04:17:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58186) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7bJp-0007iR-0A for qemu-devel@nongnu.org; Tue, 10 Sep 2019 04:16:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7bJo-0002oH-0o for qemu-devel@nongnu.org; Tue, 10 Sep 2019 04:16:08 -0400 Received: from mel.act-europe.fr ([2a02:2ab8:224:1::a0a:d2]:50773 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i7bJn-0002me-RH; Tue, 10 Sep 2019 04:16:07 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6FB3C81391; Tue, 10 Sep 2019 10:16:05 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RP3vM3EvM-lr; Tue, 10 Sep 2019 10:16:05 +0200 (CEST) Received: from localhost.localdomain.localdomain (lfbn-tou-1-447-75.w86-206.abo.wanadoo.fr [86.206.4.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 86C788137E; Tue, 10 Sep 2019 10:16:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com From: KONRAD Frederic To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 10:15:41 +0200 Message-Id: <1568103341-28636-1-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:2ab8:224:1::a0a:d2 Subject: [Qemu-devel] [PATCH v1] gdbstub: riscv: fix the fflags registers 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: "open list:RISC-V TCG CPUs" , Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , KONRAD Frederic , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" While debugging an application with GDB the following might happen: (gdb) return Make xxx return now? (y or n) y Could not fetch register "fflags"; remote failure reply 'E14' This is because riscv_gdb_get_fpu calls riscv_csrrw_debug with a wrong csr number (8). It should use the csr_register_map in order to reach the riscv_cpu_get_fflags callback. Signed-off-by: KONRAD Frederic Reviewed-by: Alistair Francis Reviewed-by: Palmer Dabbelt --- target/riscv/gdbstub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 27be932..ded140e 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -313,7 +313,8 @@ static int riscv_gdb_get_fpu(CPURISCVState *env, uint8_= t *mem_buf, int n) * register 33, so we recalculate the map index. * This also works for CSR_FRM and CSR_FCSR. */ - result =3D riscv_csrrw_debug(env, n - 33 + 8, &val, 0, 0); + result =3D riscv_csrrw_debug(env, n - 33 + csr_register_map[8], &v= al, + 0, 0); if (result =3D=3D 0) { return gdb_get_regl(mem_buf, val); } @@ -335,7 +336,8 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_= t *mem_buf, int n) * register 33, so we recalculate the map index. * This also works for CSR_FRM and CSR_FCSR. */ - result =3D riscv_csrrw_debug(env, n - 33 + 8, NULL, val, -1); + result =3D riscv_csrrw_debug(env, n - 33 + csr_register_map[8], NU= LL, + val, -1); if (result =3D=3D 0) { return sizeof(target_ulong); } --=20 1.8.3.1