From patchwork Mon Jun 15 10:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Konrad X-Patchwork-Id: 11604499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0D5490 for ; Mon, 15 Jun 2020 10:03:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AF3B2068E for ; Mon, 15 Jun 2020 10:03:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.b="n/FAnp3i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AF3B2068E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jklxy-0001ah-K7 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jun 2020 06:03:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jklwW-0008ND-Lh for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:02:16 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:46824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jklwU-0001HA-MI for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:02:16 -0400 Received: by mail-wr1-x442.google.com with SMTP id x6so16400453wrm.13 for ; Mon, 15 Jun 2020 03:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=6uoWWKTPFyIYGbUbYSEp0s2AbL2buoXSCuOMpMcIMZE=; b=n/FAnp3iVaK3qelQbX6O5RWF7JLyyUYt1QvxMYdHYK80uZjiTW8Q7T1TzWWKX5V72U iuJB20gZXBwU756WqUsDL20RuRukjHhNRreUVH5GvLlsQCjrNIApQn+09t0ABpZA8kE4 td1VzsXG5vgnYTJlZNB8Byd8iiplOiVCjLCCastbz97xpkZy2LLbpQpqWDNI4IQ2jrLT fQazIUX4ZwA4genAlxm8kzIPOjPCDYaNxx/STJFKIoyvsq1c+zccmdv/AVeNTlMQ50ux cZ5IupKWQXsuanifEXK6JseOcAzhC4qwISOOv0faGAc4gpOzZZ7npAXen4iVtHZj0Byd oloA== 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; bh=6uoWWKTPFyIYGbUbYSEp0s2AbL2buoXSCuOMpMcIMZE=; b=uBYXl3vB2XSDibZZj3JoDafXeGI4M06I2bO6hS7H2emam7/sgZApJKbwTDWu4Ggk83 /W1WoGVPf2tDqB9JSvJG+rYA+3hVjyRm4Nb9JHioloWW5BugPO0gf0TMIjeW2NQKzeIG Fudt8HrjwdxjZ5nbwr7uX/qdPN247btmzl/JgebJ5LKreZMm4MjJrKizse5PxN9th9uY P+8boKCM16KhLjxHYROST1HZaAoBX9F7CXhJZ5P5lNr17LG0MQkOWpiL/q5UotRw6hyk t7IILw7NbKdD/ZPLwQQMHfaTEV7zpHAjJJhkvLj2yrW7sAyNooYkkzyGsv+/FdOYYemh qSKg== X-Gm-Message-State: AOAM533blgJO3bfP+KQ36MfntOsHRmRyOW97djv2npk/E4SyLmrhSBNT LrIcn4x3LUeTH1aiM8yXDgwlneFW4n5GkQ== X-Google-Smtp-Source: ABdhPJyVzvQvG6iVcWlwqghHM6ADErOzBnsaCIoA/QfF/AEF0yMrSZinxI3SMqtT0sRAukgInUJeVA== X-Received: by 2002:a5d:49cd:: with SMTP id t13mr30114468wrs.292.1592215332080; Mon, 15 Jun 2020 03:02:12 -0700 (PDT) Received: from linux.home ([2a01:cb19:867e:2100:7eef:23e0:9210:3e8]) by smtp.gmail.com with ESMTPSA id g19sm21122757wmh.29.2020.06.15.03.02.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2020 03:02:11 -0700 (PDT) From: konrad@adacore.com X-Google-Original-From: frederic.konrad@adacore.com To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] semihosting: defer connect_chardevs a little more to use serialx Date: Mon, 15 Jun 2020 12:00:51 +0200 Message-Id: <1592215252-26742-1-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=konrad@adacore.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, KONRAD Frederic , alex.bennee@linaro.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: KONRAD Frederic With that we can just use chardev=serial0. Signed-off-by: KONRAD Frederic --- softmmu/vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index f669c06..9b8b48a 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4123,8 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp) 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(); #ifdef CONFIG_VIRTFS qemu_opts_foreach(qemu_find_opts("fsdev"), @@ -4271,6 +4269,9 @@ void qemu_init(int argc, char **argv, char **envp) if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) exit(1); + /* now chardevs have been created we may have semihosting to connect */ + qemu_semihosting_connect_chardevs(); + /* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model = get_default_vga_model(machine_class); From patchwork Mon Jun 15 10:00:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frederic Konrad X-Patchwork-Id: 11604501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 949A590 for ; Mon, 15 Jun 2020 10:03:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BADC2068E for ; Mon, 15 Jun 2020 10:03:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.b="bpkzki9h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BADC2068E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jklxz-0001dM-Jf for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jun 2020 06:03:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jklwY-0008QP-UF for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:02:18 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jklwX-0001KU-Ap for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:02:18 -0400 Received: by mail-wr1-x443.google.com with SMTP id r7so16465050wro.1 for ; Mon, 15 Jun 2020 03:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wF+bGbEnfshWxsJ/yf4Ch6hkzE9gZQxmulbsomoxE0g=; b=bpkzki9hvT46KeGV5YtOIsmIqZrbO9YdiZFrl6U8ndVQtz2dLBeSq8KIMu99x1+7Nd Vd/Nm0pdvPmQHdVzdjzkPYNIIYvdw1uY2SRzxGCojRD8ksUum8bwM+edAi+MHSwiMYdw 6ygjaQ9NGVKxncFZO0jizUO1ioIrkOuB5D+Iu1wRcXvRxca8XXKGVjshmb+InGBriSsR CZ2QNnYj0syl78LAbvn9CLp64aixJeHQFeISfra3IbH39MwvmBu22lL7BeCBoa1p/5L1 Gz5zB/eC+wGg9wHGRsyG1+I1MlarXnLID19ipzj+v4oOGuJSDtrDnMNSxoZOBfys4/lV 9nLA== 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; bh=wF+bGbEnfshWxsJ/yf4Ch6hkzE9gZQxmulbsomoxE0g=; b=Z53ACalC2bFFpEA35OKdsBH6SQBnomnj6c5nHJVUZwrAdph4Ill7ED4SehtTT0IeWf ajV0PTcMgpEUdgg4W0Lmiy91GhO1wWoaK/V+VXB2f6feFxAsEmn5BkbJ34rwtM+RBlPj ROY6LY5apuLdDNbAhUlcTLjuzFzAkfzPiMW55JF7qHSmliEmRdsta0LcNonhR7Aic+3B /1c9Pp7GYqskQy3YfmBGsrW+7VN1JbOzru62ykD7orMKgvWJH1A8xxVZpw9IpVDjGe0j bZvMe2ZR93rWBNsg/r8RQVwrWlM7R5XmhTEW8nglVuPMdqLx58qq4eb3KSvj+79ANdg0 IomQ== X-Gm-Message-State: AOAM533r48I52AOZGlUHBvSTntBoe/rR+cVNIrmeQQTXhisjBiO96yY5 FRP0AFkdbcHiI8g5YkjA308qb9jocINmwQ== X-Google-Smtp-Source: ABdhPJyFqkSmRND8gX+c3M1vSN6bf/Y2SHb1UO+BQGVgy24vrQRSaEfDckFSq7ciRZWWu2Y5vmORKw== X-Received: by 2002:a5d:44c6:: with SMTP id z6mr27580766wrr.20.1592215335464; Mon, 15 Jun 2020 03:02:15 -0700 (PDT) Received: from linux.home ([2a01:cb19:867e:2100:7eef:23e0:9210:3e8]) by smtp.gmail.com with ESMTPSA id g19sm21122757wmh.29.2020.06.15.03.02.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2020 03:02:14 -0700 (PDT) From: konrad@adacore.com X-Google-Original-From: frederic.konrad@adacore.com To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] semihosting: don't send the trailing '\0' Date: Mon, 15 Jun 2020 12:00:52 +0200 Message-Id: <1592215252-26742-2-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592215252-26742-1-git-send-email-frederic.konrad@adacore.com> References: <1592215252-26742-1-git-send-email-frederic.konrad@adacore.com> Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=konrad@adacore.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, KONRAD Frederic , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: KONRAD Frederic Don't send the trailing 0 from the string. Signed-off-by: KONRAD Frederic Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée --- hw/semihosting/console.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index 22e7827..9b4fee9 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr) do { if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - s = g_string_append_c(s, c); + if (c) { + s = g_string_append_c(s, c); + } } else { qemu_log_mask(LOG_GUEST_ERROR, "%s: passed inaccessible address " TARGET_FMT_lx,