From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849476; cv=none; d=zoho.com; s=zohoarc; b=ObyBfMaFIHK87oonzEpUdoVExCNbFEZlvLoyLhOqpD+4cVUptClCrVKK/RyXJYel8C0n6blE5/8wUf/ysdMonTOg1OgBoSfO48fF/eUXmPoiJ6WharR8/MLbKbWRiYY2U4O+hpGO57OUKXFTXoOqZ70RcFeP+HmCygtM3tgcNfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849476; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=LkIQoYRogYWf/nAfvY/NE8geNYabwmvt63Bf8EocCfk=; b=cDKCJuNsfeucbiDDl4C/RV9ozfkqeuI1499AGYhvTDdZ/MVmPpXSMfywgci3nTjXdevxdtQl3yBWtQKPv3Ku5K9U11RiWi010/dqGM06FTFbzUvNjCl0IvQ11LD7KPb3EAlQE6i0DY9kpN1kc6yRskyk4SJ35Rz4fW9+PDFhYwM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 155784947654746.0825969405804; Tue, 14 May 2019 08:57:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:50228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZoP-0000Nv-BI for importer@patchew.org; Tue, 14 May 2019 11:57:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjo-0004kV-MN for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjm-00069l-1P for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:08 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36186) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjl-00065g-MZ for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:05 -0400 Received: by mail-wr1-x443.google.com with SMTP id s17so3348368wru.3 for ; Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t13sm25642413wra.81.2019.05.14.08.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:02 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0EF161FF8C; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LkIQoYRogYWf/nAfvY/NE8geNYabwmvt63Bf8EocCfk=; b=SsInOEMTAfhhaosqjO+tuCz+5/kmvYWF0lbb1gwnw36UX/r3E7OssjRY/vShLLCtTL tlqU36IYxluyPPvSJJMfqk3WDFqR/08OFccMmKJIDkwy7nwXu5BeEkYXd2L6lh0LdEth X7w7mnxymeDGvrlPChNJQgWZlvNV9oiPvqB/ZkEl7bNHvew+s+dgIFhwhy6QfqumWbw8 X49t3gUSZi2Gag+q3L2HFbc3XFVCpYNoxptekZAtJmOfM9mT+1sCmPbS1Yi1nvrYFXCO pIKa/+a4V/ng7evHaPNpirAgZ13CF+lHYbFn9kgBqrcz7RFGqTZtDpOkmqxIwmQuPEfB 7Xrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LkIQoYRogYWf/nAfvY/NE8geNYabwmvt63Bf8EocCfk=; b=ClOAyc1kOxuFUYM/0OJDqXBbaQJPh4mRItrOPIUdBC7WkAfuMi/prhe0rVQqLPWdEj P5j1bbm8KMth4EPt16czYjA1ii+VDDU9k5P3YNXD9lgpa00/l55wMogwH0Q8C9BYW5pp L+mVFFBM8jOmG+1TUk6xSo2+hufMhnRAgaDZTgnzy+/nopo0hpSLczosz9bS9cNZvKCe EfJ1aP6P2ks8B2uSLK2lL8tEgzEBunSM6CILe2nEzvll8hxJQExczjFuL7lP/sGOXNNU rjFwP9xcgJGDi3XmC2t5KzZRUpqWNghZScLytTGZIqG8ZrC0oIrzNXhlkbzdTGWN1TQI ucxQ== X-Gm-Message-State: APjAAAWKfyuODIyrq0A01Cc1rx2YJfag6Il1AEvUrya97uxZpQayTTXX mXUGNzQGa7dLQOT1hIc8MKvfZQ== X-Google-Smtp-Source: APXvYqwgjw985F4AaI+gymoLXBx6z3ugPHT1HtCQ1igGe4aTtznHEoGKHZCfkKN7bH9cajMqv12sqQ== X-Received: by 2002:a5d:6a52:: with SMTP id t18mr19927180wrw.146.1557849184253; Tue, 14 May 2019 08:53:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:51 +0100 Message-Id: <20190514155301.16123-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [RFC PATCH 01/11] semihosting: move semihosting configuration into its own directory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Peter Maydell , Aleksandar Rikalo , Chris Wulff , Laurent Vivier , Max Filippov , Michael Walle , qemu-arm@nongnu.org, Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In preparation for having some more common semihosting code let's excise the current config magic from vl.c into its own file. We shall later add more conditionals to the build configurations so we can avoid building this if we don't need it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub.c | 2 +- hw/Makefile.objs | 1 + hw/mips/mips_malta.c | 2 +- hw/semihosting/Makefile.objs | 1 + hw/semihosting/config.c | 160 ++++++++++++++++++++ include/{exec =3D> hw/semihosting}/semihost.h | 10 +- include/sysemu/sysemu.h | 1 + target/arm/arm-semi.c | 2 +- target/arm/helper.c | 2 +- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 2 +- target/lm32/helper.c | 2 +- target/m68k/op_helper.c | 2 +- target/mips/mips-semi.c | 2 +- target/mips/translate.c | 2 +- target/nios2/helper.c | 2 +- target/xtensa/translate.c | 2 +- target/xtensa/xtensa-semi.c | 2 +- vl.c | 126 +-------------- 19 files changed, 186 insertions(+), 139 deletions(-) create mode 100644 hw/semihosting/Makefile.objs create mode 100644 hw/semihosting/config.c rename include/{exec =3D> hw/semihosting}/semihost.h (85%) diff --git a/gdbstub.c b/gdbstub.c index d54abd17cc2..793218bb43a 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -37,7 +37,7 @@ #include "qemu/sockets.h" #include "sysemu/hw_accel.h" #include "sysemu/kvm.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "exec/exec-all.h" =20 #ifdef CONFIG_USER_ONLY diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 82aa7fab8e4..d770926ba96 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -36,6 +36,7 @@ devices-dirs-$(CONFIG_SOFTMMU) +=3D watchdog/ devices-dirs-$(CONFIG_SOFTMMU) +=3D xen/ devices-dirs-$(CONFIG_MEM_DEVICE) +=3D mem/ devices-dirs-$(CONFIG_SOFTMMU) +=3D smbios/ +devices-dirs-y +=3D semihosting/ devices-dirs-y +=3D core/ common-obj-y +=3D $(devices-dirs-y) obj-y +=3D $(devices-dirs-y) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 439665ab45e..3b009fda25f 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -55,7 +55,7 @@ #include "qemu/error-report.h" #include "hw/empty_slot.h" #include "sysemu/kvm.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "hw/mips/cps.h" =20 #define ENVP_ADDR 0x80002000l diff --git a/hw/semihosting/Makefile.objs b/hw/semihosting/Makefile.objs new file mode 100644 index 00000000000..546954f4ff4 --- /dev/null +++ b/hw/semihosting/Makefile.objs @@ -0,0 +1 @@ +common-obj-$(CONFIG_SOFTMMU) +=3D config.o diff --git a/hw/semihosting/config.c b/hw/semihosting/config.c new file mode 100644 index 00000000000..f1d3fe1e4c6 --- /dev/null +++ b/hw/semihosting/config.c @@ -0,0 +1,160 @@ +/* + * Semihosting configuration + * + * Copyright (c) 2015 Imagination Technologies + * Copyright (c) 2019 Linaro Ltd + * + * This controls the configuration of semihosting for all guest + * targets that support it. Architecture specific handling is handled + * in target/HW/HW-semi.c + * + * Semihosting is sightly strange in that it is also supported by some + * linux-user targets. However in that use case no configuration of + * the outputs and command lines is supported. + * + * The config module is common to all softmmu targets however as vl.c + * needs to link against the helpers. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/option.h" +#include "qemu/config-file.h" +#include "qemu/error-report.h" +#include "hw/semihosting/semihost.h" + +QemuOptsList qemu_semihosting_config_opts =3D { + .name =3D "semihosting-config", + .implied_opt_name =3D "enable", + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head), + .desc =3D { + { + .name =3D "enable", + .type =3D QEMU_OPT_BOOL, + }, { + .name =3D "target", + .type =3D QEMU_OPT_STRING, + }, { + .name =3D "arg", + .type =3D QEMU_OPT_STRING, + }, + { /* end of list */ } + }, +}; + +typedef struct SemihostingConfig { + bool enabled; + SemihostingTarget target; + const char **argv; + int argc; + const char *cmdline; /* concatenated argv */ +} SemihostingConfig; + +static SemihostingConfig semihosting; + +bool semihosting_enabled(void) +{ + return semihosting.enabled; +} + +SemihostingTarget semihosting_get_target(void) +{ + return semihosting.target; +} + +const char *semihosting_get_arg(int i) +{ + if (i >=3D semihosting.argc) { + return NULL; + } + return semihosting.argv[i]; +} + +int semihosting_get_argc(void) +{ + return semihosting.argc; +} + +const char *semihosting_get_cmdline(void) +{ + if (semihosting.cmdline =3D=3D NULL && semihosting.argc > 0) { + semihosting.cmdline =3D g_strjoinv(" ", (gchar **)semihosting.argv= ); + } + return semihosting.cmdline; +} + +static int add_semihosting_arg(void *opaque, + const char *name, const char *val, + Error **errp) +{ + SemihostingConfig *s =3D opaque; + if (strcmp(name, "arg") =3D=3D 0) { + s->argc++; + /* one extra element as g_strjoinv() expects NULL-terminated array= */ + s->argv =3D g_realloc(s->argv, (s->argc + 1) * sizeof(void *)); + s->argv[s->argc - 1] =3D val; + s->argv[s->argc] =3D NULL; + } + return 0; +} + +/* Use strings passed via -kernel/-append to initialize semihosting.argv[]= */ +void semihosting_arg_fallback(const char *file, const char *cmd) +{ + char *cmd_token; + + /* argv[0] */ + add_semihosting_arg(&semihosting, "arg", file, NULL); + + /* split -append and initialize argv[1..n] */ + cmd_token =3D strtok(g_strdup(cmd), " "); + while (cmd_token) { + add_semihosting_arg(&semihosting, "arg", cmd_token, NULL); + cmd_token =3D strtok(NULL, " "); + } +} + +void qemu_semihosting_enable(void) +{ + semihosting.enabled =3D true; + semihosting.target =3D SEMIHOSTING_TARGET_AUTO; +} + +int qemu_semihosting_config_options(const char *optarg) +{ + QemuOptsList *opt_list =3D qemu_find_opts("semihosting-config"); + QemuOpts *opts =3D qemu_opts_parse_noisily(opt_list, optarg, false); + + semihosting.enabled =3D true; + + if (opts !=3D NULL) { + semihosting.enabled =3D qemu_opt_get_bool(opts, "enable", + true); + const char *target =3D qemu_opt_get(opts, "target"); + if (target !=3D NULL) { + if (strcmp("native", target) =3D=3D 0) { + semihosting.target =3D SEMIHOSTING_TARGET_NATIVE; + } else if (strcmp("gdb", target) =3D=3D 0) { + semihosting.target =3D SEMIHOSTING_TARGET_GDB; + } else if (strcmp("auto", target) =3D=3D 0) { + semihosting.target =3D SEMIHOSTING_TARGET_AUTO; + } else { + error_report("unsupported semihosting-config %s", + optarg); + return 1; + } + } else { + semihosting.target =3D SEMIHOSTING_TARGET_AUTO; + } + /* Set semihosting argument count and vector */ + qemu_opt_foreach(opts, add_semihosting_arg, + &semihosting, NULL); + } else { + error_report("unsupported semihosting-config %s", optarg); + return 1; + } + + return 0; +} + diff --git a/include/exec/semihost.h b/include/hw/semihosting/semihost.h similarity index 85% rename from include/exec/semihost.h rename to include/hw/semihosting/semihost.h index 5980939c7b8..07ea40a322f 100644 --- a/include/exec/semihost.h +++ b/include/hw/semihosting/semihost.h @@ -51,12 +51,16 @@ static inline const char *semihosting_get_cmdline(void) { return NULL; } -#else +#else /* !CONFIG_USER_ONLY */ bool semihosting_enabled(void); SemihostingTarget semihosting_get_target(void); const char *semihosting_get_arg(int i); int semihosting_get_argc(void); const char *semihosting_get_cmdline(void); -#endif +void semihosting_arg_fallback(const char *file, const char *cmd); +/* for vl.c hooks */ +void qemu_semihosting_enable(void); +int qemu_semihosting_config_options(const char *opt); +#endif /* CONFIG_USER_ONLY */ =20 -#endif +#endif /* SEMIHOST_H */ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 5f133cae837..61579ae71ef 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -193,5 +193,6 @@ extern QemuOptsList qemu_nic_opts; extern QemuOptsList qemu_net_opts; extern QemuOptsList qemu_global_opts; extern QemuOptsList qemu_mon_opts; +extern QemuOptsList qemu_semihosting_config_opts; =20 #endif diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 8b5fd7bc6e3..3273306c8ea 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -21,7 +21,7 @@ #include "qemu/osdep.h" =20 #include "cpu.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 1e6eb0d0f36..bc20cb3b9e2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -16,7 +16,7 @@ #include "exec/cpu_ldst.h" #include "arm_ldst.h" #include /* For crc32 */ -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "sysemu/cpus.h" #include "sysemu/kvm.h" #include "fpu/softfloat.h" diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b7c5a928b4a..8844a75e53d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -29,7 +29,7 @@ #include "qemu/host-utils.h" #include "qemu/qemu-print.h" =20 -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "exec/gen-icount.h" =20 #include "exec/helper-proto.h" diff --git a/target/arm/translate.c b/target/arm/translate.c index dd053c80d62..f2a65c0b5b0 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -30,7 +30,7 @@ #include "qemu/bitops.h" #include "qemu/qemu-print.h" #include "arm_ldst.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" =20 #include "exec/helper-proto.h" #include "exec/helper-gen.h" diff --git a/target/lm32/helper.c b/target/lm32/helper.c index a039a993ffe..e83cdf43182 100644 --- a/target/lm32/helper.c +++ b/target/lm32/helper.c @@ -22,7 +22,7 @@ #include "exec/exec-all.h" #include "qemu/host-utils.h" #include "sysemu/sysemu.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "exec/log.h" =20 int lm32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int r= w, diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 76f439985a0..ee578f8d60d 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -21,7 +21,7 @@ #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" =20 #if defined(CONFIG_USER_ONLY) =20 diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c index a7aefbaefc8..eac8374fb34 100644 --- a/target/mips/mips-semi.c +++ b/target/mips/mips-semi.c @@ -22,7 +22,7 @@ #include "qemu/log.h" #include "exec/helper-proto.h" #include "exec/softmmu-semi.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" =20 typedef enum UHIOp { UHI_exit =3D 1, diff --git a/target/mips/translate.c b/target/mips/translate.c index f96c0d01ef1..3cd5b11b16b 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -32,7 +32,7 @@ =20 #include "exec/helper-proto.h" #include "exec/helper-gen.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" =20 #include "target/mips/trace.h" #include "trace-tcg.h" diff --git a/target/nios2/helper.c b/target/nios2/helper.c index e01fc1ff3e7..a3bd93e483d 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -26,7 +26,7 @@ #include "exec/cpu_ldst.h" #include "exec/log.h" #include "exec/helper-proto.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" =20 #if defined(CONFIG_USER_ONLY) =20 diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index b063fa85f26..6bdc244b583 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -38,7 +38,7 @@ #include "qemu/qemu-print.h" #include "sysemu/sysemu.h" #include "exec/cpu_ldst.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "exec/translator.h" =20 #include "exec/helper-proto.h" diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index 5f5ce4f344c..38efa3485af 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -29,7 +29,7 @@ #include "cpu.h" #include "chardev/char-fe.h" #include "exec/helper-proto.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "qapi/error.h" #include "qemu/log.h" #include "sysemu/sysemu.h" diff --git a/vl.c b/vl.c index b6709514c1b..fba48b565c9 100644 --- a/vl.c +++ b/vl.c @@ -116,7 +116,7 @@ int main(int argc, char **argv) #include "qapi/opts-visitor.h" #include "qapi/clone-visitor.h" #include "qom/object_interfaces.h" -#include "exec/semihost.h" +#include "hw/semihosting/semihost.h" #include "crypto/init.h" #include "sysemu/replay.h" #include "qapi/qapi-events-run-state.h" @@ -500,25 +500,6 @@ static QemuOptsList qemu_icount_opts =3D { }, }; =20 -static QemuOptsList qemu_semihosting_config_opts =3D { - .name =3D "semihosting-config", - .implied_opt_name =3D "enable", - .head =3D QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head), - .desc =3D { - { - .name =3D "enable", - .type =3D QEMU_OPT_BOOL, - }, { - .name =3D "target", - .type =3D QEMU_OPT_STRING, - }, { - .name =3D "arg", - .type =3D QEMU_OPT_STRING, - }, - { /* end of list */ } - }, -}; - static QemuOptsList qemu_fw_cfg_opts =3D { .name =3D "fw_cfg", .implied_opt_name =3D "name", @@ -1350,80 +1331,6 @@ static void configure_msg(QemuOpts *opts) enable_timestamp_msg =3D qemu_opt_get_bool(opts, "timestamp", true); } =20 -/***********************************************************/ -/* Semihosting */ - -typedef struct SemihostingConfig { - bool enabled; - SemihostingTarget target; - const char **argv; - int argc; - const char *cmdline; /* concatenated argv */ -} SemihostingConfig; - -static SemihostingConfig semihosting; - -bool semihosting_enabled(void) -{ - return semihosting.enabled; -} - -SemihostingTarget semihosting_get_target(void) -{ - return semihosting.target; -} - -const char *semihosting_get_arg(int i) -{ - if (i >=3D semihosting.argc) { - return NULL; - } - return semihosting.argv[i]; -} - -int semihosting_get_argc(void) -{ - return semihosting.argc; -} - -const char *semihosting_get_cmdline(void) -{ - if (semihosting.cmdline =3D=3D NULL && semihosting.argc > 0) { - semihosting.cmdline =3D g_strjoinv(" ", (gchar **)semihosting.argv= ); - } - return semihosting.cmdline; -} - -static int add_semihosting_arg(void *opaque, - const char *name, const char *val, - Error **errp) -{ - SemihostingConfig *s =3D opaque; - if (strcmp(name, "arg") =3D=3D 0) { - s->argc++; - /* one extra element as g_strjoinv() expects NULL-terminated array= */ - s->argv =3D g_realloc(s->argv, (s->argc + 1) * sizeof(void *)); - s->argv[s->argc - 1] =3D val; - s->argv[s->argc] =3D NULL; - } - return 0; -} - -/* Use strings passed via -kernel/-append to initialize semihosting.argv[]= */ -static inline void semihosting_arg_fallback(const char *file, const char *= cmd) -{ - char *cmd_token; - - /* argv[0] */ - add_semihosting_arg(&semihosting, "arg", file, NULL); - - /* split -append and initialize argv[1..n] */ - cmd_token =3D strtok(g_strdup(cmd), " "); - while (cmd_token) { - add_semihosting_arg(&semihosting, "arg", cmd_token, NULL); - cmd_token =3D strtok(NULL, " "); - } -} =20 /* Now we still need this for compatibility with XEN. */ bool has_igd_gfx_passthru; @@ -3733,37 +3640,10 @@ int main(int argc, char **argv, char **envp) nb_option_roms++; break; case QEMU_OPTION_semihosting: - semihosting.enabled =3D true; - semihosting.target =3D SEMIHOSTING_TARGET_AUTO; + qemu_semihosting_enable(); break; case QEMU_OPTION_semihosting_config: - semihosting.enabled =3D true; - opts =3D qemu_opts_parse_noisily(qemu_find_opts("semihosti= ng-config"), - optarg, false); - if (opts !=3D NULL) { - semihosting.enabled =3D qemu_opt_get_bool(opts, "enabl= e", - true); - const char *target =3D qemu_opt_get(opts, "target"); - if (target !=3D NULL) { - if (strcmp("native", target) =3D=3D 0) { - semihosting.target =3D SEMIHOSTING_TARGET_NATI= VE; - } else if (strcmp("gdb", target) =3D=3D 0) { - semihosting.target =3D SEMIHOSTING_TARGET_GDB; - } else if (strcmp("auto", target) =3D=3D 0) { - semihosting.target =3D SEMIHOSTING_TARGET_AUTO; - } else { - error_report("unsupported semihosting-config %= s", - optarg); - exit(1); - } - } else { - semihosting.target =3D SEMIHOSTING_TARGET_AUTO; - } - /* Set semihosting argument count and vector */ - qemu_opt_foreach(opts, add_semihosting_arg, - &semihosting, NULL); - } else { - error_report("unsupported semihosting-config %s", opta= rg); + if (qemu_semihosting_config_options(optarg) !=3D 0) { exit(1); } break; --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849318; cv=none; d=zoho.com; s=zohoarc; b=kBSpzCd9qZNl0CKIp1ZElM9zyHuofRp55q/dk4h0WjozE9P8ySLAxf13/0Rl8/AJf7vCV+7AB3QClZM9uy8yyrTRnvbVPaKNRfiRL9hmV0L2tWPgPzPKKArSze2PIGtiBsbUmmD4lT6JbslPtcI1xpGkxwnraYdk/d2cmIM8F08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849318; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=yMHrC51RIDRA86f0abxaIpsijFG/dJpE/elLKV5MXbE=; b=TVPOvmWaOUjlfNUvePlHJK7q2zm75SiUHJr49JH4njlMRghlfUdOvhTD3O4m2w3+U1CWZZp271+N5fsEv/7HIGZWbp+ZM/8eJokvNUEacI61pMGx+NIPMe9MKFBnb1oLTGca6BiCWxJwdMI6MzX7LVj8pHCxKLvl+erDcJPCJbw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557849318028690.2112066779274; Tue, 14 May 2019 08:55:18 -0700 (PDT) Received: from localhost ([127.0.0.1]:50166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZll-00064g-R6 for importer@patchew.org; Tue, 14 May 2019 11:55:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjm-0004iS-HX for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjl-000661-06 for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:06 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54200) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjk-00062W-PY for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:04 -0400 Received: by mail-wm1-x342.google.com with SMTP id 198so3424081wme.3 for ; Tue, 14 May 2019 08:53:04 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g127sm3836628wme.21.2019.05.14.08.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:02 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 310991FF8F; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yMHrC51RIDRA86f0abxaIpsijFG/dJpE/elLKV5MXbE=; b=baR8og91bZp3WMsY96nXn1DD6Wggemt1aexnoT5iD6wn2xAXwUs30ljdDZvedjtktI JhVT6uNz6siLPiJoS/h4qMX3/ABIU3Ph4H8peXt64U3EzpeR5EfDk2lGUWHRwiijbS10 lK+PDrc/neQJ/OIPgL9liuzj/lEFAKYsUz0AzN217aqOdf3KTiaIqY2rkhwp6i6uN2SF A4AU0ZjfKJ2eZAOGBBZXtE2/7lQuLreyKwzxN7CLiyOA9sJEqcGVnlhCXFEwHs8fKGMm uy4Ivh3R+arVe6WSHywbZlJxqQuYmXW3cyWHsopbK+IYjWRhFBhDwTRo/HF3e7AsR39v UqGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yMHrC51RIDRA86f0abxaIpsijFG/dJpE/elLKV5MXbE=; b=SX/d2Yq1cOg2J73EE225LLNXaBqtQwYyjXslc915nJqXXQIqDprxxk0A1BMwpWUUBc OzqfqbN/odvKoMX9hFmnQ5vZIEb3SB0zbki0axsa9KszDcFz2LKY/25uVrviBGNdZJMG 9/W3SGowg2nX+wRlZQA7wbidUcJ4sNlmxPTNMK6e04N1Gy/6DyKa6ih7+NLDm/C2NCWd lfCFaJ+es62uliJkq1BOazL4Fk29JWT+ooU+Gtqo4xkayTZk+W1evpgTMkhV7WrZoVkC wKniaGPVSM6ywqGwoJtS9Add6J8ypLcN6NT/4bv16fJvbQmSpwWZsh+h3vsPpZg+C9Nj ynaQ== X-Gm-Message-State: APjAAAW/o+rnQEc290R1+be8pxbotIGUikI4CaUMF1M1Ywiu9qCV1nxc a1dijQehpSehl5PYyd92nb+dlw== X-Google-Smtp-Source: APXvYqzwT6voMFzyScJznRjRI7PWmjO0A017WNRbnji5Yhethax3UdMXuj25YfDUBc7czcheSy/g3A== X-Received: by 2002:a1c:dcc2:: with SMTP id t185mr21284424wmg.143.1557849183522; Tue, 14 May 2019 08:53:03 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:52 +0100 Message-Id: <20190514155301.16123-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [RFC PATCH 02/11] semihosting: introduce CONFIG_SEMIHOSTING X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Aleksandar Rikalo , Chris Wulff , Max Filippov , qemu-arm@nongnu.org, Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There isn't much point building semihosting for platforms that don't support it. Introduce a new symbol and enable it only for the softmmu targets that need it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- default-configs/arm-softmmu.mak | 1 + default-configs/lm32-softmmu.mak | 2 + default-configs/m68k-softmmu.mak | 2 + default-configs/mips-softmmu-common.mak | 1 + default-configs/nios2-softmmu.mak | 2 + default-configs/xtensa-softmmu.mak | 2 + hw/Kconfig | 1 + hw/semihosting/Kconfig | 3 ++ hw/semihosting/Makefile.objs | 2 +- stubs/Makefile.objs | 1 + stubs/semihost.c | 66 +++++++++++++++++++++++++ 11 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 hw/semihosting/Kconfig create mode 100644 stubs/semihost.c diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.= mak index f23ecfd5c58..1f2e0e7fdeb 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -39,3 +39,4 @@ CONFIG_MICROBIT=3Dy CONFIG_FSL_IMX25=3Dy CONFIG_FSL_IMX7=3Dy CONFIG_FSL_IMX6UL=3Dy +CONFIG_SEMIHOSTING=3Dy diff --git a/default-configs/lm32-softmmu.mak b/default-configs/lm32-softmm= u.mak index 6d259665d60..115b3e34c98 100644 --- a/default-configs/lm32-softmmu.mak +++ b/default-configs/lm32-softmmu.mak @@ -4,6 +4,8 @@ # #CONFIG_MILKYMIST_TMU2=3Dn # disabling it actually causes compile-t= ime failures =20 +CONFIG_SEMIHOSTING=3Dy + # Boards: # CONFIG_LM32=3Dy diff --git a/default-configs/m68k-softmmu.mak b/default-configs/m68k-softmm= u.mak index e17495e2a0b..4049a8f2ba9 100644 --- a/default-configs/m68k-softmmu.mak +++ b/default-configs/m68k-softmmu.mak @@ -1,5 +1,7 @@ # Default configuration for m68k-softmmu =20 +CONFIG_SEMIHOSTING=3Dy + # Boards: # CONFIG_AN5206=3Dy diff --git a/default-configs/mips-softmmu-common.mak b/default-configs/mips= -softmmu-common.mak index 8e54a74b7a5..e10ac4b20c0 100644 --- a/default-configs/mips-softmmu-common.mak +++ b/default-configs/mips-softmmu-common.mak @@ -35,6 +35,7 @@ CONFIG_MIPS_CPS=3Dy CONFIG_MIPS_ITU=3Dy CONFIG_R4K=3Dy CONFIG_MALTA=3Dy +CONFIG_SEMIHOSTING=3Dy CONFIG_PCNET_PCI=3Dy CONFIG_MIPSSIM=3Dy CONFIG_ACPI_SMBUS=3Dy diff --git a/default-configs/nios2-softmmu.mak b/default-configs/nios2-soft= mmu.mak index e130d024e62..1bc4082ea99 100644 --- a/default-configs/nios2-softmmu.mak +++ b/default-configs/nios2-softmmu.mak @@ -1,5 +1,7 @@ # Default configuration for nios2-softmmu =20 +CONFIG_SEMIHOSTING=3Dy + # Boards: # CONFIG_NIOS2_10M50=3Dy diff --git a/default-configs/xtensa-softmmu.mak b/default-configs/xtensa-so= ftmmu.mak index 7e4d1cc0979..3aa20a47a7f 100644 --- a/default-configs/xtensa-softmmu.mak +++ b/default-configs/xtensa-softmmu.mak @@ -1,5 +1,7 @@ # Default configuration for Xtensa =20 +CONFIG_SEMIHOSTING=3Dy + # Boards: # CONFIG_XTENSA_SIM=3Dy diff --git a/hw/Kconfig b/hw/Kconfig index 88b9f150070..195f541e50c 100644 --- a/hw/Kconfig +++ b/hw/Kconfig @@ -29,6 +29,7 @@ source pci/Kconfig source rdma/Kconfig source scsi/Kconfig source sd/Kconfig +source semihosting/Kconfig source smbios/Kconfig source ssi/Kconfig source timer/Kconfig diff --git a/hw/semihosting/Kconfig b/hw/semihosting/Kconfig new file mode 100644 index 00000000000..efe0a30734c --- /dev/null +++ b/hw/semihosting/Kconfig @@ -0,0 +1,3 @@ + +config SEMIHOSTING + bool diff --git a/hw/semihosting/Makefile.objs b/hw/semihosting/Makefile.objs index 546954f4ff4..09c19bf19ed 100644 --- a/hw/semihosting/Makefile.objs +++ b/hw/semihosting/Makefile.objs @@ -1 +1 @@ -common-obj-$(CONFIG_SOFTMMU) +=3D config.o +obj-$(CONFIG_SEMIHOSTING) +=3D config.o diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 269dfa58326..e0d4f11b348 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -39,3 +39,4 @@ stub-obj-y +=3D xen-hvm.o stub-obj-y +=3D pci-host-piix.o stub-obj-y +=3D ram-block.o stub-obj-y +=3D ramfb.o +stub-obj-$(CONFIG_SOFTMMU) +=3D semihost.o diff --git a/stubs/semihost.c b/stubs/semihost.c new file mode 100644 index 00000000000..1a4e88e5326 --- /dev/null +++ b/stubs/semihost.c @@ -0,0 +1,66 @@ +/* + * Semihosting Stubs for SoftMMU + * + * Copyright (c) 2019 Linaro Ltd + * + * Stubs for SoftMMU targets that don't actually do semihosting. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/option.h" +#include "qemu/error-report.h" +#include "hw/semihosting/semihost.h" + +/* Empty config */ +QemuOptsList qemu_semihosting_config_opts =3D { + .name =3D "", + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head), + .desc =3D { + { /* end of list */ } + }, +}; + +/* Queries to config status default to off */ +bool semihosting_enabled(void) +{ + return false; +} + +SemihostingTarget semihosting_get_target(void) +{ + return SEMIHOSTING_TARGET_AUTO; +} + +/* + * All the rest are empty subs. We could g_assert_not_reached() but + * that adds extra weight to the final binary. Waste not want not. + */ +void qemu_semihosting_enable(void) +{ +} + +int qemu_semihosting_config_options(const char *optarg) +{ + return 1; +} + +const char *semihosting_get_arg(int i) +{ + return NULL; +} + +int semihosting_get_argc(void) +{ + return 0; +} + +const char *semihosting_get_cmdline(void) +{ + return NULL; +} + +void semihosting_arg_fallback(const char *file, const char *cmd) +{ +} --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849484; cv=none; d=zoho.com; s=zohoarc; b=mhQIzqrwQ0cKtSCyVONejzPGBYMNqDIcRaUIYU18HOUXDrg8RuyRKcGCGeQoqjafsERp/yfjTlo+9g95zbDTUk0hs60zRTwQrsYPNej9TpqWpZbVLwxZoewmNiH4me1CrdDSxtM4Y9gVe0YKKk54u42qcM/3XJnd9xDJ3aGUkJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849484; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=hbC6Uuy+rCphFJXRN5GPHrqZRqXnqfdaGhA8RUCMKxg=; b=YiL2oy3Pxb4Tg5ZwmtAiTPvf1Lj2KJrqqqs//58rIuhtIUTOhed6ZGLfUhfLQDLWew7XM7vuzsKk2jao8EvafLebgk9fp9tojzrI9twH4QPIPqcrMsZi+IPydgo2dnMgDZDb5av326NjfU9Woob6uiAKjbKVh09VHMXok3kNDcY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 15578494844661011.7552129761181; Tue, 14 May 2019 08:58:04 -0700 (PDT) Received: from localhost ([127.0.0.1]:50230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZoY-0000Vs-Qa for importer@patchew.org; Tue, 14 May 2019 11:58:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjn-0004jK-Ek for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjm-0006A2-2q for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:07 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjl-00067A-RC for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:06 -0400 Received: by mail-wr1-x441.google.com with SMTP id f8so1981219wrt.1 for ; Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 22sm3423359wmg.44.2019.05.14.08.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:02 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4A54F1FF90; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hbC6Uuy+rCphFJXRN5GPHrqZRqXnqfdaGhA8RUCMKxg=; b=WUeO4dKj2jR9cpYA0NSwQvGZT4j8w99LEx03+eu5YZ6ZOELalepy/YcejiRAw5bCnJ ZIeHZat79geply6FbqT+jLBkVBy8a9F/FjCSsU7A773wGVsbAxh4MQIPX1KzoBGWDnu3 ApMtwEigdorhtA7a6LFjhX4dQRsEDHpIkxprVZXMoPYeHIsARWsLW+CHjl0xgCxbGLe+ HpUFrwSJfr63iMJchi9Pns9OMy6hvwy5JX/ftz8xncgpPEeswo6c7WHUqJZ94h4UhKVe jGWC73sJQpH9MshMqsEGUTpG6d75wmAE9dvgk5y+TY0gGCnZR3wlI1PL6OFkqNDplKmC vpmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hbC6Uuy+rCphFJXRN5GPHrqZRqXnqfdaGhA8RUCMKxg=; b=H7tIXpeCwpLODMGBzDCddPRbVH709Of3oICU2uNc2+63XKsj92wC35A0RdGEzhUljd HIFSrZD3n6wJQlnSLxROj0CnAGLM7fFkLw3d2BrZ8vgrDKkFZKJZlMJzq8YQ9n0mavl9 N9SvBbe/56+mJf1YmPxAKfcHrjr4M9qI5iZVHQsmKyHaj5AwMFvlupALnXX+zmtoU6qz DJcAkkcwo+9WwprsCPO8Rd5sZ5+1I1ucmW4xDpRIC6kdvUT76NuY6qD5ASWlvW2AnO8D IIbUM6/rxYWrKD2XfxR8p1D7LjmGWgFwQnUefjhIIlrTIICLeDzqGT+kT1nh5arDcrzn 9F1A== X-Gm-Message-State: APjAAAXwlgOLcCN7V+1ND6OzB/CX2EjgwNzV07wBvdL6r4NliE1rr5nI AIYmJZM2Wj8JtnTnjROO+W+44g== X-Google-Smtp-Source: APXvYqxA6xDQNY4iDqohBNFgZXV2bejql6IKk2l+OLU0IZ5Qa/J8CQfH/OCNldhRJIjnQL7JzxHxnQ== X-Received: by 2002:a5d:52c6:: with SMTP id r6mr22996703wrv.131.1557849184812; Tue, 14 May 2019 08:53:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:53 +0100 Message-Id: <20190514155301.16123-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [RFC PATCH 03/11] semihosting: implement a semihosting console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This provides two functions for handling console output that handle the common backend behaviour for semihosting. Signed-off-by: Alex Benn=C3=A9e --- gdbstub.c | 5 +++ hw/semihosting/Makefile.objs | 1 + hw/semihosting/console.c | 70 ++++++++++++++++++++++++++++++++ include/exec/gdbstub.h | 11 +++++ include/hw/semihosting/console.h | 38 +++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 hw/semihosting/console.c create mode 100644 include/hw/semihosting/console.h diff --git a/gdbstub.c b/gdbstub.c index 793218bb43a..b4334014373 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1987,6 +1987,11 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, cons= t char *fmt, ...) va_end(va); } =20 +void gdb_do_console_out(target_ulong s, int len) +{ + gdb_do_syscall(NULL, "write,2,%x,1", s, len); +} + static void gdb_read_byte(GDBState *s, int ch) { uint8_t reply; diff --git a/hw/semihosting/Makefile.objs b/hw/semihosting/Makefile.objs index 09c19bf19ed..4ad47c05c06 100644 --- a/hw/semihosting/Makefile.objs +++ b/hw/semihosting/Makefile.objs @@ -1 +1,2 @@ obj-$(CONFIG_SEMIHOSTING) +=3D config.o +obj-$(CONFIG_SEMIHOSTING) +=3D console.o diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c new file mode 100644 index 00000000000..ad6f67ecc71 --- /dev/null +++ b/hw/semihosting/console.c @@ -0,0 +1,70 @@ +/* + * Semihosting Console Support + * + * Copyright (c) 2015 Imagination Technologies + * Copyright (c) 2019 Linaro Ltd + * + * This provides support for outputting to a semihosting console. + * + * While most semihosting implementations support reading and writing + * to arbitrary file descriptors we treat the console as something + * specifically for debugging interaction. This means messages can be + * re-directed to gdb (if currently being used to debug) or even + * re-directed elsewhere. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "hw/semihosting/console.h" +#include "exec/gdbstub.h" +#include "qemu/log.h" + +int qemu_semihosting_log_out(const char *s, int len) +{ + return write(STDERR_FILENO, s, len); +} + +/* + * A re-implementation of lock_user_string that we can use locally + * instead of relying on softmmu-semi. Hopefully we can deprecate that + * in time. We either copy len bytes if specified or until we find a NULL. + */ +static GString *copy_user_string(CPUArchState *env, target_ulong addr, int= len) +{ + CPUState *cpu =3D ENV_GET_CPU(env); + GString *s =3D g_string_sized_new(len ? len : 128); + uint8_t c; + bool done; + + do { + if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) =3D=3D 0) { + s =3D g_string_append_c(s, c); + done =3D len ? s->len =3D=3D len : c =3D=3D 0; + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: passed inaccessible address " TARGET_FMT_lx, + __func__, addr); + done =3D true; + } + } while (!done); + + return s; +} + + +int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int= len) +{ + GString *s =3D copy_user_string(env, addr, len); + int out =3D s->len; + + if (use_gdb_syscalls()) { + gdb_do_console_out(addr, s->len); + } else { + out =3D qemu_semihosting_log_out(s->str, s->len); + } + + g_string_free(s, true); + return out; +} diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 08363969c14..b2963547c48 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -44,6 +44,17 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const ch= ar *fmt, ...); * argument list. */ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list = va); +/** + * gdb_do_console_out: + * @gs: guest address of string to send + * @len: length of string + * + * Sends a string to gdb console. Unlike the system call interface + * there is no callback and we assume the system call always + * succeeds. + */ +void gdb_do_console_out(target_ulong s, int len); + int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); void gdb_exit(CPUArchState *, int); diff --git a/include/hw/semihosting/console.h b/include/hw/semihosting/cons= ole.h new file mode 100644 index 00000000000..30e66ae20aa --- /dev/null +++ b/include/hw/semihosting/console.h @@ -0,0 +1,38 @@ +/* + * Semihosting Console + * + * Copyright (c) 2019 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _SEMIHOST_CONSOLE_H_ +#define _SEMIHOST_CONSOLE_H_ + +/** + * qemu_semihosting_console_out: + * @env: CPUArchState + * @s: host address of guest string + * @len: length of string or 0 (string is null terminated) + * + * Send a guest string to the debug console. This may be the remote + * gdb session if a softmmu guest is currently being debugged. + * + * Returns: number of bytes written. + */ +int qemu_semihosting_console_out(CPUArchState *env, target_ulong s, int le= n); + +/** + * qemu_semihosting_log_out: + * @s: pointer to string + * @len: length of string + * + * Send a string to the debug output. Unlike console_out these strings + * can't be sent to a remote gdb instance as they don't exist in guest + * memory. + * + * Returns: number of bytes written + */ +int qemu_semihosting_log_out(const char *s, int len); + +#endif /* _SEMIHOST_CONSOLE_H_ */ --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849321; cv=none; d=zoho.com; s=zohoarc; b=Kqf5SB7Ab9z/i6OlmV4lnvMWJI/KhDsZsBEbPKqPuHCyLmtxr1x2Fv5IpQRTAh7LGtc8O2X2IeIub3SwgfiBFDqRHh64veL/M/ITnuik3PU+uKRPGJ21EpXgM9aXTfuNz/eA9N15HTIPN0OGQzJ7iUlMelBJdigDcToTjG+cp9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849321; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=0r9ufJMae12rSUNpWxfw8a5ZPlWsKe8VRtl/4yp8eAw=; b=Sr8kO6tfLv+Ff/EfHl7t13Vl/rMW3aiQD4zjec9R/ILMLn4kP10tm/ZyxtLiUSE1K4Ua72okHmY3fEcM08c0ttgDFsvU1x7KKt9rA0VRHBqbEZUhdXqELtjrQWpvqDMcgKL707qaIY7Pe2a3RpcqjX+vJ+ERdSkg4Ypc5CKs2AU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1557849321700671.3102152386789; Tue, 14 May 2019 08:55:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:50168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZlp-00067k-CM for importer@patchew.org; Tue, 14 May 2019 11:55:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjo-0004kw-VU for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjn-0006CA-4P for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:08 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:35325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjm-0006Ai-RY for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:07 -0400 Received: by mail-wr1-x443.google.com with SMTP id w12so19833306wrp.2 for ; Tue, 14 May 2019 08:53:06 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d6sm16564890wrp.9.2019.05.14.08.53.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:02 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 64DB11FF91; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0r9ufJMae12rSUNpWxfw8a5ZPlWsKe8VRtl/4yp8eAw=; b=TOs+csmWpgVedvpRRe9hbcGHBcQNBNd1rj9kFqMBbMtUy3gBgYWCdSrVmCfxFVnGp9 Mc7h1UfTJLkjLmGxPBEJfLZa7ZaaPspohHLJP2DCV/KwVn6DZO9E0KjXAqGNipEVkCXr f/9+BjRHG5C5ihMQGJFCfT2WJgZmQmIafWeIGOeJpHIt5R+cwL5p7KsvRUy8cjAjb/6g xqjjIAlaC5SkmO/lX5yRgxamvOUk/jb4ip0RR2ynyYDTyZmfaBmz+o3dotIJkgnFyniB LzZM8UK8kvV3uqGLf5Jvm45UaiYLfLBSIeYR9FDpKU/UbhC7RXDRq5yn8GntTROcOjrr 96TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0r9ufJMae12rSUNpWxfw8a5ZPlWsKe8VRtl/4yp8eAw=; b=t6kG4fZSI5lwacj4mRLtfhsgZ/7hO/q4/Vu2X2IKc4hzbSTzyFfIprEaJwEuirbPRZ +PmU30yKnTOBBEmZ0kbpGG1FjliyMcjsbySuRa4HPhCNYr6mkgIhzURU8K/EH2K+r/iW YuOtO3cXLkEu/5n+HNNGZkbENIcDMnJf9aH7Ibkv8e3P/z2VbZWUCvXLkjCWJ6keS0Yo 90BKmP30lhWA9HPEb8/S0H2WeTq0YPKhfdj4FNUh/Yf6eHGEVGTlqH+mcNV8WqCWBv6w HnY7BP5TTz8e6WhX8t1O7yojhJepE6Aig8v/ySe5E3wbqxWn6dyltbNUvewyrP9GWaPV Hwmw== X-Gm-Message-State: APjAAAXpbo6DHvmEQM6mMcMdAyJE5GNBxZ/5hcloN/EPUXoQu4hyos+Y 1X6K/0DlOFq0weNJ8qB1jHjD+Q== X-Google-Smtp-Source: APXvYqwWjaavofNnBQsErbLmfCKLTcxH1FXJIayOnngIux+/xirkfsKAaKZLYFN0MN+M+z/dCmg9xA== X-Received: by 2002:a5d:6610:: with SMTP id n16mr14087056wru.250.1557849185778; Tue, 14 May 2019 08:53:05 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:54 +0100 Message-Id: <20190514155301.16123-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [RFC PATCH 04/11] semihosting: enable chardev backed output for console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It will be useful for a number of use-cases to be able to re-direct output to a file like we do with serial output. This does the wiring to allow us to treat then semihosting console like just another character output device. Signed-off-by: Alex Benn=C3=A9e --- hw/semihosting/config.c | 26 ++++++++++++++++++++++++++ hw/semihosting/console.c | 9 ++++++++- include/hw/semihosting/semihost.h | 7 +++++++ qemu-options.hx | 6 ++++-- stubs/semihost.c | 4 ++++ vl.c | 2 ++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/hw/semihosting/config.c b/hw/semihosting/config.c index f1d3fe1e4c6..2a8e7e1045a 100644 --- a/hw/semihosting/config.c +++ b/hw/semihosting/config.c @@ -23,6 +23,7 @@ #include "qemu/config-file.h" #include "qemu/error-report.h" #include "hw/semihosting/semihost.h" +#include "chardev/char.h" =20 QemuOptsList qemu_semihosting_config_opts =3D { .name =3D "semihosting-config", @@ -35,6 +36,9 @@ QemuOptsList qemu_semihosting_config_opts =3D { }, { .name =3D "target", .type =3D QEMU_OPT_STRING, + }, { + .name =3D "chardev", + .type =3D QEMU_OPT_STRING, }, { .name =3D "arg", .type =3D QEMU_OPT_STRING, @@ -46,12 +50,14 @@ QemuOptsList qemu_semihosting_config_opts =3D { typedef struct SemihostingConfig { bool enabled; SemihostingTarget target; + Chardev *chardev; const char **argv; int argc; const char *cmdline; /* concatenated argv */ } SemihostingConfig; =20 static SemihostingConfig semihosting; +static const char *semihost_chardev; =20 bool semihosting_enabled(void) { @@ -115,6 +121,11 @@ void semihosting_arg_fallback(const char *file, const = char *cmd) } } =20 +Chardev *semihosting_get_chardev(void) +{ + return semihosting.chardev; +} + void qemu_semihosting_enable(void) { semihosting.enabled =3D true; @@ -132,6 +143,8 @@ int qemu_semihosting_config_options(const char *optarg) semihosting.enabled =3D qemu_opt_get_bool(opts, "enable", true); const char *target =3D qemu_opt_get(opts, "target"); + /* setup of chardev is deferred until they are initialised */ + semihost_chardev =3D qemu_opt_get(opts, "chardev"); if (target !=3D NULL) { if (strcmp("native", target) =3D=3D 0) { semihosting.target =3D SEMIHOSTING_TARGET_NATIVE; @@ -158,3 +171,16 @@ int qemu_semihosting_config_options(const char *optarg) return 0; } =20 +void qemu_semihosting_connect_chardevs(void) +{ + /* We had to defer this until chardevs were created */ + if (semihost_chardev) { + Chardev *chr =3D qemu_chr_find(semihost_chardev); + if (chr =3D=3D NULL) { + error_report("semihosting chardev '%s' not found", + semihost_chardev); + exit(1); + } + semihosting.chardev =3D chr; + } +} diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index ad6f67ecc71..2fa440eb32a 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -17,13 +17,20 @@ =20 #include "qemu/osdep.h" #include "cpu.h" +#include "hw/semihosting/semihost.h" #include "hw/semihosting/console.h" #include "exec/gdbstub.h" #include "qemu/log.h" +#include "chardev/char.h" =20 int qemu_semihosting_log_out(const char *s, int len) { - return write(STDERR_FILENO, s, len); + Chardev *chardev =3D semihosting_get_chardev(); + if (chardev) { + return qemu_chr_write_all(chardev, (uint8_t *) s, len); + } else { + return write(STDERR_FILENO, s, len); + } } =20 /* diff --git a/include/hw/semihosting/semihost.h b/include/hw/semihosting/sem= ihost.h index 07ea40a322f..60fc42d851e 100644 --- a/include/hw/semihosting/semihost.h +++ b/include/hw/semihosting/semihost.h @@ -51,6 +51,11 @@ static inline const char *semihosting_get_cmdline(void) { return NULL; } + +static inline Chardev *semihosting_get_chardev(void) +{ + return NULL; +} #else /* !CONFIG_USER_ONLY */ bool semihosting_enabled(void); SemihostingTarget semihosting_get_target(void); @@ -58,9 +63,11 @@ const char *semihosting_get_arg(int i); int semihosting_get_argc(void); const char *semihosting_get_cmdline(void); void semihosting_arg_fallback(const char *file, const char *cmd); +Chardev *semihosting_get_chardev(void); /* for vl.c hooks */ void qemu_semihosting_enable(void); int qemu_semihosting_config_options(const char *opt); +void qemu_semihosting_connect_chardevs(void); #endif /* CONFIG_USER_ONLY */ =20 #endif /* SEMIHOST_H */ diff --git a/qemu-options.hx b/qemu-options.hx index 51802cbb266..6aa3a08c2fb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3975,12 +3975,12 @@ STEXI Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only). ETEXI DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config, - "-semihosting-config [enable=3Don|off][,target=3Dnative|gdb|auto][,arg= =3Dstr[,...]]\n" \ + "-semihosting-config [enable=3Don|off][,target=3Dnative|gdb|auto][,cha= rdev=3Did][,arg=3Dstr[,...]]\n" \ " semihosting configuration\n", QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 | QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2) STEXI -@item -semihosting-config [enable=3Don|off][,target=3Dnative|gdb|auto][,ar= g=3Dstr[,...]] +@item -semihosting-config [enable=3Don|off][,target=3Dnative|gdb|auto][,ch= ardev=3Did][,arg=3Dstr[,...]] @findex -semihosting-config Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II only). @table @option @@ -3988,6 +3988,8 @@ Enable and configure semihosting (ARM, M68K, Xtensa, = MIPS, Nios II only). Defines where the semihosting calls will be addressed, to QEMU (@code{nati= ve}) or to GDB (@code{gdb}). The default is @code{auto}, which means @code{gdb} during debug sessions and @code{native} otherwise. +@item chardev=3D@var{str1} +Send the output to a chardev backend output for native or auto output when= not in gdb @item arg=3D@var{str1},arg=3D@var{str2},... Allows the user to pass input arguments, and can be used multiple times to= build up a list. The old-style @code{-kernel}/@code{-append} method of passing a diff --git a/stubs/semihost.c b/stubs/semihost.c index 1a4e88e5326..4d5b3c06530 100644 --- a/stubs/semihost.c +++ b/stubs/semihost.c @@ -64,3 +64,7 @@ const char *semihosting_get_cmdline(void) void semihosting_arg_fallback(const char *file, const char *cmd) { } + +void qemu_semihosting_connect_chardevs(void) +{ +} diff --git a/vl.c b/vl.c index fba48b565c9..49878a2a1bf 100644 --- a/vl.c +++ b/vl.c @@ -4156,6 +4156,8 @@ int main(int argc, char **argv, char **envp) =20 qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, &error_fatal); + /* now chardevs have been created we may have semihosting to connect */ + qemu_semihosting_connect_chardevs(); =20 #ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"), --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849423; cv=none; d=zoho.com; s=zohoarc; b=OXh9xW+L3/fmqrgGfeG94Q8hWpUXFTmVURyKynQk75M0WXWMq+6w/sis9Tn9+l62Qrxaxs3I2iruoccZb8F8nFP3zic5DQnnzP55tJ8YC6x2sEnPE+/KnrV1KuU0lInmycvJjWJtfq2YdD+uILHBti+NhNkTExv3sUG43kRrMfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849423; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=8P0Lit3+ogalzWIYoV9bDuQCb6yqzuLD2GL2ck9k72U=; b=Ev3r8CRYUK4j5vYYWCMyvLYUgDkLgm/novNEe0hS3oDb/8/jEHrGnQ+peOr8+rFvEI8vCg1VFf9wXt8Koe13Fg0t74qDFZHXqDrHREVyfAdSYr9t1a8J0A0DksAFfEcSDy01ACwMRvrMp0ta86t1Y3vjP/Q0XJfLQSt3jPUqaGQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1557849423839468.87198217423975; Tue, 14 May 2019 08:57:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:50224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZnY-0007sz-L2 for importer@patchew.org; Tue, 14 May 2019 11:57:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjp-0004l8-Am for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjo-0006DS-0S for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:09 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjn-0006C8-PX for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:07 -0400 Received: by mail-wm1-x341.google.com with SMTP id o189so3432113wmb.1 for ; Tue, 14 May 2019 08:53:07 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g6sm14700712wro.29.2019.05.14.08.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7834B1FF92; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8P0Lit3+ogalzWIYoV9bDuQCb6yqzuLD2GL2ck9k72U=; b=m8XjDVZfHoOqs814AqYdCoaJljUHvUN91Ybm1Nij/tU9WxajK7mp8Ae6guBr6m6WRt zDiGm0Zaeu4suWI8/IE5WsPbTYfyfH58WZMuMhurxZKGV8zY6Gl7cu+4r2P7Bddkd52l qeoQDqk+22weMucKa66/pPwK4LLgBoQ6KSSKoAWF0khlILdnEugDDyC24CH93FucPK1s qn84AoZA/N3TNGGqByzcFZe7LzME2gYNHai3cm2yckxlVvBpjjspln5LU8pVAxoT5rwr fgFRTqPv77KiUo72SKf9TxVli8rh+a3YvDEfT+EE40Jh/i1iEDS3OVcQLE5+30dRXhr/ Wdgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8P0Lit3+ogalzWIYoV9bDuQCb6yqzuLD2GL2ck9k72U=; b=ffbMGjW+msTiyKSp+h77AQK3TUIPPP8reuxqpqU9sP9yNjGACgRPcEUfr7zH6JG2K1 xlA8kPWcFgpdLYxPQmVsTjOtSe0jiYC3vEhBvpwN5tGKwdn4F5QETGD1NNC7FI4lf5f5 aZt3sJT66NBrUYFDt+9ckuR7iHJnZJntodeLGCzYj1ht3YNORJQrKaebIfkUHS+E8Foc fzJJNcfmntVRuZsT/Wio9M0FdfRQFty0POZ+49ylSPcp7mNnjSinaS/LP5psi5LkLrHV G/TgJYCEEjloLwJQRpjdWSR59ucvCu3QK57hZD2s9lNTyyP5nUYNIiLuLl6itasK51Dl 3ACw== X-Gm-Message-State: APjAAAVjni1nXZOzQAg3yS+RPat2it10pTDaKi75S0gPq+n+nYH/65x6 opf+gIwd6ECwP109hIlLQliB8Q== X-Google-Smtp-Source: APXvYqyzUdkINOCv8xk4PIsQUGZlqhkDQ1O2ZHGv7fJVDskDf14yZ5cWtJzMsWxUcVcLRgNlb7whig== X-Received: by 2002:a05:600c:551:: with SMTP id k17mr5368389wmc.119.1557849186612; Tue, 14 May 2019 08:53:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:55 +0100 Message-Id: <20190514155301.16123-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [RFC PATCH 05/11] target/arm: fixup some of the commentary for arm-semi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This cleans up a number of the block comments to fit the proper style. While we are at it we also reference the official specification and document what the return register value can be. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/arm-semi.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 3273306c8ea..9e5a414dd89 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -2,6 +2,7 @@ * Arm "Angel" semihosting syscalls * * Copyright (c) 2005, 2007 CodeSourcery. + * Copyright (c) 2019 Linaro * Written by Paul Brook. * * This program is free software; you can redistribute it and/or modify @@ -16,6 +17,10 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see . + * + * ARM Semihosting is documented in: + * Semihosting for AArch32 and AArch64 Release 2.0 + * https://static.docs.arm.com/100863/0200/semihosting.pdf */ =20 #include "qemu/osdep.h" @@ -240,6 +245,15 @@ static target_ulong arm_gdb_syscall(ARMCPU *cpu, gdb_s= yscall_complete_cb cb, put_user_u64(val, args + (n) * 8) : \ put_user_u32(val, args + (n) * 4)) =20 +/* + * Do a semihosting call. + * + * The specification always says that the "return register" either + * returns a specific value or is corrupted, so we don't need to + * report to our caller whether we are returning a value or trying to + * leave the register unchanged. We use 0xdeadbeef as the return value + * when there isn't a defined return value for the call. + */ target_ulong do_arm_semihosting(CPUARMState *env) { ARMCPU *cpu =3D arm_env_get_cpu(env); @@ -510,14 +524,16 @@ target_ulong do_arm_semihosting(CPUARMState *env) =20 output_size =3D ts->info->arg_end - ts->info->arg_start; if (!output_size) { - /* We special-case the "empty command line" case (argc=3D= =3D0). - Just provide the terminating 0. */ + /* + * We special-case the "empty command line" case (argc=3D= =3D0). + * Just provide the terminating 0. + */ output_size =3D 1; } #endif =20 if (output_size > input_size) { - /* Not enough space to store command-line arguments. */ + /* Not enough space to store command-line arguments. */ return -1; } =20 @@ -571,8 +587,10 @@ target_ulong do_arm_semihosting(CPUARMState *env) GET_ARG(0); =20 #ifdef CONFIG_USER_ONLY - /* Some C libraries assume the heap immediately follows .bss, = so - allocate it using sbrk. */ + /* + * Some C libraries assume the heap immediately follows .bss, = so + * allocate it using sbrk. + */ if (!ts->heap_limit) { abi_ulong ret; =20 @@ -620,7 +638,8 @@ target_ulong do_arm_semihosting(CPUARMState *env) } case TARGET_SYS_EXIT: if (is_a64(env)) { - /* The A64 version of this call takes a parameter block, + /* + * The A64 version of this call takes a parameter block, * so the application-exit type can return a subcode which * is the exit status code from the application. */ @@ -633,14 +652,17 @@ target_ulong do_arm_semihosting(CPUARMState *env) ret =3D 1; } } else { - /* ARM specifies only Stopped_ApplicationExit as normal - * exit, everything else is considered an error */ + /* + * ARM specifies only Stopped_ApplicationExit as normal + * exit, everything else is considered an error + */ ret =3D (args =3D=3D ADP_Stopped_ApplicationExit) ? 0 : 1; } gdb_exit(env, ret); exit(ret); case TARGET_SYS_SYNCCACHE: - /* Clean the D-cache and invalidate the I-cache for the specified + /* + * Clean the D-cache and invalidate the I-cache for the specified * virtual address range. This is a nop for us since we don't * implement caches. This is only present on A64. */ --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849470; cv=none; d=zoho.com; s=zohoarc; b=Av3Qx95PPQXtj6tO7Uzm99GvpUGBz8o8yRaZ7I2N+sUF60l45Av84MFchTgIjRKdAiuSzSyVNEE7o1IhFsrif2iX8ok4Yd/I+XlCK5d4GEQ11TwhjhV3/SIhmqBcvmtxQQAaTj9JWDERwnT/a4j3UtYqHAwSeF2C10TTEFknlyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849470; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=3N082WaIffsJbYXIZ0a/9GfiR46w16xaqgWtZJxN1co=; b=VS1P+NnsSURtAoxi/Sv9ngnr+OaCrW0M/P8ypLflHtD1k11qjcUTdmvLLp+7A2BnjekwDxENV3cIplyZMg1X+1D3zpKpYhzdrwtRDorBuQ3irsvAK7KsQJ5IrmTz8bKnCDrHYiTcsz9dU4NTXcDMB8Z7ntR98C0vSA7ERAsFb9g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1557849470469695.4451623504197; Tue, 14 May 2019 08:57:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:50226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZoI-0000Jv-Vy for importer@patchew.org; Tue, 14 May 2019 11:57:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjp-0004mA-QZ for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjo-0006EP-HC for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:09 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjo-0006Cw-AS for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:08 -0400 Received: by mail-wm1-x343.google.com with SMTP id n25so3320466wmk.4 for ; Tue, 14 May 2019 08:53:08 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j9sm6786562wrr.90.2019.05.14.08.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8F7AF1FF93; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3N082WaIffsJbYXIZ0a/9GfiR46w16xaqgWtZJxN1co=; b=TWm6ndFPJjrhVd500ZU3j6de33SOsREWIeUSOAwFl7svBlfqtCC5IlKv25kowmtJyN IeuQmMftUaJ00eblCmL5OCQYtn1xxUz6CtM2FilQ7FEI6bFOSeiN2sbXapAjL3K3OuJv 7qOS5903Yuu/bMfUee7i3w7SAVg1o2Pl/Ixw3sFXyZR3rpOLn1ScrUNjhfSehhUGnVTG XBj8LVQlqgatf06DtMSlxwStQHfrCzlfwKeJcbmGdHR8IUykxWK2dvVaZEyN32GhbUIT KJoqpsGL7YU4fbC8QVJeFpgJ8Zjw4VeKR2Ay0jzxIMRXe+WGgKDzp6ohKkTYUfsu6G+U EI7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3N082WaIffsJbYXIZ0a/9GfiR46w16xaqgWtZJxN1co=; b=L6Dxw2vXWWZ6oLFVxhKfG2xMPFJrx5L0MdOuGt0yJAj79fJ+1yYBsGBspm/rQrZgpf P/ZDcU8tdztOO3ZICicaoG5RZ3zoqMDn3mbMgZpFuegtu75217YmAuKuUFbSTI2s903p JBeX32IuLNVbiVyg7ICR6LnYlBMwbdzFhhdARHyPZMoOAeF9F/1LH5K0LTVZgAKAQB/X bCjl549rA7FPiwelAEMHyfn0yXI8UIrFjRpzzevNUFV/eU1PmnvvXsT6//rLNYpMu1Nt PoN/Mm+VcyxGuknkjr7b9eWC8Ec+FYKf9krbQiNQTtkIimfHZe1APOQtGRUqcUTImPPM dgmg== X-Gm-Message-State: APjAAAVqKK/zY1kvJQAW3gxwgniu+zQfW5TUi0CHaBPcFPTr4ZDuxalm je4Sn8igvunNYsXH9eGq/3iRJ5BlRwk= X-Google-Smtp-Source: APXvYqy8RDCcybQqgxR7z2iPevXlX/bR3opsy/0GIGL/nAk5Lw/KGaeqNNZPtw8oFiATN64njtVpkA== X-Received: by 2002:a1c:7d04:: with SMTP id y4mr18978347wmc.123.1557849187283; Tue, 14 May 2019 08:53:07 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:56 +0100 Message-Id: <20190514155301.16123-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [RFC PATCH 06/11] target/arm: use the common interface for WRITE0/WRITEC in arm-semi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Riku Voipio , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now we have a common semihosting console interface use that for our string output. However ARM is currently unique in also supporting semihosting for linux-user so we need to replicate the API in linux-user. If other architectures gain this support we can move the file later. Signed-off-by: Alex Benn=C3=A9e --- linux-user/Makefile.objs | 2 ++ linux-user/arm/semihost.c | 24 ++++++++++++++++++++++++ target/arm/arm-semi.c | 31 ++++++------------------------- 3 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 linux-user/arm/semihost.c diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs index 769b8d83362..285c5dfa17a 100644 --- a/linux-user/Makefile.objs +++ b/linux-user/Makefile.objs @@ -6,4 +6,6 @@ obj-y =3D main.o syscall.o strace.o mmap.o signal.o \ obj-$(TARGET_HAS_BFLT) +=3D flatload.o obj-$(TARGET_I386) +=3D vm86.o obj-$(TARGET_ARM) +=3D arm/nwfpe/ +obj-$(TARGET_ARM) +=3D arm/semihost.o +obj-$(TARGET_AARCH64) +=3D arm/semihost.o obj-$(TARGET_M68K) +=3D m68k-sim.o diff --git a/linux-user/arm/semihost.c b/linux-user/arm/semihost.c new file mode 100644 index 00000000000..9554102a855 --- /dev/null +++ b/linux-user/arm/semihost.c @@ -0,0 +1,24 @@ +/* + * ARM Semihosting Console Support + * + * Copyright (c) 2019 Linaro Ltd + * + * Currently ARM is unique in having support for semihosting support + * in linux-user. So for now we implement the common console API but + * just for arm linux-user. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "hw/semihosting/console.h" +#include "qemu.h" + +int qemu_semihosting_console_out(CPUArchState *env, target_ulong addr, int= len) +{ + void *s =3D lock_user_string(addr); + len =3D write(STDERR_FILENO, s, len ? len : strlen(s)); + unlock_user(s, addr, 0); + return len; +} diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 9e5a414dd89..253c66b172a 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -27,6 +27,7 @@ =20 #include "cpu.h" #include "hw/semihosting/semihost.h" +#include "hw/semihosting/console.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" =20 @@ -314,32 +315,12 @@ target_ulong do_arm_semihosting(CPUARMState *env) return set_swi_errno(ts, close(arg0)); } case TARGET_SYS_WRITEC: - { - char c; - - if (get_user_u8(c, args)) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - /* Write to debug console. stderr is near enough. */ - if (use_gdb_syscalls()) { - return arm_gdb_syscall(cpu, arm_semi_cb, "write,2,%x,1", a= rgs); - } else { - return write(STDERR_FILENO, &c, 1); - } - } + { + qemu_semihosting_console_out(env, args, 1); + return 0xdeadbeef; + } case TARGET_SYS_WRITE0: - if (!(s =3D lock_user_string(args))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - len =3D strlen(s); - if (use_gdb_syscalls()) { - return arm_gdb_syscall(cpu, arm_semi_cb, "write,2,%x,%x", - args, len); - } else { - ret =3D write(STDERR_FILENO, s, len); - } - unlock_user(s, args, 0); - return ret; + return qemu_semihosting_console_out(env, args, 0); case TARGET_SYS_WRITE: GET_ARG(0); GET_ARG(1); --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849581; cv=none; d=zoho.com; s=zohoarc; b=QobEHiueUIrGIMEGYb954juuqjIsaf7qO0vm3jcRylNrTgGx39Izsgn03ICNJNeCjEB/nGH/nFJlii+iF/OuOeI/auLrckXVjk/qN8ylsFpZdCOMmOh56tLd/fWhnC1npW/Bky/9bUmoezFVHxOlnI/jJYBpBstq0bCq6Jnnd+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849581; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=uRA15QcYpp84VA9k9wsWlnaKx7a1xt3gupbkmncewJA=; b=aUJmL5OXa0AaZmiXntQo6HDSYf5idPMhZ2L5OLo8Uw2eVjV4Dv5QebCWkeSl1BIb9bG9hFGJJMFWje+W+ulz4q0YiOyb+mupBRfdxMc8r4ZN3LTaDXx6EbuBY22b44SK1Oh6rzbao/hXUJOFCZCHbwnh74M1EYcP1f2glQ5/sls= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 155784958148533.84900307648684; Tue, 14 May 2019 08:59:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:50255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZq6-000246-GS for importer@patchew.org; Tue, 14 May 2019 11:59:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjq-0004nI-HP for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjp-0006HR-90 for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:10 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjp-0006EF-2N for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:09 -0400 Received: by mail-wm1-x341.google.com with SMTP id 7so3349126wmo.2 for ; Tue, 14 May 2019 08:53:08 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w18sm7054926wru.15.2019.05.14.08.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A38941FF96; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uRA15QcYpp84VA9k9wsWlnaKx7a1xt3gupbkmncewJA=; b=QrqjMzK05AStmW3oCrlklHRx6CfYVHGsp13bG9cRguuv9tbuIa/0+nEU4Wty82SXVm vjABYWIxmyMSqI4vNNqm9pzZQ/l+qrK7nFBscmVe8vMrrAgU2QdMdJrBX4sLr3T8M+WI sC7/HbYny2VpQoNgJC2ONGjdgYd5NabnX2W9msnuj8xqxvJ+SSuC+Mqi1Tnc/8PUwmUL nqZiwOtHvCTtNDUO/K1CWh9BdMMvhtv3B5nJDCV6v7qiOl7oF+JMVP8frg5xD2F+lJrj wWvriOy4rKg58n4Rjs41XcyiB0V9/aygEC6TIb2bCAS+k7n8M94cL4h78XfKW2Nl5i7B rcLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uRA15QcYpp84VA9k9wsWlnaKx7a1xt3gupbkmncewJA=; b=R234V+2bAz5cLZx06W0ZGgzLBMY2NErTQPUEfzhskndzZMLPBRGeUN7J+M3yZzFN0l qIoAuH9kL+hJCzCqIa+NP72EH8Vur/RAa8lewrEkMuvYvW7Bx0N36d6EJEV5GDJlEyw2 iBk1gEwSM4IgykSt8cnpTYqxHgvI4SduuM3pLWGUGBDi5hg7GBpxMTphu0tOzs6Hcydu aJBEFJ3nX1RrFKuiIvBv5LT89yyluSPe2HCo2qy88kK/8LxkNA/cejMGkRrT2n5hMoL8 apU8TM6R7Qsgh/1/Fp4KPkzWXcCOo31vARr2tMfjsvDcTbWiEeTWPeuvH8sEswKbeLR0 0scg== X-Gm-Message-State: APjAAAWiid5h5kgJW0qkwKNi4essITxAKRGkoV1dZxjFK9bGJMkJrTcV kEdsqVOkFsRikZUHmPPHvXxTaA== X-Google-Smtp-Source: APXvYqzIMfGZkEMzGA1aZWBJfPDCNfjg+5fgth0KdQXAgPy3VHWlgyWrh9u/4RTITIZn0eeexIfoJw== X-Received: by 2002:a1c:4406:: with SMTP id r6mr19995002wma.130.1557849188006; Tue, 14 May 2019 08:53:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:57 +0100 Message-Id: <20190514155301.16123-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [RFC PATCH 07/11] target/arm: add LOG_UNIMP messages to arm-semi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Clean-up our unimplemented bits with a proper message. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/arm-semi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 253c66b172a..a3bbef18ef7 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -28,6 +28,7 @@ #include "cpu.h" #include "hw/semihosting/semihost.h" #include "hw/semihosting/console.h" +#include "qemu/log.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" =20 @@ -366,7 +367,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) return len - ret; } case TARGET_SYS_READC: - /* XXX: Read from debug console. Not implemented. */ + qemu_log_mask(LOG_UNIMP, "%s: SYS_READC not implemented", __func__= ); return 0; case TARGET_SYS_ISTTY: GET_ARG(0); @@ -400,7 +401,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) return buf.st_size; } case TARGET_SYS_TMPNAM: - /* XXX: Not implemented. */ + qemu_log_mask(LOG_UNIMP, "%s: SYS_TMPNAM not implemented", __func_= _); return -1; case TARGET_SYS_REMOVE: GET_ARG(0); --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849783; cv=none; d=zoho.com; s=zohoarc; b=ELnoN4khnYUU2WdrlaWiiEirSaOGOfNaHSgV+7HFU+h0Hq62TRZAFr3n9fjyoCxWV5pCUzIp739MLtLZmMGEW2XFZFciRfoxGkaCpW/6BS8VxwMcqm1D2qJzMDaySvvSUx3f8d2j2wcGWIYCKPN/jBQUfHL9Iyt44ZlNCk+9KMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849783; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=l/EZtOIUyXPpqgCV5lyhmXRqV1pA86ugcjhdZROi1Z8=; b=G5b5GBSiW1GnNHwFOtW/6Jt0B96yxsJmBHoyDOYQDHZrbPqK998bHmI7dHIoQuACGyjL38MZ/g5RyjDBxMa7VwAtziY6iWtuxezo7qvIjdoXJ479p+dF6T3EDNmd5cgRWR/e32sC0PAHqSXGnyqSwGALGIJdLdcHRDRurXWRuUU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1557849783063431.72041817801676; Tue, 14 May 2019 09:03:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:50399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZtK-0004u2-Rv for importer@patchew.org; Tue, 14 May 2019 12:02:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjr-0004oK-EU for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjp-0006KO-V5 for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:53175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjp-0006Go-MJ for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:09 -0400 Received: by mail-wm1-x341.google.com with SMTP id y3so3436936wmm.2 for ; Tue, 14 May 2019 08:53:09 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 15sm3580767wmg.36.2019.05.14.08.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B877F1FF98; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l/EZtOIUyXPpqgCV5lyhmXRqV1pA86ugcjhdZROi1Z8=; b=WkCkO8qKAZ0uLl0RhQASW3MB8JEW4RRqIqUsDKImnpMMIk29f3qEKUNrTYkEBZYmHr D32fT3MeKJhYM3X/GpeYf7M7p1k8CWXMIABmmZdmF3iJ35J7/edececFU7SI4PeudjoA TrtGcLb0JoqELZpEufqX8t/2mT0UzICJSO7H8Dh5CBI15Mp25cwlpSzKT2Cz4SCCZhTh XFSPpqxgdN8nmOcLJnNLV+CkAgMefNvPu7IXRgU3RbTKkdv04HgR2HqhWLysnj+yul1w ekf+F/aVMendG+tYDh0cnAtNg+AapBLAgNBnXlnalZicvcwVP3Nr2WP/WkxRooI1Awko 5PYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l/EZtOIUyXPpqgCV5lyhmXRqV1pA86ugcjhdZROi1Z8=; b=Awt+lXwJc4cCIPVOuuvtXkkbJQd0U/CvKcuUbspuCBiraokxWDaCbeIlMJPPZz1b/X VfzhbyUBHU+PRYvhwhhnTy7yX4HNdWHY+T+usxF+cW27VSNPD/tlyIngheSls+6k+FSK IeF5DGVc0V4bBgP3panM1qWb6L0UI6GTPL/jF+j7dXk1NPYZ4OaqA8oQjDwIWOzHGK2+ L7PTZ9pz09UJEEMWqeAXoBIaZ8AH7iKzHTbRVsJXeCV7BH4NxNEaiWxyMhR7d60+e5US NCq7K+qf1K1PcCwuyvr188eTI4eGvObI5SHslvuqxyi/N+3aBt4bBFEnZR26h9Z3xis0 OHeQ== X-Gm-Message-State: APjAAAVD7bqgwExjqZSvJV+dkw3FCenjDoXWPqCl43wVcT4fF7udqEaK cMWvICnLJYVV/4NzeErypuftdQ== X-Google-Smtp-Source: APXvYqzOnXYL4rjzQGrip1yjubbr5tijHpTWP72i8Gjtg1J+oqDJQjJrn/AiyPdZve0Pia6sAaN6dQ== X-Received: by 2002:a1c:9c03:: with SMTP id f3mr20577817wme.67.1557849188513; Tue, 14 May 2019 08:53:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:58 +0100 Message-Id: <20190514155301.16123-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [RFC PATCH 08/11] target/arm: correct return values for WRITE/READ in arm-semi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The documentation says the write should return the number of bytes not written on an error (0 means everything was written). Read provides a buffer length and the return value should be the buffer length - bytes actually read. Remove the incorrect FIXME's and return the correct values. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/arm-semi.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index a3bbef18ef7..3ae8f05d51b 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -334,13 +334,15 @@ target_ulong do_arm_semihosting(CPUARMState *env) } else { s =3D lock_user(VERIFY_READ, arg1, len, 1); if (!s) { - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; + /* Return bytes not written on error */ + return len; } ret =3D set_swi_errno(ts, write(arg0, s, len)); unlock_user(s, arg1, 0); - if (ret =3D=3D (uint32_t)-1) - return -1; + if (ret =3D=3D (uint32_t)-1) { + ret =3D 0; + } + /* Return bytes not written */ return len - ret; } case TARGET_SYS_READ: @@ -355,15 +357,17 @@ target_ulong do_arm_semihosting(CPUARMState *env) } else { s =3D lock_user(VERIFY_WRITE, arg1, len, 0); if (!s) { - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; + /* return bytes not read */ + return len; } do { ret =3D set_swi_errno(ts, read(arg0, s, len)); } while (ret =3D=3D -1 && errno =3D=3D EINTR); unlock_user(s, arg1, len); - if (ret =3D=3D (uint32_t)-1) - return -1; + if (ret =3D=3D (uint32_t)-1) { + ret =3D 0; + } + /* Return bytes not read */ return len - ret; } case TARGET_SYS_READC: --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849952; cv=none; d=zoho.com; s=zohoarc; b=hILwZ63GMnsGl+SNfVhemGUun4JMGlg/nsC/O4OcB49Dtsf3IIuXUZeroJH+kXCHjniDg7FL7r3v9LJDAUqXo3kicgWik4d0MICOUvPL4iVu0Fy06uWia/e/W2wIYHzC0EwbEHNAPLvwYmaILR5edC40kX68l9wngfKf3fnQj7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849952; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=U06wLwXAasasiurhZZxcEyeJ76fELq2p37jmN4PgTWk=; b=S6Y45htaWNZ/a+glV4tcAEugQj4+F+yIklkPdJaL37M1gkpN9NkuqqSDKflcblVlFLDf8D2/92Hg9fMPobgT/OirLfwobRSCKy4pju9ZUHmFpPAh8kG5rRptLSp0aQSdF20socVa+XtONnF+0YRS1gqVFGR/qnPdDXLzdnSjShA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1557849952149780.9327901362307; Tue, 14 May 2019 09:05:52 -0700 (PDT) Received: from localhost ([127.0.0.1]:50469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZw4-00071F-PH for importer@patchew.org; Tue, 14 May 2019 12:05:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjr-0004p4-Qz for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjq-0006Ll-IY for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjq-0006Iq-BT for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:10 -0400 Received: by mail-wm1-x342.google.com with SMTP id o189so3432238wmb.1 for ; Tue, 14 May 2019 08:53:10 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y40sm19431367wrd.96.2019.05.14.08.53.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CF5701FF99; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U06wLwXAasasiurhZZxcEyeJ76fELq2p37jmN4PgTWk=; b=VDpoQjdjJpqv+U5DNs7MC4BPRsNXGv0ozijKDokDNKL0x3caANIo9R84k8QzHa0QCh 6BmLy8z17jQKiHV5Hj7HYPHQAfqkrmgqiIqSIRUdg1+8B5QfmU1fq7b6OFyg5BvjnKHT VwJscLuuHnH5ZNUiGQ+v253h+gJFc7ukG0zmFxLSOQjYgIZyDzCJNPolJ+L60B/Vew4S UFmhECwyWsh/AcafCy6xEJ96z1df/tLcKc5G70iees5sNm2TnjWd/owiN1twiwQR3Aqv EZQ9ihWHt573Qqc/6IG/J0udH7GQERlCqO+6CLCP/SNQlC4V38LPnRIVD7j9hB+nmHHb 7VLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U06wLwXAasasiurhZZxcEyeJ76fELq2p37jmN4PgTWk=; b=VQnD88UKEM9aR9vEiN8dVBRSf7JIBuJZ/2wJuKSNFi46VQVJYXX4g2C+zcVZR8UVBk GadYAq9dlkmElyR0iEhLpylr9hMD3A3PWE+zkAY5OGwaJtwfo2kZffOHL/wykqzrj1ek bfNMP5mh2duC8Xq/64dMujanmA0MUy9VQkJAlXuA+TdmGoLHu5868xTEqCsTvkdczXCY 4QIgpkuYOFkVazegSbM3ysBswCnhko6DxrrT9WbB5oYwHjPO29LDhQ/H2Ua6P6UoIzL4 RZ1xVTdCx33/qCa347iQTu4nzU4SAfr3ADENSpZerQ4V8254XSwL/pOD8OB1ullXiH+t qzxQ== X-Gm-Message-State: APjAAAVXqga9qe5Wf7OrGHSldc7fRd7D/PHJg466VdH5vFh3gl2aUDbi Mtrbl7YcFvBHJxTgsTQfnOITsg== X-Google-Smtp-Source: APXvYqzqxYSpNpfTBNkNShbjXnCSPYuJLHDDlfjNy1q7VkVFZpd9/L+MLb5paAyh5Atas8WPqwKVWQ== X-Received: by 2002:a1c:2c89:: with SMTP id s131mr19508380wms.142.1557849189250; Tue, 14 May 2019 08:53:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:52:59 +0100 Message-Id: <20190514155301.16123-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [RFC PATCH 09/11] target/mips: only build mips-semi for softmmu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The is_uhi gates all semihosting calls and always returns false for CONFIG_USER_ONLY builds. There is no reason to build and link mips-semi for these builds so lets fix that. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/mips/Makefile.objs | 3 ++- target/mips/helper.h | 2 ++ target/mips/translate.c | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target/mips/Makefile.objs b/target/mips/Makefile.objs index 651f36f5176..3448ad5e193 100644 --- a/target/mips/Makefile.objs +++ b/target/mips/Makefile.objs @@ -1,4 +1,5 @@ obj-y +=3D translate.o dsp_helper.o op_helper.o lmi_helper.o helper.o cpu.o -obj-y +=3D gdbstub.o msa_helper.o mips-semi.o +obj-y +=3D gdbstub.o msa_helper.o +obj-$(CONFIG_SOFTMMU) +=3D mips-semi.o obj-$(CONFIG_SOFTMMU) +=3D machine.o cp0_timer.o obj-$(CONFIG_KVM) +=3D kvm.o diff --git a/target/mips/helper.h b/target/mips/helper.h index a6d687e3405..90ab03b76e3 100644 --- a/target/mips/helper.h +++ b/target/mips/helper.h @@ -2,7 +2,9 @@ DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int) DEF_HELPER_2(raise_exception, noreturn, env, i32) DEF_HELPER_1(raise_exception_debug, noreturn, env) =20 +#ifndef CONFIG_USER_ONLY DEF_HELPER_1(do_semihosting, void, env) +#endif =20 #ifdef TARGET_MIPS64 DEF_HELPER_4(sdl, void, env, tl, tl, int) diff --git a/target/mips/translate.c b/target/mips/translate.c index 3cd5b11b16b..fb905c88b57 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -13726,6 +13726,14 @@ static inline bool is_uhi(int sdbbp_code) #endif } =20 +#ifdef CONFIG_USER_ONLY +/* The above should dead-code away any calls to this..*/ +static inline void gen_helper_do_semihosting(void *env) +{ + g_assert_not_reached(); +} +#endif + static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx) { int rx, ry; --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557849717; cv=none; d=zoho.com; s=zohoarc; b=ALlkGM5GEXwaYuJY3BwhdTaQ00U5awVGN9mQEVJOVqhwLyYHhz6LxKOpsGJT1i4wdjq1M9TQTY5ydKPk/WR7x7aTFsh32cGkGfj/PrDuzcaXicIkZk8Ibg/K9HpR7MQFo6gfiUmwtLjNFhiAITQLTnOSmHGID9g2ArAzB0P5tnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557849717; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=/LCsl9Du5Zb3JNBgOo6lbNCwiqPK/NFNHlF5WOB9yB0=; b=hPlGqE+2QdnIQgT5y79cOwoR4o2fWDarAX0leiYbRweWGVbDParYWJ7QdeLGQjd8W4zIx7VR21Pndz1YdUyd06reMmF01E/MTd//qhbJsR/L7e2MMudF1EaMErsgpUoDuPcZRvjRRv3mQii7jgKBkuLjHVfjvX4xjQfddNa/BN4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557849716949322.94886019173373; Tue, 14 May 2019 09:01:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:50332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZrv-0003YX-1M for importer@patchew.org; Tue, 14 May 2019 12:01:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZjs-0004pZ-7K for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZjr-0006Mf-49 for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:12 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41256) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZjq-0006Ke-TG for qemu-devel@nongnu.org; Tue, 14 May 2019 11:53:11 -0400 Received: by mail-wr1-x444.google.com with SMTP id d12so19775965wrm.8 for ; Tue, 14 May 2019 08:53:10 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c9sm12598826wrv.62.2019.05.14.08.53.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 08:53:05 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E24A31FF87; Tue, 14 May 2019 16:53:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/LCsl9Du5Zb3JNBgOo6lbNCwiqPK/NFNHlF5WOB9yB0=; b=YDPRcD4TwCfdkuQSRZLeMT9Sr9bRTKQZSSJ2O7XBGrHXcItE5Dx5rpRmM/+KPbg8DT bLXx7ZJqb2CbMTPlriruH/MCzUIP9A5HntnKc/oxpREb4rwtTsuAPnBojlK5kh0Lro5a 8OYnZffrNOBSh/fr4sACpQNW5jVEuV0UDQe0bBcj9UUBiT93I0J6UDB7nt+dVW1sl77T WFhxQ5/77K3kb2IwLtj/vh20/cwP36kQ3qa2FlhCY3cxepF7s3dPd78rp5Jr5unM/E8A 0tz4npDuHpVSpBkz/UT8eRL2QGbIbUrTrcDtfpqpAvUNsu3zvCNW3cn4i6X5vQCDmbtx /gjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/LCsl9Du5Zb3JNBgOo6lbNCwiqPK/NFNHlF5WOB9yB0=; b=B5ZGN+9nubC4xZagEku+G1k9AvX5m1VM0kapepC68UEH9vdv44wV7FNkQARpWNvbQ7 6/ohILstA1BUxgITcHne5RrK2HGUHQ6eXhbZETJ3zl98j6xwQd6sLJiQLn0ibSaGo1/y ehGgcp7LJIMYkq4uAAO8g+UvoyO2tKwRor3DcHU4jqZD08FmjkOKvWgpQ+ePDxQ6htzv ZHawmyt67ifpMi6ha50R1O1AO7KihOKP0YiIbv+k5P0B/xwAaP/k7Ko6Kprtqe1bQlDp 6DRA0V13uDbpLOf5VlgljMOt69JyesQHQBtQ6LUId9yRIymhmQW+2UzqsdYkh6nb8N3J POmg== X-Gm-Message-State: APjAAAVTM0nPboQNsXKWXNgaX7v14bOjVC2enY2OTRT4xtiQFXKl8nW/ 3z0h46halO1NiWNleEPyzZMK7zJMS6c= X-Google-Smtp-Source: APXvYqzAykb8ticQn2EAU5voWaABgy754IDQf+PQ6AXO9cf1a6fgqRaGsut4zUBn7fn+hl2Ya8h/5w== X-Received: by 2002:a5d:4988:: with SMTP id r8mr11283170wrq.57.1557849189770; Tue, 14 May 2019 08:53:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:53:00 +0100 Message-Id: <20190514155301.16123-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [RFC PATCH 10/11] target/mips: convert UHI_plog to use common semihosting code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Rather than printing directly to stdout lets use our common semihosting code. There is one minor difference in that the output currently defaults to stderr instead of stdout however this can be controlled by connecting semihosting to a chardev. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Aleksandar Markovic --- target/mips/mips-semi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c index eac8374fb34..35bdfd7c77e 100644 --- a/target/mips/mips-semi.c +++ b/target/mips/mips-semi.c @@ -23,6 +23,7 @@ #include "exec/helper-proto.h" #include "exec/softmmu-semi.h" #include "hw/semihosting/semihost.h" +#include "hw/semihosting/console.h" =20 typedef enum UHIOp { UHI_exit =3D 1, @@ -329,13 +330,12 @@ void helper_do_semihosting(CPUMIPSState *env) p2 =3D strstr(p, "%d"); if (p2) { int char_num =3D p2 - p; - char *buf =3D g_malloc(char_num + 1); - strncpy(buf, p, char_num); - buf[char_num] =3D '\0'; - gpr[2] =3D printf("%s%d%s", buf, (int)gpr[5], p2 + 2); - g_free(buf); + GString *s =3D g_string_new_len(p, char_num); + g_string_append_printf(s, "%d%s", (int)gpr[5], p2 + 2); + gpr[2] =3D qemu_semihosting_log_out(s->str, s->len); + g_string_free(s, true); } else { - gpr[2] =3D printf("%s", p); + gpr[2] =3D qemu_semihosting_log_out(p, strlen(p)); } FREE_TARGET_STRING(p, gpr[4]); break; --=20 2.20.1 From nobody Fri Apr 26 00:32:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1557850032; cv=none; d=zoho.com; s=zohoarc; b=WAZtA2zxp6TA+u/rnHR4DRYSdQ/hnt1DZburky2MU6b5+Pe/aOMnJw6n5DxwhoLu3yaHK4x+2lHNowGkreoi2S2pBxipRCH+Soy0dleXbP9+raihJZZxwnSmdM/CovwTEavDixxgDlfP7+W5t9mK99kmmzkdeJKB49TXFV3e82U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557850032; h=Content-Type: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:References:Sender:Subject:To:ARC-Authentication-Results; bh=Sllw1VUnenUpn8foyb+omUx4/xqmAm1WWWMjnAQGm+o=; b=iEhuc6pIJjXPgKY1k2eF+p91XHx8/FgHsOqsURZs8dStF+1cBlp3NYmCElpjQSB4N+JVIBMp5+PjjpItYy8zT4A1OWhj4dC9Qb6boe97FteDri0XfJYJHS71KEVk/yTMzTU4Xl1NB1qh6lz3CQ5IliZi9pW7dYIhDhW7jcKS+l8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557850032321321.4940717784119; Tue, 14 May 2019 09:07:12 -0700 (PDT) Received: from localhost ([127.0.0.1]:50500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZxK-0007wb-AU for importer@patchew.org; Tue, 14 May 2019 12:07:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZqE-0002gB-E6 for qemu-devel@nongnu.org; Tue, 14 May 2019 11:59:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZqD-00065u-Gp for qemu-devel@nongnu.org; Tue, 14 May 2019 11:59:46 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:37404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQZqD-00065P-AT for qemu-devel@nongnu.org; Tue, 14 May 2019 11:59:45 -0400 Received: by mail-wr1-x433.google.com with SMTP id e15so7433132wrs.4 for ; Tue, 14 May 2019 08:59:45 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 6sm18365980wrd.51.2019.05.14.08.59.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 14 May 2019 08:59:43 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 029091FF9A; Tue, 14 May 2019 16:53:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Sllw1VUnenUpn8foyb+omUx4/xqmAm1WWWMjnAQGm+o=; b=j7EqRFqDBdumU8BKx8cZiiwsoTgIF+oRxgknzCAYsWJfPB+vg35Bh5P9i9EDWAq1RV nzVphwC2rj63evzqjGC0DvVlgtCe+EOyorFJ1ZehoebCuKFm33P3aXWG4/TJeNpD0Y+1 Q2dCw3T0Z+Lace/M577r3XVs+2iK8sH+SUd9HIc5MMe06Bbg4M6c2jlQh3YUa3kRbIZd danVeJuhWKGAixcEuzjkk0FjXtye9DUz8EO2DXh3sCyjJFKfpPJXTUhmBclw0XqnWARc Vx/z5Qzyr4HymY5SJqZNb8x0KSGwBG7DbIe0g7jTZ87JyPjKyeY5XTxV4WW3/SoKZEOX ehbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Sllw1VUnenUpn8foyb+omUx4/xqmAm1WWWMjnAQGm+o=; b=W+gSHxa8H18WwyM/BjRSDmNxptlYlX/U+LmstW1w7/gJamWp5xUK2BIMm3NsObuQ9t BS8GSHePhYsfHJaP1IPy8Z0SR46GqKcBs/xRb1tHTobOzMFmgSl2Vuuh+yIbxZC3WNRd Y8d/F2KMFYR4m32dtKya2flNxV5h7XotlKoD9xdnpkjMIonS0/AxMkqMJe3o2fPGPeRS bh9S/Y+Gb6qJmbxCGRsqPJcgucK9f2jH4Jq04h+LQ0D6UsDDRu16KERTQO48fFJUJLIq yCu+OTU2zrNCIWvZwKrZ9dJ3ozDups9cMEHxoc1Sios4Tk+awGSPB9nWX2oDzjtT4/Hj M8aw== X-Gm-Message-State: APjAAAW/NDtzPbSekAy5SDaAw7Q+dCqWnJumNIJS5w9bEMVWXJQyDDtd tCP6DaWOu5CX9WtBOePdkf7c4w== X-Google-Smtp-Source: APXvYqzmpX5EAEjWdjH5CWwXqYDm8LjKdXjQ6WA8cCWQcizF6oQQINtrI8lI2sb818pzEmRQHOGeTA== X-Received: by 2002:adf:afcd:: with SMTP id y13mr21262936wrd.270.1557849584105; Tue, 14 May 2019 08:59:44 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 14 May 2019 16:53:01 +0100 Message-Id: <20190514155301.16123-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190514155301.16123-1-alex.bennee@linaro.org> References: <20190514155301.16123-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [RFC PATCH 11/11] MAINTAINERS: update for semihostings new home X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Seeing as I touched it I should at least keep an eye on it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a73a61a5465..e9050beb222 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2559,6 +2559,13 @@ F: docs/pvrdma.txt F: contrib/rdmacm-mux/* F: qapi/rdma.json =20 +Semihosting +M: Alex Benn=C3=A9e +L: qemu-devel@nongnu.org +S: Maintained +F: hw/semihosting/ +F: include/hw/semihosting/ + Build and test automation ------------------------- Build and test automation --=20 2.20.1