From patchwork Tue Jun 28 04:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585559 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp544399mab; Tue, 28 Jun 2022 01:23:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tAOksgOtcftD0U88JtkFr/Pl1M8LqjHX8x6SbfBmoru/Z4/RTzUx8HgJnomXVRphTClfbF X-Received: by 2002:a05:6214:5085:b0:470:5bed:5bfc with SMTP id kk5-20020a056214508500b004705bed5bfcmr2628267qvb.54.1656404615174; Tue, 28 Jun 2022 01:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656404615; cv=none; d=google.com; s=arc-20160816; b=G0lsDXmwbMOe1jiSv3BXSqs4MHhn6FXNzXDiiyHvk8DssOdHLIHlJdNiFexEIiAOYS E8w1RXebwFDkz6+wqFz6vhZSP9F52ae2YXOCjbsFc93wkxz5K/8q0WAFX0Z4YAT5vCqw DiL1/nv75gb5K1XemPQtuRLoG1UZ9THt5vATMZbZB9QpsrAr7xjG7etgCh6q09Ge9zAN 0HeERzfi/QArjwmISTfC9fZma16qm1NcKV6Fb7WjZ+PubYH/NodnyMzmOYJZzrcuH90G 13I3XhBv2WTyZEL+tmB9WmREhL6mIMqpJ6PhT94FajwNbLvficRC3AT6b+5JeJNqfSeE UKww== 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=wM0GjsxkSw3jZSEeWPTbzsq2rsJJyzwSV/fI9isMOSA=; b=Iqzj9wObgHSS0bNKCvoUk4PaGbwebIm391Hz8yaYSwgsbHM5TmyHrV7RXImMfFlGwI /4CrMV4V+CQWy0FnARev1W9+oi4oC9G7RFG48S5Y5TGJOtwSl/1RSZhOh58EIZ84yhYF Kc4ho2tk1l01tXbL1ScksjdDdko6ghQ3yTM3ompdi+FIXFoduoz+D6rdangINagnrxTT z8Ztkw+KypgznIBp7qkT8rPTLVe7uAEeMlKjNR3odDBfKlCRrhT29/3EN9ay0KPCuJLr LLtUDLbROxXQTyfhMlbobCSN4KUM8no/LYDswpMt0oqgjoQZ+kcD6498VHLPaJfsjeV8 DBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q6X4+tVD; 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 b14-20020ac85bce000000b00319fe79f832si2584836qtb.573.2022.06.28.01.23.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Jun 2022 01:23: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=Q6X4+tVD; 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]:46824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o66VS-0006Vr-P9 for patch@linaro.org; Tue, 28 Jun 2022 04:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o63Jj-000240-7G for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:59:16 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:35591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o63Jh-0000Xd-OS for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:59:14 -0400 Received: by mail-pf1-x42d.google.com with SMTP id x4so10975568pfq.2 for ; Mon, 27 Jun 2022 21:59:12 -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=wM0GjsxkSw3jZSEeWPTbzsq2rsJJyzwSV/fI9isMOSA=; b=Q6X4+tVDZu542rRxiyXP/DmQEVgL3f8z2r9ZH6MiYFpjWSekZlA2qceoD9aO5bnvHw hmuXuvuQXFmOKnKZG7ExJt8SRLaqZcafVVvUmo/KHHoTZ4OEpSVuHTI5Z0wEh00hDe4b bybj/S158j3hKzIrrbjbt6TvEvoDXxJoe1j8cDTueJL2z1TsygxNglbJE19DH5zjL29R LFotj4Pa9DSvck+YheZWBh0BZLFDek+sLKebpN+1BHwv0pF5AZbqe2fWPYMpxFR0BdhC CjGJaWS+5sWxCiMx/awPAk4eiGGEqGe6QVqlRtq7MpUp2XTI0sPKc++9NZT89PBCy1IB gXQg== 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=wM0GjsxkSw3jZSEeWPTbzsq2rsJJyzwSV/fI9isMOSA=; b=SRaB7s7BBLebzZV31cfsMJY2kUZvBUlX57DEaZFC0AG5NXcshR2zPb/mgSXdVY4J+J 0a6HUyMtzitE/9slgUTgaWEJIXHlt/DeK1PuNWKr0UM3VIWCFciZvHhbZL5DSkkWNiCO pZt/h1PFy4/c8PhB7JHtcyen0P5bq2eTmrsq7y5qsKtlGHh44xiX6RbKCnoYpBSukqnL bUZbJ5SNFOgBWKbg+ONH4qTq4drouK/IRoW/7E80V6yEbYyebIubIfY/Wnk2/jKQlpBQ zWrysqlorua738/O+aT7GtnadXFzHbvO82NnOKZZP9r3lFP3PK7dtYCmws2KbdSIsh2e 4PDw== X-Gm-Message-State: AJIora+DAbEhOo5NWH63JmbEay0tXpJ9XPjfAexarnkdBYQmsXwaaXlw Piy6fyjxV0xPvvhnoLpk606KP3t+JPtiXA== X-Received: by 2002:a05:6a00:889:b0:510:91e6:6463 with SMTP id q9-20020a056a00088900b0051091e66463mr1708175pfj.58.1656392351360; Mon, 27 Jun 2022 21:59:11 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id y7-20020aa78f27000000b00522c0a75c39sm8259686pfr.196.2022.06.27.21.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:59:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Luc Michel Subject: [PULL 49/60] semihosting: Use console_out_gf for SYS_WRITEC Date: Tue, 28 Jun 2022 10:23:52 +0530 Message-Id: <20220628045403.508716-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628045403.508716-1-richard.henderson@linaro.org> References: <20220628045403.508716-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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" Reviewed-by: Luc Michel Signed-off-by: Richard Henderson --- semihosting/arm-compat-semi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 9d4d6d2812..d61b773f98 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -228,6 +228,15 @@ static void common_semi_cb(CPUState *cs, uint64_t ret, int err) common_semi_set_ret(cs, ret); } +/* + * Use 0xdeadbeef as the return value when there isn't a defined + * return value for the call. + */ +static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err) +{ + common_semi_set_ret(cs, 0xdeadbeef); +} + /* * SYS_READ and SYS_WRITE always return the number of bytes not read/written. * There is no error condition, other than returning the original length. @@ -341,8 +350,7 @@ static const uint8_t featurefile_data[] = { * 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. + * leave the register unchanged. */ void do_common_semihosting(CPUState *cs) { @@ -420,8 +428,12 @@ void do_common_semihosting(CPUState *cs) break; case TARGET_SYS_WRITEC: - qemu_semihosting_console_outc(env, args); - common_semi_set_ret(cs, 0xdeadbeef); + /* + * FIXME: the byte to be written is in a target_ulong slot, + * which means this is wrong for a big-endian guest. + */ + semihost_sys_write_gf(cs, common_semi_dead_cb, + &console_out_gf, args, 1); break; case TARGET_SYS_WRITE0: