From nobody Thu Apr 18 22:34:38 2024 Delivered-To: importer@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+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 1659618784594144.28784195671028; Thu, 4 Aug 2022 06:13:04 -0700 (PDT) Received: from localhost ([::1]:40748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaet-0002m9-D4 for importer@patchew.org; Thu, 04 Aug 2022 09:13:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJaUi-0008WR-6E for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:32 -0400 Received: from mail.loongson.cn ([114.242.206.163]:52746 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaUe-0008AI-VE for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:30 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Axis1Vw+tiTugFAA--.19495S3; Thu, 04 Aug 2022 21:02:14 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, peter.maydell@linaro.org, gaosong@loongson.cn, f4bug@amsat.org, alex.bennee@linaro.org, yangxiaojuan@loongson.cn Subject: [PATCH for-7.1 1/5] target/loongarch: Fix GDB get the wrong pc Date: Thu, 4 Aug 2022 21:02:09 +0800 Message-Id: <20220804130213.1364164-2-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220804130213.1364164-1-gaosong@loongson.cn> References: <20220804130213.1364164-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf9Axis1Vw+tiTugFAA--.19495S3 X-Coremail-Antispam: 1UD129KBjvJXoWxGw17tr48Ww4ktr43GF48JFb_yoW5GFy8p3 s3u34qkFW0grZFy3srXa4FqFn8Zr17uF4avF1Iy34xCr48XFy5ZF4Fq39FqF4UG3yFvry2 qF4rZ3W5ua13XrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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; Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1659618785332100001 Content-Type: text/plain; charset="utf-8" GDB LoongArch add a register orig_a0, see the base64.xml [1]. We should add the orig_a0 to match the upstream GDB. [1]: https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loonga= rch/base64.xml Signed-off-by: Song Gao --- gdb-xml/loongarch-base64.xml | 1 + target/loongarch/cpu.c | 2 +- target/loongarch/gdbstub.c | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gdb-xml/loongarch-base64.xml b/gdb-xml/loongarch-base64.xml index 4962bdbd28..a1dd4f2208 100644 --- a/gdb-xml/loongarch-base64.xml +++ b/gdb-xml/loongarch-base64.xml @@ -39,6 +39,7 @@ + diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 1c69a76f2b..d84ec38cf7 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -683,7 +683,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, vo= id *data) cc->gdb_read_register =3D loongarch_cpu_gdb_read_register; cc->gdb_write_register =3D loongarch_cpu_gdb_write_register; cc->disas_set_info =3D loongarch_cpu_disas_set_info; - cc->gdb_num_core_regs =3D 34; + cc->gdb_num_core_regs =3D 35; cc->gdb_core_xml_file =3D "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint =3D true; =20 diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 24e126fb2d..e643eca2d5 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -19,8 +19,11 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteA= rray *mem_buf, int n) if (0 <=3D n && n < 32) { return gdb_get_regl(mem_buf, env->gpr[n]); } else if (n =3D=3D 32) { - return gdb_get_regl(mem_buf, env->pc); + /* orig_a0 */ + return gdb_get_regl(mem_buf, env->gpr[4]); } else if (n =3D=3D 33) { + return gdb_get_regl(mem_buf, env->pc); + } else if (n =3D=3D 34) { return gdb_get_regl(mem_buf, env->CSR_BADV); } return 0; @@ -36,7 +39,7 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_= t *mem_buf, int n) if (0 <=3D n && n < 32) { env->gpr[n] =3D tmp; length =3D sizeof(target_ulong); - } else if (n =3D=3D 32) { + } else if (n =3D=3D 33) { env->pc =3D tmp; length =3D sizeof(target_ulong); } --=20 2.31.1 From nobody Thu Apr 18 22:34:38 2024 Delivered-To: importer@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+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 165961836114610.064092577117776; Thu, 4 Aug 2022 06:06:01 -0700 (PDT) Received: from localhost ([::1]:57638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaY4-0003Cd-4v for importer@patchew.org; Thu, 04 Aug 2022 09:06:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJaUj-00007W-HQ for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:33 -0400 Received: from mail.loongson.cn ([114.242.206.163]:52764 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaUf-0008AQ-MY for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:32 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Axis1Vw+tiTugFAA--.19495S4; Thu, 04 Aug 2022 21:02:14 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, peter.maydell@linaro.org, gaosong@loongson.cn, f4bug@amsat.org, alex.bennee@linaro.org, yangxiaojuan@loongson.cn Subject: [PATCH for-7.1 2/5] target/loongarch: add gdb_arch_name() Date: Thu, 4 Aug 2022 21:02:10 +0800 Message-Id: <20220804130213.1364164-3-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220804130213.1364164-1-gaosong@loongson.cn> References: <20220804130213.1364164-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf9Axis1Vw+tiTugFAA--.19495S4 X-Coremail-Antispam: 1UD129KBjvJXoW7trW7CFWrtry7Cr4rWFW7urg_yoW8CFW8pF Z3uFnrKFW8JFZIyay8t398Xrn8ZrZ3uF4aqa13tr18Cw45uryvv3Wvya4qqF4UJ3yxCr4a vF1rCF15Xa17ZFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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; Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1659618362330100001 Content-Type: text/plain; charset="utf-8" LoongArch gdb_arch_name() is "Loongarch64", Dump from GDB. GNU gdb (GDB) 13.0.50.20220519-git Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "loongarch64-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) show architecture The target architecture is set to "auto" (currently "Loongarch64"). (gdb) Signed-off-by: Song Gao Reviewed-by: Richard Henderson --- target/loongarch/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index d84ec38cf7..94d5617639 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -661,6 +661,11 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = =3D { }; #endif =20 +static gchar *loongarch_gdb_arch_name(CPUState *cs) +{ + return g_strdup("Loongarch64"); +} + static void loongarch_cpu_class_init(ObjectClass *c, void *data) { LoongArchCPUClass *lacc =3D LOONGARCH_CPU_CLASS(c); @@ -686,6 +691,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, vo= id *data) cc->gdb_num_core_regs =3D 35; cc->gdb_core_xml_file =3D "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint =3D true; + cc->gdb_arch_name =3D loongarch_gdb_arch_name; =20 #ifdef CONFIG_TCG cc->tcg_ops =3D &loongarch_tcg_ops; --=20 2.31.1 From nobody Thu Apr 18 22:34:38 2024 Delivered-To: importer@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+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 1659618986765153.3316764389374; Thu, 4 Aug 2022 06:16:26 -0700 (PDT) Received: from localhost ([::1]:47844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJai9-0007Y7-LT for importer@patchew.org; Thu, 04 Aug 2022 09:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJaUl-00009W-3F for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:35 -0400 Received: from mail.loongson.cn ([114.242.206.163]:52818 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaUf-0008Al-Ot for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:34 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Axis1Vw+tiTugFAA--.19495S5; Thu, 04 Aug 2022 21:02:14 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, peter.maydell@linaro.org, gaosong@loongson.cn, f4bug@amsat.org, alex.bennee@linaro.org, yangxiaojuan@loongson.cn Subject: [PATCH for-7.1 3/5] target/loongarch: update loongarch-base64.xml Date: Thu, 4 Aug 2022 21:02:11 +0800 Message-Id: <20220804130213.1364164-4-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220804130213.1364164-1-gaosong@loongson.cn> References: <20220804130213.1364164-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf9Axis1Vw+tiTugFAA--.19495S5 X-Coremail-Antispam: 1UD129KBjvJXoWxZr1xKF4kZr47Kw4xur18uFg_yoW5GrWUpF 9Y9a4DCrs2g3y0yrWUZ3yj9Fn5Jw4DCFWFyF1rX34xC3y0qrWDGrs5J39xZr47Ga1fXrWj qFsaka1rGFsxKrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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; Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1659618987656100003 Content-Type: text/plain; charset="utf-8" Update loongarch-base64.xml to match the upstream GDB [1]. [1]:https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongar= ch/base64.xml Signed-off-by: Song Gao Reviewed-by: Richard Henderson --- gdb-xml/loongarch-base64.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb-xml/loongarch-base64.xml b/gdb-xml/loongarch-base64.xml index a1dd4f2208..2d8a1f6b73 100644 --- a/gdb-xml/loongarch-base64.xml +++ b/gdb-xml/loongarch-base64.xml @@ -1,5 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/loongarch-fpu64.xml b/gdb-xml/loongarch-fpu64.xml deleted file mode 100644 index e52cf89fbc..0000000000 --- a/gdb-xml/loongarch-fpu64.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index e643eca2d5..7d95b4b11c 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -80,5 +80,5 @@ static int loongarch_gdb_set_fpu(CPULoongArchState *env, void loongarch_cpu_register_gdb_regs_for_features(CPUState *cs) { gdb_register_coprocessor(cs, loongarch_gdb_get_fpu, loongarch_gdb_set_= fpu, - 41, "loongarch-fpu64.xml", 0); + 41, "loongarch-fpu.xml", 0); } --=20 2.31.1 From nobody Thu Apr 18 22:34:38 2024 Delivered-To: importer@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+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 1659618964826794.2254817450228; Thu, 4 Aug 2022 06:16:04 -0700 (PDT) Received: from localhost ([::1]:46930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJahl-0006uA-Os for importer@patchew.org; Thu, 04 Aug 2022 09:16:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJaUm-0000Ax-Lb for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:37 -0400 Received: from mail.loongson.cn ([114.242.206.163]:52796 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJaUg-0008AY-42 for qemu-devel@nongnu.org; Thu, 04 Aug 2022 09:02:36 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Axis1Vw+tiTugFAA--.19495S7; Thu, 04 Aug 2022 21:02:15 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, peter.maydell@linaro.org, gaosong@loongson.cn, f4bug@amsat.org, alex.bennee@linaro.org, yangxiaojuan@loongson.cn Subject: [PATCH for-7.1 5/5] target/loongarch: Update gdb_set_fpu() and gdb_get_fpu() Date: Thu, 4 Aug 2022 21:02:13 +0800 Message-Id: <20220804130213.1364164-6-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220804130213.1364164-1-gaosong@loongson.cn> References: <20220804130213.1364164-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf9Axis1Vw+tiTugFAA--.19495S7 X-Coremail-Antispam: 1UD129KBjvJXoW7tFy7tFWUurWrCF1DAF1kXwb_yoW8GF13p3 s3CanI9F4jgF9Fy3Zaqwn8X3Z8Cr1xCrsIq3WSk348Cr4UJ3Wruay8Wr92gF48Aa4vqF45 WF1rZ3W3uFyrArDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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; Received-SPF: pass client-ip=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1659618965434100001 Content-Type: text/plain; charset="utf-8" GDB LoongArch fpu use fcc register, update gdb_set_fpu() and gdb_get_fpu()= to match it. Signed-off-by: Song Gao --- target/loongarch/gdbstub.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 7d95b4b11c..265f0f43b6 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -51,9 +51,14 @@ static int loongarch_gdb_get_fpu(CPULoongArchState *env, { if (0 <=3D n && n < 32) { return gdb_get_reg64(mem_buf, env->fpr[n]); - } else if (32 <=3D n && n < 40) { - return gdb_get_reg8(mem_buf, env->cf[n - 32]); - } else if (n =3D=3D 40) { + } else if (n =3D=3D 32) { + /* fcc */ + uint64_t val =3D 0; + for (int i =3D 0; i < 8; ++i) { + val |=3D (uint64_t)env->cf[i] << (i * 8); + } + return gdb_get_reg64(mem_buf, val); + } else if (n =3D=3D 33) { return gdb_get_reg32(mem_buf, env->fcsr0); } return 0; @@ -67,10 +72,14 @@ static int loongarch_gdb_set_fpu(CPULoongArchState *env, if (0 <=3D n && n < 32) { env->fpr[n] =3D ldq_p(mem_buf); length =3D 8; - } else if (32 <=3D n && n < 40) { - env->cf[n - 32] =3D ldub_p(mem_buf); - length =3D 1; - } else if (n =3D=3D 40) { + } else if (n =3D=3D 32) { + /* fcc */ + uint64_t val =3D ldq_p(mem_buf); + for (int i =3D 0; i < 8; ++i) { + env->cf[i] =3D (val >> (i * 8)) & 1; + } + length =3D 8; + } else if (n =3D=3D 33) { env->fcsr0 =3D ldl_p(mem_buf); length =3D 4; } --=20 2.31.1