From nobody Tue Nov 18 04:26:58 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1607977306; cv=none; d=zohomail.com; s=zohoarc; b=TQAsq+oGmGFdaaErUcijUBPpJksWEWHQT5dGuGuBazAYzharlOx9Y3pwS8sjtgRQSDdgFbNQYJc6vipnnicQwmdU4RtylG+Go3X2ee/jQQ/+9jfteWFGDDY4pAppwjcSyWZjRMjdIaqX8crWrCvHWJds1rTKSFwwtZ2JYTP4wgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607977306; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hc1suCpwgqGstWBGIr/Djt3Z4l7yWC89pyLo8A6B0VE=; b=ZBuMabFJMKs9KN8bgwDZS2+D3DcQ1gXBBQur9FDuGE92Qtd0yLoypBtTvn+KQhvoC+B2Q4aSgVif3O6JTEAfXumk/XP32gVEsMciep9LSUygo/LDHFuWijrvDslVyyav9iYTB1WQGZ+octgvAQvB/xf8XwZcA7OJbtOnHQPJlv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607977306808640.1520831537209; Mon, 14 Dec 2020 12:21:46 -0800 (PST) Received: from localhost ([::1]:33066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kouDh-0007TV-32 for importer@patchew.org; Mon, 14 Dec 2020 15:13:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kou81-0001A8-V8; Mon, 14 Dec 2020 15:07:29 -0500 Received: from home.keithp.com ([63.227.221.253]:51872 helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kou80-0004H4-23; Mon, 14 Dec 2020 15:07:29 -0500 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 06ED03F2E37E; Mon, 14 Dec 2020 12:07:20 -0800 (PST) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id moJfYBEkvgQC; Mon, 14 Dec 2020 12:07:20 -0800 (PST) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id B9C4C3F2E37A; Mon, 14 Dec 2020 12:07:17 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 50F581582231; Mon, 14 Dec 2020 12:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1607976441; bh=SHaBrTVYFaEGb4To3qkPAGlihv7272MZZpVhhlOyO1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LuNw2ZaDvhHrmM7DlwbXWqyGt2Kk9rujLnzy/QZ4H+oIEZXwsEabvd42ct3sBYxJQ dhzaIj0BHWQtEuPWc0ls7XoDqX0sySvH7xp/45BVT193CgV9yeHdyUq23aNrTBy9Ql 9m51qYuqxRucJCE+skVCfhlZYs1id6fnWIm3gdUJouR2+GFdkr8g9vf6ZEiyOdq8az eR3FxEVi8TkYVPmMqTxNCWe4MYz3tjiycXVDW5O/NVAMxhe7my/qqXvRaLW/1FBjw8 Zwu5MJhneaLY2cEVlnxYYVPg2VTwmaZsB6sYeBG2pOforKDbW+EVcUpN9KReHoyJxw Bw6g4ohH4X7Zw== X-Virus-Scanned: Debian amavisd-new at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1607976437; bh=SHaBrTVYFaEGb4To3qkPAGlihv7272MZZpVhhlOyO1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQikXlR/ZLy2EEIdkPMWnOYaq+lT+w1rFYuaydjqXOv/u/TSZgZcBK3GnEzbFDKSa WmA5r0hhgDMoAvK5686xqXRVhevCezaIxVtL4hddEyYfb/cbmER4LUC9TZTl+jc4vG p/0tIlBAQAILOj/A/r8XIzl3OxUgVkaMCPisErvR1PNCA3MyzE0+XyF6wGh+nLrc27 N3pFw9J+hHKgO0elyDcMuU9Z84PtVE3CKhqoUGAYlrdbi9EoZv2I9Oe9WcKKYETV/4 c4/zoDtpN6rkBDd1toMt0Lj2BhRen2SRStr61AQ6qXj8JSflFxLgM5bsFM+uFRNx3E rTWCjTjz3Yz7g== To: qemu-devel@nongnu.org Subject: [PATCH 6/9] riscv: Add semihosting support for user mode Date: Mon, 14 Dec 2020 12:07:10 -0800 Message-Id: <20201214200713.3886611-7-keithp@keithp.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214200713.3886611-1-keithp@keithp.com> References: <87wnxktost.fsf@linaro.org> <20201214200713.3886611-1-keithp@keithp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Peter Maydell , Keith Packard , qemu-riscv@nongnu.org, Sagar Karandikar , Bastian Koppelmann , Laurent Vivier , qemu-arm@nongnu.org, Alistair Francis , Palmer Dabbelt , Kito Cheng , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Keith Packard From: Keith Packard via X-ZohoMail-DKIM: fail (found 2 invalid signatures) Content-Type: text/plain; charset="utf-8" From: Kito Cheng This could made testing more easier and ARM/AArch64 has supported on their linux user mode too, so I think it should be reasonable. Verified GCC testsuite with newlib/semihosting. Signed-off-by: Kito Cheng Reviewed-by: Keith Packard --- linux-user/riscv/cpu_loop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index aa9e437875..9665dabb09 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -23,6 +23,7 @@ #include "qemu.h" #include "cpu_loop-common.h" #include "elf.h" +#include "hw/semihosting/common-semi.h" =20 void cpu_loop(CPURISCVState *env) { @@ -91,6 +92,10 @@ void cpu_loop(CPURISCVState *env) sigcode =3D TARGET_SEGV_MAPERR; sigaddr =3D env->badaddr; break; + case RISCV_EXCP_SEMIHOST: + env->gpr[xA0] =3D do_common_semihosting(cs); + env->pc +=3D 4; + break; case EXCP_DEBUG: gdbstep: signum =3D TARGET_SIGTRAP; --=20 2.29.2