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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16254C636CD for ; Tue, 7 Feb 2023 15:21:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A006685DD0; Tue, 7 Feb 2023 16:21:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2732985E08; Tue, 7 Feb 2023 16:21:15 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 3CC8085DFE for ; Tue, 7 Feb 2023 16:21:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D6F86106F; Tue, 7 Feb 2023 07:21:53 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9AF313F703; Tue, 7 Feb 2023 07:21:10 -0800 (PST) From: Andre Przywara To: Sean Anderson , Kautuk Consul Cc: Simon Glass , Tom Rini , u-boot@lists.denx.de Subject: [PATCH 0/2] semihosting: use assembly conduit functions Date: Tue, 7 Feb 2023 15:21:03 +0000 Message-Id: <20230207152105.2167641-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi, to trigger the actual semihosting action in the debugger, we used some carefully constructed inline assembly sequence. This was motivated by the trigger being really just a single instruction, so originally this could be neatly inlined by the compiler. However we now have a separate function anyway, so inlining is no longer happening. On top of that the inline assembly was really fragile and hard to read. To clean that up, just use actual assembly functions, which does away with all the tricks to force the compiler into submission. Patch 1 is for ARM, patch 2 for RISC-V. Briefly tested on arm and aarch64 QEMU, and on an ARMv8 fastmodel, plus compile-tested for RISC-V. Please test it on your system! Cheers, Andre P.S. This idea came up before, but I don't remember if patches were floating around already. If there were, apologies for my ignorance, and I will be all too happy to use those patches instead of mine here, just point me to them. Andre Przywara (2): arm: semihosting: replace inline assembly with assembly file riscv: semihosting: replace inline assembly with assembly file arch/arm/lib/semihosting.S | 31 ++++++++++++++++++++++++ arch/arm/lib/semihosting.c | 47 ------------------------------------ arch/riscv/lib/semihosting.S | 22 +++++++++++++++++ arch/riscv/lib/semihosting.c | 24 ------------------ 4 files changed, 53 insertions(+), 71 deletions(-) create mode 100644 arch/arm/lib/semihosting.S delete mode 100644 arch/arm/lib/semihosting.c create mode 100644 arch/riscv/lib/semihosting.S delete mode 100644 arch/riscv/lib/semihosting.c -- 2.25.1