From patchwork Sat May 21 00:03:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 574933 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp2677235mab; Fri, 20 May 2022 17:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybqxPYizk/yWj0fhDMoB17/vzFzpx3WvXbCkmpHtWSKmlmWkZT2YRVoimP6L77fj3+JPQz X-Received: by 2002:a05:6214:1cc3:b0:456:56d:f2c5 with SMTP id g3-20020a0562141cc300b00456056df2c5mr9991732qvd.119.1653094115078; Fri, 20 May 2022 17:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653094115; cv=none; d=google.com; s=arc-20160816; b=Sz1J6R3aTt5yPPtVbJr9bqp6HhOg77Jvm4FfaPdChYC9a0rXnFJ/SW1V9v98mEswXV QKd0+Ta4Z41q5c/B/CaudRhitFK5unCNw90H+zSZa2V5TxsO5G03xkAJvXFFOznCG9OK 42eXOwfZNI6ZpTspjm2kgb29x+xiAVRZpwkOMnVnTWxb6C93K7PF6FtX8mzaPnJG8TXR 2gSgpjoxIokb+Ba5+oXmgc+iwCGWg7BA4pxbsOLB+94cc7LChDcyS2EJa4yMqWOlttEh VosHsNsMFwsp9mq/4dD4Yl2OicqIG+UE3Wm2oUMHuyi1B0N+2ndQu6uYlUFsD6jAY+Su tY8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G8jUXILSyQ3ZGWS4huZP/MGa3C/uuyreOxdJ2Jh/tu0=; b=FMNwuFd25Ybf70G1pcWTdJ+Q2nW/xoxtgxziUPpxsDlMG9BjHh8FPSWOOsXakFf85S pS5+XrbYuSv3Y0L+H/4Dm8afAjSr2fPa0u4MM0goXmKW3dQNMY1PfE8zVq/ynWtztWH2 FV7rzj3FNbW7AUEKmHSGeWC+zDl+ibIjPIJDv8ISjKvNZy3e3iJ8Y5fCw2qSpnBcdaq8 Ujjocn1yWK17ePQlvdntl0KBtRJAXMMzkCYAl1DzTpW7E29ZfjmExsbwYyI6mSqXRse6 ZkiMN2/BrfM9J6zsxalx+DfFcz5wKA23LboQFTF4RZmlFyt3UmRjUlNJfWNCEZBBhY85 XrKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n5p3Xz8Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h12-20020a05622a170c00b002f92b8e6f49si258481qtk.467.2022.05.20.17.48.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 May 2022 17:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n5p3Xz8Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsDII-0001o8-Kk for patch@linaro.org; Fri, 20 May 2022 20:48:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsCf2-00039W-HJ for qemu-devel@nongnu.org; Fri, 20 May 2022 20:08:00 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:38551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nsCez-0004aB-D5 for qemu-devel@nongnu.org; Fri, 20 May 2022 20:07:59 -0400 Received: by mail-pl1-x632.google.com with SMTP id n18so8570020plg.5 for ; Fri, 20 May 2022 17:07:57 -0700 (PDT) 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=G8jUXILSyQ3ZGWS4huZP/MGa3C/uuyreOxdJ2Jh/tu0=; b=n5p3Xz8ZQjOeUQF0/vFCpuBIhLYUi1175k+CT4X7HylP5F/Cc0+YKJZZ7jPzCdggc+ ZkAJmDzt+QfpAH00crA/UAl3t2GCW+u0Y3rPdhuSyio7odoa0U+hB18i0LotMouBd7U+ +XHOjc3a+i7BoGpCNrJtnVUCJOZmVM/HCouKqllmI89OuoGUo3eEgDgluYEKdbwYrVpf 7441asGyuIwCd27bleeIUr/ofHT9cYhr94hvMmyE7mncF5f3BElMDW023HxFndAZsYM5 gyfz4jUTvRT6ExwJSxvQuvYt2Acfr72CpjlH3uInSdAmdrNHwZF1MD1DbFYlwotWv6OC waAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G8jUXILSyQ3ZGWS4huZP/MGa3C/uuyreOxdJ2Jh/tu0=; b=510bOLYtYLPZ1NHtCXPqd9W7oTgHkw0CKdu7sRujXxLfC9maJ2e6XFBI3Nq5rcQkC0 H1eqXZKfIZ1HKeHoVj1jkxYfrnL2ngc9r2vW06dQvI2oh5N7yI0trb3yISv7L2+bW4Qf FwVAhhc0YWJb9SBx3N0KvPNdKf8NeBiF4f5XdLZ8ULS6o8HBYpadRcnZCJrpE0O5kLrQ BX8fRAoULITwksumT/cBe/tmCGfEi+F46P1SJxTiAl+4Qh+cJZp7luoQW4ybS24ln92q yrepw29PUp2flVjzAUYI2RsATjM2kTdgH7X+VjIZeUPy63DLcq4R4IBjaxLMJt/ZJ9lC E70g== X-Gm-Message-State: AOAM530fgC5Qbi+AxDV3U3bCt0cRe6Fz8E/60Evh2Zx0wQ4kcydHjAK2 Z6fp9huqPtq74GCVSVj7NnhMmMeTVr8qCg== X-Received: by 2002:a17:903:241:b0:15c:ee52:cbf2 with SMTP id j1-20020a170903024100b0015cee52cbf2mr11756664plh.10.1653091676019; Fri, 20 May 2022 17:07:56 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id 1-20020a17090a0cc100b001d2bff34228sm2517703pjt.9.2022.05.20.17.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 17:07:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Subject: [PATCH v3 48/49] semihosting: Remove qemu_semihosting_console_outs Date: Fri, 20 May 2022 17:03:59 -0700 Message-Id: <20220521000400.454525-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220521000400.454525-1-richard.henderson@linaro.org> References: <20220521000400.454525-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function has been replaced by *_write. Signed-off-by: Richard Henderson --- include/semihosting/console.h | 13 ---------- linux-user/semihost.c | 17 ------------ semihosting/console.c | 49 ----------------------------------- 3 files changed, 79 deletions(-) diff --git a/include/semihosting/console.h b/include/semihosting/console.h index d6c1cc58ab..20c31d89d4 100644 --- a/include/semihosting/console.h +++ b/include/semihosting/console.h @@ -11,19 +11,6 @@ #include "cpu.h" -/** - * qemu_semihosting_console_outs: - * @env: CPUArchState - * @s: host address of null terminated guest string - * - * Send a null terminated 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_outs(CPUArchState *env, target_ulong s); - /** * qemu_semihosting_console_read: * @cs: CPUState diff --git a/linux-user/semihost.c b/linux-user/semihost.c index f8bc8889f3..cee62a365c 100644 --- a/linux-user/semihost.c +++ b/linux-user/semihost.c @@ -16,23 +16,6 @@ #include "user-internals.h" #include -int qemu_semihosting_console_outs(CPUArchState *env, target_ulong addr) -{ - int len = target_strlen(addr); - void *s; - if (len < 0){ - qemu_log_mask(LOG_GUEST_ERROR, - "%s: passed inaccessible address " TARGET_FMT_lx, - __func__, addr); - return 0; - } - s = lock_user(VERIFY_READ, addr, (long)(len + 1), 1); - g_assert(s); /* target_strlen has already verified this will work */ - len = write(STDERR_FILENO, s, len); - unlock_user(s, addr, 0); - return len; -} - /* * For linux-user we can safely block. However as we want to return as * soon as a character is read we need to tweak the termio to disable diff --git a/semihosting/console.c b/semihosting/console.c index f6fab5933a..c84ab97ab6 100644 --- a/semihosting/console.c +++ b/semihosting/console.c @@ -47,55 +47,6 @@ int qemu_semihosting_log_out(const char *s, int 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. Copy string until we find a 0 or address error. - */ -static GString *copy_user_string(CPUArchState *env, target_ulong addr) -{ - CPUState *cpu = env_cpu(env); - GString *s = g_string_sized_new(128); - uint8_t c; - - do { - if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) { - if (c) { - s = g_string_append_c(s, c); - } - } else { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: passed inaccessible address " TARGET_FMT_lx, - __func__, addr); - break; - } - } while (c!=0); - - return s; -} - -static void semihosting_cb(CPUState *cs, uint64_t ret, int err) -{ - if (err) { - qemu_log("%s: gdb console output failed (%d)", __func__, err); - } -} - -int qemu_semihosting_console_outs(CPUArchState *env, target_ulong addr) -{ - GString *s = copy_user_string(env, addr); - int out = s->len; - - if (use_gdb_syscalls()) { - gdb_do_syscall(semihosting_cb, "write,2,%x,%x", addr, s->len); - } else { - out = qemu_semihosting_log_out(s->str, s->len); - } - - g_string_free(s, true); - return out; -} - #define FIFO_SIZE 1024 static int console_can_read(void *opaque)