From nobody Tue Feb 10 23:14:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1651608381; cv=none; d=zohomail.com; s=zohoarc; b=WEUkHgO8H8TK6pc7bgGCet2qUxS21680t6b6mB8XlaVhxy7d0iG8tbQ+FmouWRvK9dZVs5Fec4p2Xqhn21eHiB1OdVZpLIAIkbzwYCI5DEblXzO6nsPA4GDmIRMdEYWhQ7oVJonU3rfky2vuyzFbclnDEoTKi/OCWdz/ZKbxytw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651608381; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KTqJr1ojr+Avm6OwJN9PAVJEmcUCfXozWTlyiMGyM9k=; b=G7F3bM1uRtCo3d9s7snNRypGv6p+OMORHOLvbIrsUTQGEnTUSV0Y0iinwdKLE3L2ctPwKShrtctqlif2G6rBanKu83TXESRZpUOHZqdxKLoPVBJQlT3L16X7m5KEac66hq1nz3rYokazPmcjqrmn9VVjucUHBeOfLBXxf8vmphA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651608381446383.6007753753329; Tue, 3 May 2022 13:06:21 -0700 (PDT) Received: from localhost ([::1]:51574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlymo-0008MD-L7 for importer@patchew.org; Tue, 03 May 2022 16:06:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyWC-0001jR-Um for qemu-devel@nongnu.org; Tue, 03 May 2022 15:49:09 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlyWB-0003aL-4r for qemu-devel@nongnu.org; Tue, 03 May 2022 15:49:08 -0400 Received: by mail-pl1-x62f.google.com with SMTP id c11so5631053plg.13 for ; Tue, 03 May 2022 12:49:06 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id p11-20020a17090ad30b00b001cd4989fed3sm1712383pju.31.2022.05.03.12.49.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 12:49:05 -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=KTqJr1ojr+Avm6OwJN9PAVJEmcUCfXozWTlyiMGyM9k=; b=odW9mdNF/Ot9avhe8ntqbHxp+eu0osB+bvU1Co8fY6ibEH5dDUmkmzIXdRqLylxpGG EWSRmZWY3VdsN/CZ39jX66HOlVKzDdHQV9I52BsfjBJ5nnAHEfDtUBiX1aIyx4lfLowz CUMxT3WmF/Qn0LPDc87Q6HMcgekLsnL7eQnI22VnrG5kUBmAd4NNVLvejdH6tyKOJEBV l/FCRU9hr1sqF14k4YG8hV1wRyIcAD6KtYm7RvqkeDR681CwmBpMTqAVJaqAe9nA22u7 BPNSOe/mij4Y6hr7KitrgezFXFJY4cd+eFdGOesJ7/4hXDjG/mylzsy6sdysHcZbHZIG ze5g== 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=KTqJr1ojr+Avm6OwJN9PAVJEmcUCfXozWTlyiMGyM9k=; b=NDUAoF8XlNTq3BGoTIBEuPeXgNe7WUQ3C8wVNvR2U2LomWUIAWov3FlUjsJuVaDVjV VZGHYNFVQgVin8fdjfcz5yTl9g82Hq1Ws/7ny4fb05MjrVpk8IxC8LWpy5o0Yi18MmMF duzUr9ZkrusKAxXudMOYzvlx5uogRZ93av8NGEOb/RH+9cWVJmbGXpqv5pxRIKlilefU 0L4D/S+L8Xm3OQjFvhwywJint2ooUSRLKupc/tta/yFUcsq+9mUe5fuTRce0ySCbiOqT CZpq5FEEZf+QzATBaZ1wNkxPncPGr/q4XuOJI4ZCSSRLmJ7ZD2VYCJKBRS8V2t8kvQX9 DT0Q== X-Gm-Message-State: AOAM5325j9RK6HGrg0g1uU5tITfo273lYZQU+nvuZaFwTMvUNPAYnYJh YxGU0bve2V81tMFRSx70LLcWdK+dIBJ0tQ== X-Google-Smtp-Source: ABdhPJwJPxKYZAKDo+7Bovvb5DhkMBl2T2+J2sbqjZGli2zzmitn1/oHyvlsThYh9jqI0Mohinpciw== X-Received: by 2002:a17:902:8c8f:b0:15e:ab1c:591b with SMTP id t15-20020a1709028c8f00b0015eab1c591bmr9453232plo.171.1651607345699; Tue, 03 May 2022 12:49:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 20/74] semihosting: Move GET_ARG/SET_ARG earlier in the file Date: Tue, 3 May 2022 12:47:49 -0700 Message-Id: <20220503194843.1379101-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220503194843.1379101-1-richard.henderson@linaro.org> References: <20220503194843.1379101-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1651608381844100001 Content-Type: text/plain; charset="utf-8" Moving this to be useful for another function besides do_common_semihosting. Signed-off-by: Richard Henderson --- semihosting/arm-compat-semi.c | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 3a740482f9..49f976cbc5 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -181,6 +181,32 @@ static LayoutInfo common_semi_find_bases(CPUState *cs) =20 #include "common-semi-target.h" =20 +/* + * Read the input value from the argument block; fail the semihosting + * call if the memory read fails. Eventually we could use a generic + * CPUState helper function here. + */ + +#define GET_ARG(n) do { \ + if (is_64bit_semihosting(env)) { \ + if (get_user_u64(arg ## n, args + (n) * 8)) { \ + common_semi_cb(cs, -1, EFAULT); \ + return; \ + } \ + } else { \ + if (get_user_u32(arg ## n, args + (n) * 4)) { \ + common_semi_cb(cs, -1, EFAULT); \ + return; \ + } \ + } \ +} while (0) + +#define SET_ARG(n, val) \ + (is_64bit_semihosting(env) ? \ + put_user_u64(val, args + (n) * 8) : \ + put_user_u32(val, args + (n) * 4)) + + /* * The semihosting API has no concept of its errno being thread-safe, * as the API design predates SMP CPUs and was intended as a simple @@ -506,32 +532,6 @@ static const GuestFDFunctions guestfd_fns[] =3D { }, }; =20 -/* - * Read the input value from the argument block; fail the semihosting - * call if the memory read fails. Eventually we could use a generic - * CPUState helper function here. - */ - -#define GET_ARG(n) do { \ - if (is_64bit_semihosting(env)) { \ - if (get_user_u64(arg ## n, args + (n) * 8)) { \ - common_semi_cb(cs, -1, EFAULT); \ - return; \ - } \ - } else { \ - if (get_user_u32(arg ## n, args + (n) * 4)) { \ - common_semi_cb(cs, -1, EFAULT); \ - return; \ - } \ - } \ -} while (0) - -#define SET_ARG(n, val) \ - (is_64bit_semihosting(env) ? \ - put_user_u64(val, args + (n) * 8) : \ - put_user_u32(val, args + (n) * 4)) - - /* * Do a semihosting call. * --=20 2.34.1