From patchwork Mon Aug 15 19:03:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 597272 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1766954maz; Mon, 15 Aug 2022 12:21:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR48I7ImhHb7Yo1xzxNKbodEzPMRnMbAeS5kxEBKmSOdHQbmPaP91DV2aHETzKD7SOiVCtcS X-Received: by 2002:a05:622a:392:b0:343:738e:6f6b with SMTP id j18-20020a05622a039200b00343738e6f6bmr14138768qtx.174.1660591292179; Mon, 15 Aug 2022 12:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660591292; cv=none; d=google.com; s=arc-20160816; b=OAgayxfAtR1ugubSXoDQ94UshMpbc8M0b+8WktOM47dwGaCBoOM4pJyzNl8NP3aySA iZviNCTRMbLLyc5o1p6cbiZUZ8uluWlAA29L9NTretTiOqaRw8xu6+r2Oqm72jBn1mte 4IMHLb4rj26oXl4xZAUadlzR/YY+Z20XIVLvO+Azq3ae8cUOqDQal6c+znBL7AATbxhe vRjgn2jpyEwDub9XKdqmOq2g/cVBPxVpiJDFk48uDJe2lGA7vrBMNrdzpN66VrU3Eefe LEvibDjY7lbwDVVtw8UzVsmZLcy4cAB/8I4AbD4iIs0jo8+W3+K5cex5x/4vcC8elg/A tzlg== 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=5A8TTs3Va2xGJWkOhhlXWoJrKWuE9dh71r64qnA1hXg=; b=oAKPBsNWg6Ve+gFITmbf+c6PIfCevaVemTc84z8wRwXaSXExnR5cgTBkS9JxWGCNTA 2HQKHiBqNy7lvhcOH3M0SQO7j5saQqUxHVoYvJiYbN9OVHQkxICPMUKJAAiGNWIN5ZuS awb/rW7pOd6N2NgvwqBuYfcKjEEZNWS4SRUMxry/mc/wa/u1iKmaK0bS9sE2+X9jm9JI dtwMgQ9VT0b+86OPwn+bbpSvGW7GuDkM/sFA5ATmQbBzuwLTUqSpuaKifwPewG/7wQZZ vT3Dan47YXWXj1rXQ0AdUPpMV2YIb5IYykNcroOWm/oCO8wkaiuLO3W9XsmdHT0vi/Lm 419w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TeWQ0uXT; 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 d2-20020a05621421c200b00476f452b40esi7076618qvh.532.2022.08.15.12.21.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Aug 2022 12:21:32 -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=TeWQ0uXT; 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]:36356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNfeV-0000pm-Pa for patch@linaro.org; Mon, 15 Aug 2022 15:21:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNfN0-0002yN-TY for qemu-devel@nongnu.org; Mon, 15 Aug 2022 15:03:26 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:38770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNfMr-0006K9-MY for qemu-devel@nongnu.org; Mon, 15 Aug 2022 15:03:26 -0400 Received: by mail-wr1-x432.google.com with SMTP id bv3so10096671wrb.5 for ; Mon, 15 Aug 2022 12:03:17 -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=5A8TTs3Va2xGJWkOhhlXWoJrKWuE9dh71r64qnA1hXg=; b=TeWQ0uXTpUmhrYxNlSOllS4QmD8AgsYS2jCWVfMlAFYXcQg2q8CEwCvzAKIYG86x1g uhlmYiGFqLV0s2WRElGq4bgYA/Xs2y1MIEoJPuwfB7ZSaZ5u/hrzSiEbfRDSXu1jYuU4 ORn50gpZ/884Cr0T9N0zuAoYGNpSM3I+3PE32sDYDc2aq+xzV4Gj2uKyV2YVBgwrsGf2 E4GycyuDeNprCM8ZAfVYFljaGEvUg8Ba++BKffpBcHQR7RSLpAyjm3wFszg0IjxfLQwD CFabguJUycjq5iVdrNRfLdbbls0bRnAxaidcXMaEFrINbd2oYydBtmLnt0eX87esq+qC rlLQ== 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=5A8TTs3Va2xGJWkOhhlXWoJrKWuE9dh71r64qnA1hXg=; b=hKg0WGjBZ1hcZ3+WLZVrA6EOkkf9BROjNOwwiIsvUdgVtfNlGuIjrjcOdlqTMfK+j+ Yjjpqifh1B3KE1CMzltaKo664e8WYnD7IaCR8674mOIPN0eL5oP5jA3k5lXV+VdsTMZ/ tcNj4zvUI/sgBpGkvExeehZ+00pY3XAAVagxY0JBfjdp/Vg0zBeFmSvmdAWYCgXz0JGg ZE/4kuc9/J/GosDtBA7fPNwc9KxCjnbrycKDLBCOmIezumM83xOkWDjqIBuLW3AxOX15 f2P3N9GtrJ+0eTIVteeyR3bdhA/GmtJlHcXCKScTLRSg1i9CDx5xvNknTo8L4ksPWRP4 yZAg== X-Gm-Message-State: ACgBeo1piEC5s6I6U5fJXN9oXQnj70iLIqRMbuRmICcBqXqbBsRarqj9 wuUXW9+9Zvt1wiHXkcdUgFNfjA== X-Received: by 2002:adf:a448:0:b0:223:a061:521b with SMTP id e8-20020adfa448000000b00223a061521bmr9765234wra.695.1660590196996; Mon, 15 Aug 2022 12:03:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u4-20020a5d5144000000b00220606afdf4sm8009162wrt.43.2022.08.15.12.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 12:03:16 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aleksandar Rikalo , Stefan Pejic , Chris Wulff , Marek Vasut , Palmer Dabbelt , Alistair Francis , Bin Meng , Max Filippov , Richard Henderson , Furquan Shaikh Subject: [PATCH 6/7] target/xtensa: Honour -semihosting-config userspace=on Date: Mon, 15 Aug 2022 20:03:02 +0100 Message-Id: <20220815190303.2061559-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815190303.2061559-1-peter.maydell@linaro.org> References: <20220815190303.2061559-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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" 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é --- 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