From patchwork Tue May 3 19:47:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 568977 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp9784058map; Tue, 3 May 2022 13:11:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh0ZxbWDA1XCCrA1LM/RY75Cb2mNF8CF+aKVJj5z4h/lPaVAuleN4x4EB4DH97XmDlW3W/ X-Received: by 2002:ac8:5f46:0:b0:2f3:371f:7cd with SMTP id y6-20020ac85f46000000b002f3371f07cdmr16690233qta.94.1651608719008; Tue, 03 May 2022 13:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651608719; cv=none; d=google.com; s=arc-20160816; b=hl4VQo+VJhpvNmiJ4/UVLvk37Wkw13jGniY6dsG2GUuFGQcRcbSG4ass7y9xo5fh24 3K5ulqqPx3dfc7PfZAgNlDqfJq2ObnxQHaD3QlSstdDM5qO/NOg3kRtffPVAzh5zueT6 VlUNH01pjYe5XWoVztnX73ZejeNyJ3dL57+NHiNSA0HLoLMVvlqgHWhC8yVO4kJxy1uB t0mCW/fL4gfHo2bOUxS22F2qjbb+NBCvjcyWkm4ZV4NiGJ+SAXFYS+SXwSMsiY2waFtY Mmgitn05xVMYodTvlNjYErYsy28zlN28wYL/ugpOsRmjD099yoBe/TBTWazxR9Ds2ab+ oZ4A== 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=coOzTtMwr9rrGl+3cyhDbkXBtamsk22lDxbutCmvHoo=; b=WCZiv8tH21Nff2PX/KlYR4BzooFpVuZJmxEzKZqhDObLIOk9VurFhw5fyCIdy/U1Tv L2X62eJ0W4mfDEkQKSdnTlDuLGAlqEQzytk9KySYnd9eWguEgD6vGUVN7UUFif60yT/Y n05WJ1WLFD00npb3xB13LIMTb+ncB86LmqHOyYpooSkWr92ak15bnkifxMJil8G+ZlTl UWmGF4kddngsZKB2uXOiEtI0kf1RaZ2YNOjQxaMzuXYzTKznhi98gQuCXe/e3Lr7T/ld Rjl93y/1/zrY67RWbwSocMtg0GVTXGZ6f/zsAU+vEFjOjAlcKC2xppB1eIBL70PBmz5w kqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ABLpqbmL; 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 f18-20020ad455b2000000b004561657079esi7762349qvx.224.2022.05.03.13.11.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 May 2022 13:11:58 -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=ABLpqbmL; 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]:35258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlysI-0003CC-Ip for patch@linaro.org; Tue, 03 May 2022 16:11:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyWA-0001ad-9V for qemu-devel@nongnu.org; Tue, 03 May 2022 15:49:06 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:42985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlyW7-0003Yr-98 for qemu-devel@nongnu.org; Tue, 03 May 2022 15:49:05 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d22so5697110plr.9 for ; Tue, 03 May 2022 12:49:02 -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=coOzTtMwr9rrGl+3cyhDbkXBtamsk22lDxbutCmvHoo=; b=ABLpqbmLIoquJFUWi+oSPoFUFfiF7nk7imQAanAZPuu1+Vxsy7Hf4rSQSeayvWro0U HShbzROH+ZuHaxWTV+FVC287e81nDwtXaPjcnXsMph7pvWwZCRSz88QAlr7MAv9Dvx/z AHAIXnvlRsdErNhdHCOJanZZVIs6OfLoXPZORGUnyDwbH93FaKiYnzG5NHYQPHodSBS5 Gs2GoANWopj/KAOCXAZg1q5OpM12/+hVsEuQHCPpl2/52eN8vm12toIjXwsEh/jTCKfW toTjpNQy6WhkbDCnFWrV7mARI8Uh/oXwP6ZZCPetvb5GS2In8ATFRhcP8KZ7Un0dRfJ5 tBzw== 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=coOzTtMwr9rrGl+3cyhDbkXBtamsk22lDxbutCmvHoo=; b=P+TFdeK6QdBNSpihgsaeh/27bqEsrXKFOUqaHNqQeSdW6vVvvPciewTpTMviCzqn+o JT08A9W/8OpQBHeHsljfLXX/t98rhgoOUueLxY2Sjkh6bH9W9/kjDsGbTlANPcgM9xZH vW+2Na7nssHUBJgHh0S69Vm9sb+w4wU9cYYqcmsc7WKh3ZXaWiyzvoIB+ljBLpKuijsA bQX2pwWtC3s6V+rBMON8VQA9vsAlZsMsKusbn3+JqO0BnJktv6zkl9EFzLmWB9gp1cfV 1tnB5ka4LSfIV88pwARNVM166AUdFVpMJtNmCkx+d/U912A2IVZJrxdbjoCFT1/vjTJ9 feRw== X-Gm-Message-State: AOAM531u0Uhq7qVQBr1SCEH0Rp8nQSDuU2qlCe0t7ZS/vvcoDfg1K8BX uPmi+g00jf9L7SgW/qaefZFutJdXwQASQg== X-Received: by 2002:a17:903:32c9:b0:15e:a1b8:c1ef with SMTP id i9-20020a17090332c900b0015ea1b8c1efmr12299316plr.173.1651607341940; Tue, 03 May 2022 12:49:01 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id p11-20020a17090ad30b00b001cd4989fed3sm1712383pju.31.2022.05.03.12.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 12:49:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target Date: Tue, 3 May 2022 12:47:45 -0700 Message-Id: <20220503194843.1379101-17-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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" We already have some larger ifdef blocks for ARM and RISCV; split the function into multiple implementations per arch. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis --- semihosting/arm-compat-semi.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index a6c6e5baf6..7fc60e223a 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -213,6 +213,10 @@ common_semi_sys_exit_extended(CPUState *cs, int nr) return (nr == TARGET_SYS_EXIT_EXTENDED || is_a64(cs->env_ptr)); } +static inline bool is_64bit_semihosting(CPUArchState *env) +{ + return is_a64(env); +} #endif /* TARGET_ARM */ #ifdef TARGET_RISCV @@ -238,6 +242,10 @@ common_semi_sys_exit_extended(CPUState *cs, int nr) return (nr == TARGET_SYS_EXIT_EXTENDED || sizeof(target_ulong) == 8); } +static inline bool is_64bit_semihosting(CPUArchState *env) +{ + return riscv_cpu_mxl(env) != MXL_RV32; +} #endif /* @@ -586,17 +594,6 @@ static const GuestFDFunctions guestfd_fns[] = { * call if the memory read fails. Eventually we could use a generic * CPUState helper function here. */ -static inline bool is_64bit_semihosting(CPUArchState *env) -{ -#if defined(TARGET_ARM) - return is_a64(env); -#elif defined(TARGET_RISCV) - return riscv_cpu_mxl(env) != MXL_RV32; -#else -#error un-handled architecture -#endif -} - #define GET_ARG(n) do { \ if (is_64bit_semihosting(env)) { \