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 EA1E5C433F5 for ; Wed, 16 Feb 2022 16:49:40 +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:In-Reply-To:MIME-Version:References: 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: List-Owner; bh=l2ga9WXgZz49SMLgVZrNNn5lqWuZzBrlh793ZBGcKq4=; b=GMRR/NmDfgJIFy enpzVQEtTma9puCbZozTMk6Hpk8VMfuaXnA6hjOzrMVhzGTBTGI/QfMuvzdU3CJ6HnAc4ryRHrq5Z 4gODdsMxEZ428cQ0w2cPV2Qo4idE2pQnR2sFEOg3F3+R32n2mgjPaFAlHzBsK3ZID4CsFGXi1gsw2 3KsGUBRvwUIwrLX3THaUYlayjXHv09ibuON1d6LTblAhrTcI6fFCBuj/j26I1J0IEcG5QSXTBq0Cq IXcXFAErO8Zu1ijah2tnJDsPHi7X2AxPoH1Y7g3aLYRDpEwIpVYg4BobtxDwaobBacGjHdhb0Qkox 5MxPO07QJ0XYU5VfnG7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKNTl-007mJB-Oz; Wed, 16 Feb 2022 16:48:33 +0000 Received: from mail.sig21.net ([217.197.84.222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKNTi-007mGa-9u for linux-arm-kernel@lists.infradead.org; Wed, 16 Feb 2022 16:48:32 +0000 Received: from localhorst ([127.0.0.1]) by mail.sig21.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nKNT3-0002yQ-Ts ; Wed, 16 Feb 2022 17:47:49 +0100 Received: from js by abc.local with local (Exim 4.95) (envelope-from ) id 1nKNT3-0003v4-LS; Wed, 16 Feb 2022 17:47:49 +0100 Date: Wed, 16 Feb 2022 17:47:49 +0100 From: Johannes Stezenbach To: "Russell King (Oracle)" Cc: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] ARM: Fix kgdb breakpoint for Thumb2 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220216_084830_365297_1E955792 X-CRM114-Status: GOOD ( 21.71 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 16, 2022 at 03:41:22PM +0000, Russell King (Oracle) wrote: > The kgdb code needs to register an undef hook for the Thumb UDF > instruction that will fault in order to be functional on Thumb2 > platforms. > > Reported-by: Johannes Stezenbach > Signed-off-by: Russell King (Oracle) > --- > This has the kgdb_arch_exit() problems fixed. Please check and > supply tested-by etc attributations. Thanks. Compiles cleanly and works. Tested-by: Johannes Stezenbach Thanks, Johannes > arch/arm/kernel/kgdb.c | 36 ++++++++++++++++++++++++++++-------- > 1 file changed, 28 insertions(+), 8 deletions(-) > > diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c > index 7bd30c0a4280..22f937e6f3ff 100644 > --- a/arch/arm/kernel/kgdb.c > +++ b/arch/arm/kernel/kgdb.c > @@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) > return 0; > } > > -static struct undef_hook kgdb_brkpt_hook = { > +static struct undef_hook kgdb_brkpt_arm_hook = { > .instr_mask = 0xffffffff, > .instr_val = KGDB_BREAKINST, > - .cpsr_mask = MODE_MASK, > + .cpsr_mask = PSR_T_BIT | MODE_MASK, > .cpsr_val = SVC_MODE, > .fn = kgdb_brk_fn > }; > > -static struct undef_hook kgdb_compiled_brkpt_hook = { > +static struct undef_hook kgdb_brkpt_thumb_hook = { > + .instr_mask = 0xffff, > + .instr_val = KGDB_BREAKINST & 0xffff, > + .cpsr_mask = PSR_T_BIT | MODE_MASK, > + .cpsr_val = PSR_T_BIT | SVC_MODE, > + .fn = kgdb_brk_fn > +}; > + > +static struct undef_hook kgdb_compiled_brkpt_arm_hook = { > .instr_mask = 0xffffffff, > .instr_val = KGDB_COMPILED_BREAK, > - .cpsr_mask = MODE_MASK, > + .cpsr_mask = PSR_T_BIT | MODE_MASK, > .cpsr_val = SVC_MODE, > .fn = kgdb_compiled_brk_fn > }; > > +static struct undef_hook kgdb_compiled_brkpt_thumb_hook = { > + .instr_mask = 0xffff, > + .instr_val = KGDB_COMPILED_BREAK & 0xffff, > + .cpsr_mask = PSR_T_BIT | MODE_MASK, > + .cpsr_val = PSR_T_BIT | SVC_MODE, > + .fn = kgdb_compiled_brk_fn > +}; > + > static int __kgdb_notify(struct die_args *args, unsigned long cmd) > { > struct pt_regs *regs = args->regs; > @@ -210,8 +226,10 @@ int kgdb_arch_init(void) > if (ret != 0) > return ret; > > - register_undef_hook(&kgdb_brkpt_hook); > - register_undef_hook(&kgdb_compiled_brkpt_hook); > + register_undef_hook(&kgdb_brkpt_arm_hook); > + register_undef_hook(&kgdb_brkpt_thumb_hook); > + register_undef_hook(&kgdb_compiled_brkpt_arm_hook); > + register_undef_hook(&kgdb_compiled_brkpt_thumb_hook); > > return 0; > } > @@ -224,8 +242,10 @@ int kgdb_arch_init(void) > */ > void kgdb_arch_exit(void) > { > - unregister_undef_hook(&kgdb_brkpt_hook); > - unregister_undef_hook(&kgdb_compiled_brkpt_hook); > + unregister_undef_hook(&kgdb_brkpt_arm_hook); > + unregister_undef_hook(&kgdb_brkpt_thumb_hook); > + unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook); > + unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook); > unregister_die_notifier(&kgdb_notifier); > } > > -- > 2.30.2 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel