Message ID | 20220521000400.454525-45-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1f0e:0:0:0:0 with SMTP id hs14csp2666793mab; Fri, 20 May 2022 17:23:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd+H7fbHX5Ft5zOFlDpsB/yKRBQEcbU4czLvAZHtX+t1fpLTAzWOxQXoNAlHHkmK4a9K5b X-Received: by 2002:ac8:5788:0:b0:2f9:1e0a:100a with SMTP id v8-20020ac85788000000b002f91e0a100amr3911331qta.659.1653092598564; Fri, 20 May 2022 17:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653092598; cv=none; d=google.com; s=arc-20160816; b=eAgt+YjysTjCCmqJ1z7tvvNEe6jdTVJQjIrbOnz9rO+JgLGvZCrF6Q8Gk1uwi3iB+Z Tv61OTLPSghu5hyGDcXfsWXhcRf/pcRNJRs6d0c4u2hxvohiC0T57d6zSWSgT2VXpk6x 6+svrhNahPeL5jc7pTOOB87FrDRp9eqE9dig4hnSgLmQQSar7oI0mGNvBHPfU9CI7FKo cncHLMSRYeyV+VMJnwFR9IQuwvETUozJTe7yqT1Wx8ZtG/3TfxjcETUtub7aZz5PNILJ /KZuu4PWMGYtltZuHmuH2r91qkMiCk6mfs5Z11oLHw6XLCiQi7nbXSyYzxzTF0bjI+18 8zvw== 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=Q7p7TZN47ATIiQ3A5Y3xH06vJfjCq2B+xHIDC9Ub+lo=; b=Ka1QfakgvwuvFQJeohRY+/DlR/vMvOvyELSiV3lybU4wZaOYzoqAJXXd0FVipmJ8cM VKrJ8SzzZEVOcUpzavEqhgLDpBdVKNt3Nj6kslnWn8QfZwWQhoZbuIVeDCCEY8mlQptp wV+NnXglcOB7cIOlMi0RyjR6EjVV75+D9NRhOLisBVsZzNjLdU4A2b/yJSQ4QiBy7U/E qSSLaK63pcrE9TtZhIirvbjupy5Ws8ijqpT1EAvIoXzIl94K/8QL+Bqk7Umwroqop5X/ Nu/YcTlWQavp81XlszXb6wDLNQir+53NFV27SaFfWMgEImCFxuzdxpiRYxELFbu2IRkU M9WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I4836iqD; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f11-20020a0562141d2b00b004621033ad31si325040qvd.573.2022.05.20.17.23.18 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 May 2022 17:23:18 -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=I4836iqD; 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]:40046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1nsCtq-00043V-5w for patch@linaro.org; Fri, 20 May 2022 20:23:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nsCew-00033d-8H for qemu-devel@nongnu.org; Fri, 20 May 2022 20:07:54 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:38849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nsCeu-0004ZL-OB for qemu-devel@nongnu.org; Fri, 20 May 2022 20:07:53 -0400 Received: by mail-pf1-x430.google.com with SMTP id h13so2692523pfq.5 for <qemu-devel@nongnu.org>; Fri, 20 May 2022 17:07:52 -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=Q7p7TZN47ATIiQ3A5Y3xH06vJfjCq2B+xHIDC9Ub+lo=; b=I4836iqDX6QoKoNTeY3XgYyWcZCv8IPJugK8o6wqtRs5gdKdT3xU1mCbymrn0dyEyh fWVt4MceeMaeiUllJk59/OunkltXn5p0HPjQ7Alhsp5cgOIz7fvE0FUDTz7TzFZAS6Qc PBC00/OHsasVF0VItTTBZce1L05YivtLd9ycQvFddjyufmp9zyt6YYn21QiAlPKaRxlL ordujAil4S2L8egD9/MN9+jZkQNWFaW5ZM5vlREiJo+R4Q1g2GNfjCtjiLY0mJfnd6ah 2F2HD0SeT2NUqIxLMIVVX/VYJPJZsXTsXpELUMUR5Ir/bdv15hzk5va0B5pJXE9G1gdr mC0w== 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=Q7p7TZN47ATIiQ3A5Y3xH06vJfjCq2B+xHIDC9Ub+lo=; b=eprIZ8BQW+GCOx6ZTbW9ZScRSngzLtDqJN8KHZkLWoUYHT9llNi5UTa8u0Z7Bm2KTy r9ZAS9Dxjr+X8kT36YLJBxQkIp/+ie6ZpxDju5BbOjQPlAyjFE0lCfOxUDHTvtvZkvkj eVCuUM+QJtFWZm0wHgMkLVnBeNam8EpJ83FOmUZNRpqErClnHEolzRMeb9Gb7jIyGuVr Mtt/Uy+AsSH2m7zuUKvSIdxQuIJYgPzIRS0LFS9tcwMYGGULcQzV7ZKPzyK7SOw4/fay RZXrZ1gPgKX9z4XveBuSJYTmmaEVKqCIg4wXtINJUOzdUYrnWhDxWMT+1vsGfIMFMZsZ XVLw== X-Gm-Message-State: AOAM531ae3IYDizHzZpGWh82mvBLcoxod7baj+e+N2wP+5AVZGCLBxL2 62VVn+XBB8JqZ6LVmmHRkWuWdlycRnmnFQ== X-Received: by 2002:a05:6a00:1683:b0:4f7:e497:6a55 with SMTP id k3-20020a056a00168300b004f7e4976a55mr12546630pfc.21.1653091671443; Fri, 20 May 2022 17:07:51 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id 1-20020a17090a0cc100b001d2bff34228sm2517703pjt.9.2022.05.20.17.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 17:07:51 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Subject: [PATCH v3 44/49] semihosting: Use console_in_gf for SYS_READC Date: Fri, 20 May 2022 17:03:55 -0700 Message-Id: <20220521000400.454525-45-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 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
semihosting cleanup
|
expand
|
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 20d97290ff..9230c69ff2 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -290,6 +290,22 @@ common_semi_flen_fstat_cb(CPUState *cs, uint64_t ret, int err) common_semi_cb(cs, ret, err); } +static void +common_semi_readc_cb(CPUState *cs, uint64_t ret, int err) +{ + if (!err) { + CPUArchState *env G_GNUC_UNUSED = cs->env_ptr; + uint8_t ch; + + if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) { + ret = -1, err = EFAULT; + } else { + ret = ch; + } + } + common_semi_cb(cs, ret, err); +} + #define SHFB_MAGIC_0 0x53 #define SHFB_MAGIC_1 0x48 #define SHFB_MAGIC_2 0x46 @@ -415,15 +431,8 @@ void do_common_semihosting(CPUState *cs) break; case TARGET_SYS_READC: - { - uint8_t ch; - int ret = qemu_semihosting_console_read(cs, &ch, 1); - if (ret == 1) { - common_semi_cb(cs, ch, 0); - } else { - common_semi_cb(cs, -1, EIO); - } - } + semihost_sys_read_gf(cs, common_semi_readc_cb, &console_in_gf, + common_semi_stack_bottom(cs) - 1, 1); break; case TARGET_SYS_ISERROR:
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- semihosting/arm-compat-semi.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)