From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7103E8B396 for ; Wed, 4 Feb 2026 03:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=HO4AY7G4/rVpav8iMtDWHWTKZkE5epcYy3uEu1LV5CM=; b=BIuh6KxBA2te3p 0yPauS9jQbX3dgGDWx9zf6xWEq7gWo5UXCs6q0+sIaL42Tgz2xu11v/5CqvZ7SiqRPz7u5fEoJ+e7 j//SF0xE93CYIJ2vH52yQT3kdO314lfU147buKFwfoSj9adfK6t6hgIuOL37OfSc5uWQCrrsra3CM H4EF4SRb6KrNU1TZBRxf6RCoTLkab5lFw2qkdK0++doc44tuKlh24rGQvlpClKCeXE/xh5R7Dr9BT /Q/ran73+c1RLNaK52mSo7oJ1j4uhNsgm9Fws5nup7cOLUwBbscCmQLLgy7WKLqgUjsc5IOdJpPea xCmlS1tsmU/73aCUDDtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vnTlS-00000007qVg-2rgy; Wed, 04 Feb 2026 03:41:14 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vnTlP-00000007qV0-0aVj for linux-riscv@lists.infradead.org; Wed, 04 Feb 2026 03:41:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id E85CE41837; Wed, 4 Feb 2026 03:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D737C4CEF7; Wed, 4 Feb 2026 03:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770176467; bh=2mshIa7bdKQ7x6zOgVfsZ7udFG/a4b5ow9zlvMJLRYM=; h=Date:From:To:cc:Subject:From; b=rUi5uAdb5dPHieF7qAVfw0l8NiJbmLd43YWL+RnGwDaLT49TzsF0EftSwWdEBnzKr SUc0ABdpXxCVZW2FIimV4ZYEt+9CdzhfgGgD1c02yDWUPvsBQmbCIIGf6DImSs5zZI NJ7+aDucRSHVRHUtDzYTpZq0VEBQ+g+rvpdGQpvOhvrYL3Kg+uTLqznZE0x32agce3 05eP5eALpcAn9vFakjy8UJ9QNxCMy7VM8IPuoGnjLAkyN9Z13xCetKtBX+likbdsG4 OcntMqNGRQso5e4xEhkqDwLVw+KDiAoJilv5i1NI6iWsaTWwEL4tIl2SiaQYBy2HV7 fSrP7L0z77kUg== Date: Tue, 3 Feb 2026 20:41:02 -0700 (MST) From: Paul Walmsley To: linux-riscv@lists.infradead.org cc: Vincent Chen Subject: [PATCH] riscv: kgdb: fix several debug register assignment bugs Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260203_194111_199766_38D475CB X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Fix several bugs in the RISC-V kgdb implementation: - The element of dbg_reg_def[] that is supposed to pertain to the S1 register embeds instead the struct pt_regs offset of the A1 register. Fix this to use the S1 register offset in struct pt_regs. - The sleeping_thread_to_gdb_regs() function copies the value of the S10 register into the gdb_regs[] array element meant for the S9 register, and copies the value of the S11 register into the array element meant for the S10 register. It also neglects to copy the value of the S11 register. Fix all of these issues. Fixes: fe89bd2be8667 ("riscv: Add KGDB support") Cc: Vincent Chen Signed-off-by: Paul Walmsley --- For v6.20-rc. arch/riscv/kernel/kgdb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/kgdb.c b/arch/riscv/kernel/kgdb.c index 15fec5d1e6de..0bf629204c76 100644 --- a/arch/riscv/kernel/kgdb.c +++ b/arch/riscv/kernel/kgdb.c @@ -175,7 +175,7 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { {DBG_REG_T1, GDB_SIZEOF_REG, offsetof(struct pt_regs, t1)}, {DBG_REG_T2, GDB_SIZEOF_REG, offsetof(struct pt_regs, t2)}, {DBG_REG_FP, GDB_SIZEOF_REG, offsetof(struct pt_regs, s0)}, - {DBG_REG_S1, GDB_SIZEOF_REG, offsetof(struct pt_regs, a1)}, + {DBG_REG_S1, GDB_SIZEOF_REG, offsetof(struct pt_regs, s1)}, {DBG_REG_A0, GDB_SIZEOF_REG, offsetof(struct pt_regs, a0)}, {DBG_REG_A1, GDB_SIZEOF_REG, offsetof(struct pt_regs, a1)}, {DBG_REG_A2, GDB_SIZEOF_REG, offsetof(struct pt_regs, a2)}, @@ -244,8 +244,9 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) gdb_regs[DBG_REG_S6_OFF] = task->thread.s[6]; gdb_regs[DBG_REG_S7_OFF] = task->thread.s[7]; gdb_regs[DBG_REG_S8_OFF] = task->thread.s[8]; - gdb_regs[DBG_REG_S9_OFF] = task->thread.s[10]; - gdb_regs[DBG_REG_S10_OFF] = task->thread.s[11]; + gdb_regs[DBG_REG_S9_OFF] = task->thread.s[9]; + gdb_regs[DBG_REG_S10_OFF] = task->thread.s[10]; + gdb_regs[DBG_REG_S11_OFF] = task->thread.s[11]; gdb_regs[DBG_REG_EPC_OFF] = task->thread.ra; } -- 2.51.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv