From patchwork Mon Aug 22 14:12:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 599117 Delivered-To: patch@linaro.org Received: by 2002:a05:6918:5e84:b0:d4:ea33:5523 with SMTP id nd4csp1789708ysb; Mon, 22 Aug 2022 08:25:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+nfq9suB0ftEgybwBNK3cxjQ7n2Tg7wmkXpdUiabDTV9hXjQrE3HNOsy/uGZUgXRaLnfE X-Received: by 2002:ae9:ebcf:0:b0:6bb:9646:c2da with SMTP id b198-20020ae9ebcf000000b006bb9646c2damr12833210qkg.92.1661181949606; Mon, 22 Aug 2022 08:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661181949; cv=none; d=google.com; s=arc-20160816; b=PcTQjLKqCnztK2pxYPBLBxToSJ1WXbrBW8pUnsJMDMcCLPZB3FaDlqdwc4cLSAQLCP POXvN+iUOI2UM3wVnTpTtjRj9IxCNGMa7HBIoLrtOGxk6TjBd/Bj1kIfPLFhykNziYSd QRzY8uc81fvJ1EuckSB4be7Y7cAMuspjUo1T+zOZPNwa7kxtcaeK7o0ymYsiYeFXfdSp nekZnI498nDdRaz1f4NCQXQkdK4Xp1cMJmfJIvR0he9hBznSTBk2aT68gKolrFpreBcS wk7EOrn1beh/qQhDtWyQqSPSa402XyeSC5AbD/3zuSEdmyjVbs0jKW/O/8xeTGdgV1eA vsAQ== 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=r1xWEOHWHOt3MBY5xlN7HosIZZCC0kMBbMC4Q6TASCY=; b=FpYdzmTXb7RTTCaVzw13ppkvD/rRb37D7VpvnFIJZP43v79ehCTS9iavxg8oCytzmJ KkifEKPgvJJb0bZ3yjDHfT946Qle2hFEnwrsjLzteJIIGYuebTUecKsKtQEk3SEzL0gH F4JBObGUzqxTx7O6Qom8mwjpxj3NvXBbOW/eZTuNuMkTekuAs4lico9HwhLqeEBtVE8P Xxv5rvkGyOEQdnW161XamQzMfjcDaXAnkFtbFEtMXQHLGhrmbd6baOI2wIWyoqJ40cs3 BF9jmXKUYdIv40RVvZmG1+6XfeND0V3t5NnZm3CotPH106sEDPC26afuZmbYWjwdfG7g a1yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TtwXxZPj; 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 de19-20020a05620a371300b006bc320e86e0si373300qkb.635.2022.08.22.08.25.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 08:25:49 -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=TtwXxZPj; 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]:46978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQ9JF-0001gQ-2W for patch@linaro.org; Mon, 22 Aug 2022 11:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ96k-0003g1-OY for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:12:56 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:53839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ96V-0004Jf-4G for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:12:54 -0400 Received: by mail-wm1-x32f.google.com with SMTP id h1so5757713wmd.3 for ; Mon, 22 Aug 2022 08:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=r1xWEOHWHOt3MBY5xlN7HosIZZCC0kMBbMC4Q6TASCY=; b=TtwXxZPjJkqewIsyOPEc3rczi4fDZTbgvfeIB8B62EEbFXTpX1DESdezNls8TKf6rp AIz8NvnUyYX9s77mYAiAWnFsm6feHnJAHTIrgZeXP/jkJvN5qGlba3r/zLLdJ3tDKHhA r4zBpPe8IvpNT15G8mkNcbh4q0I22fukf08/3RNhTVisZG+kOhV56wAX9vkUoG/ogTqH IACPfzUAZQlgGeYEFtVE0NauI1TnrH5MTzLuUw5gAamEtV4fiQfw05jQxc7bZPErslOb T3IP+GPs38Oaq8Qm4J2z13whK6zI9fVSj56hCs/6U0EdkMp/zpm4TyYS7SD/8UduWIZr q6ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=r1xWEOHWHOt3MBY5xlN7HosIZZCC0kMBbMC4Q6TASCY=; b=A6X0/0FG8x1TjCTfyHwCRSAgaSqv96fpX1ZDYY957A7WW7bHhtDbSRngBe7KUQtjI2 8oc014mtaz5z6jKnZ3zbz1Ta6cz2nLZMCjsupFPfmYTawlEEIxjMMvBbiY9wDnIe42wC KVZVe7OY+plRuSLzOuZsBAUU6U0TYpbGCAKeKxv0wLNcJzz2dCZG5wsp3vPF/5iwn+Kh dcP0NEMmOh8YKYbW09hSnweO7NiEyW8w6FGMMADlBQX4r3B4BHYNkp3bZv35IsBfVXYD ifPZSoPOxPG9bOOczNpdgAVfR0XJoI9bUBQ7ZVEHKMG3manpgDUkkgKYCvsNwZ92DSm8 wf8A== X-Gm-Message-State: ACgBeo2IC3cod0ODce6KNOtubHY6crEeSQNk8H3yYyePNclV2nJ4NGJT KkLFb9o1y9An9IAKzCuKMEMp69u0zUJYrA== X-Received: by 2002:a1c:7c08:0:b0:3a6:2569:4986 with SMTP id x8-20020a1c7c08000000b003a625694986mr12318271wmc.117.1661177561665; Mon, 22 Aug 2022 07:12:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bh16-20020a05600c3d1000b003a3561d4f3fsm15184908wmb.43.2022.08.22.07.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 07:12:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Richard Henderson , qemu-riscv@nongnu.org, Palmer Dabbelt , Bin Meng , Alistair Francis , Furquan Shaikh Subject: [PATCH v2 6/7] target/xtensa: Honour -semihosting-config userspace=on Date: Mon, 22 Aug 2022 15:12:29 +0100 Message-Id: <20220822141230.3658237-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220822141230.3658237-1-peter.maydell@linaro.org> References: <20220822141230.3658237-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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" Honour the commandline -semihosting-config userspace=on option, instead of always permitting userspace semihosting calls in system emulation mode, by passing the correct value to the is_userspace argument of semihosting_enabled(). Note that this is a behaviour change: if the user wants to do semihosting calls from userspace they must now specifically enable them on the command line. xtensa semihosting is not implemented for linux-user builds. Signed-off-by: Peter Maydell Acked-by: Max Filippov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/xtensa/translate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index dc475a4274b..43d55989349 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -2360,13 +2360,14 @@ static uint32_t test_exceptions_simcall(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { + bool is_semi = semihosting_enabled(dc->cring != 0); #ifdef CONFIG_USER_ONLY bool ill = true; #else /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */ - bool ill = dc->config->hw_version <= 250002 && !semihosting_enabled(false); + bool ill = dc->config->hw_version <= 250002 && !is_semi; #endif - if (ill || !semihosting_enabled(false)) { + if (ill || !is_semi) { qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n"); } return ill ? XTENSA_OP_ILL : 0; @@ -2376,7 +2377,7 @@ static void translate_simcall(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { #ifndef CONFIG_USER_ONLY - if (semihosting_enabled(false)) { + if (semihosting_enabled(dc->cring != 0)) { gen_helper_simcall(cpu_env); } #endif