From patchwork Tue Jun 7 20:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 579423 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp5572353max; Tue, 7 Jun 2022 15:34:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4vv7BC1iLLrXKiy1nBBoooZ7Di0/lUoQ6GWkoVIdryBxjl2YqYeE2p+gSs4iduJIrJcea X-Received: by 2002:ac8:5805:0:b0:305:0:7b3d with SMTP id g5-20020ac85805000000b0030500007b3dmr1425824qtg.46.1654641297878; Tue, 07 Jun 2022 15:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654641297; cv=none; d=google.com; s=arc-20160816; b=W4VgQbUwCcZuI8uPa5+rLCgdV/d0iiuVECSaenKy6GUJoHkNjXBzFqgZj9jjeWerdI 2w+xm/Ko6l9uSgP/UwSu2EWhyf1HBNAnS+hVxcvj1LTICdTDyodOIqJxAl6QhOcf1xjD DZTDOf56Ouc2MdmzGJx/v2uY3moUSpHIKs4Dp51eDAQt7gS2L9U81YNi4t1L1XtUmfnU lA0pnaA0RLAj78CuNj74cerBp9TLgtUctO6Su5gJuv4QdVij5KF6YuVSxtCmoVxyiJRW RcC1vv4TFhZLDFM9dpyE+2+QtIJ7vo+R02AZX28cuL8nDZ8oQqL8DoHHx6yPbif17ZcB Mz7Q== 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:to:from :dkim-signature; bh=ppeRKC6qAerZueLBefgCmuJe5thbQMtdR2XWJoewkwU=; b=d3jF1SpfgB42kwP34+xVLzTT5xt/Rxp9d0LFzMc8omxNPOtzcBlorq0VZ6o5sKKRP3 Keey6XyPivOtOFZYN8fxkidudaGEaTdIoMoIks1jxgsRqghLXlTeR7mizuSEJNxBTDW1 2Pdt3HF3Up5Kj7taxKkCVEjjIkQ1d7TPec2x1+Mq/Li3T9bdk+xJ/edK/Updmao8ue2e 3KDhP/VDMl1ZdY7NZfNG+5Cpga/e/OItxt/JAw9EdJopDev93VApgAJhi8hcAH2ChXCY 2a7NyJJ15NSGn9PZefS5ejI6Qpq5V20YGnpreI6vme8sT3NG2iVXqkZcvKZzIRaBzbjZ lu0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l1eiWw9v; 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 fq8-20020a056214258800b0046bafaee245si2710521qvb.259.2022.06.07.15.34.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jun 2022 15:34:57 -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=l1eiWw9v; 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]:35908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyhmr-0008Fu-Fh for patch@linaro.org; Tue, 07 Jun 2022 18:34:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyg95-0005h9-U1 for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:49:47 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:47036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyg92-0001pV-A0 for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:49:47 -0400 Received: by mail-pj1-x102c.google.com with SMTP id k5-20020a17090a404500b001e8875e6242so5710596pjg.5 for ; Tue, 07 Jun 2022 13:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ppeRKC6qAerZueLBefgCmuJe5thbQMtdR2XWJoewkwU=; b=l1eiWw9vLIWgWaKfbqmmmmUYAOhIdZOUGLDrls2J/zgJiA5KDhhf6TB4Uj0+bVVqAx zKrl58iU2z5gUKEpCZyaov0bu6C5QWVZCvycg9P1Bg/QqUcEQb7StZOTD+TFPovSg86R hM/3g9ZiwR1CQvTilSnt2xAeM6OiEJXHQw/px0J7Ew5GFHhf97pi2M/db8SQ8tdM+oqp t5HzzfySvLXkxb3L6WU955S9srXWffhlJ5Rqzlk7UJ4QHzZPrxBBXkOVWefWvaPekJGv Yt+uOPniKmViO6M+JDC2708QBJqvm+4XohugOJInwzrnaKuMRIwVuuktHMmuRwg+0GE4 i/sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ppeRKC6qAerZueLBefgCmuJe5thbQMtdR2XWJoewkwU=; b=BFZ5qZVCxQJILTMBaZacYH99od29z6Hbd8JkVkvoEp/cT+CT8Ir0cIMkpp8pAeo7Ux nNwfDS7B184umiU5dCeorm9p9BuvXwRdf4NVUXqN8FXV+9vP/nf5LrqNz/5RIgue1r4p p0IUnghf+f6c0Qur+WTn9lKo5Jw+/CRDCrR2U4eJzOwrA6qt80ay0fvvjVKTkWOCQLzT s2/DiBA4XaERY4gYLiX8QgiATyxuVcbjdYEEM03vM9BUufc+8YycI9BekKVpB/RRLYUf B985wrZWHuCFq5+H5gc0JsT/vxuTsQ6ldBS14iQjsCY3HQG44n6ZHR8ahK2Q1xFm2X8N 7yTw== X-Gm-Message-State: AOAM530svM1VEEN/rAoacVzvI6Tf/E9HMxal/wkEPCIdTRTb5Sf43CY8 OOaghGg/FtfUv8/kFEh0sx0Jk8rlSwn0cA== X-Received: by 2002:a17:902:e804:b0:164:466:e488 with SMTP id u4-20020a170902e80400b001640466e488mr30933793plg.161.1654634982958; Tue, 07 Jun 2022 13:49:42 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:3cf2:c634:5b19:25f6]) by smtp.gmail.com with ESMTPSA id 128-20020a620686000000b00518b4cfbbe0sm13152327pfg.203.2022.06.07.13.49.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 13:49:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 49/53] semihosting: Use console_out_gf for SYS_WRITEC Date: Tue, 7 Jun 2022 13:45:53 -0700 Message-Id: <20220607204557.658541-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607204557.658541-1-richard.henderson@linaro.org> References: <20220607204557.658541-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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" Signed-off-by: Richard Henderson Reviewed-by: Luc Michel --- 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 4c8932ad54..dea5b2de8d 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) { @@ -419,8 +427,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: