From patchwork Wed Mar 8 16:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 660452 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp435060wrb; Wed, 8 Mar 2023 09:06:07 -0800 (PST) X-Google-Smtp-Source: AK7set9B+xc5xwwIKWxe/BOmjEap5MLWN6aRiWiad737WAbU/0xSvsGumqTZ/SLSL2I97DlhX5Ls X-Received: by 2002:a05:6214:2524:b0:56e:a658:84e4 with SMTP id gg4-20020a056214252400b0056ea65884e4mr31544220qvb.36.1678295167675; Wed, 08 Mar 2023 09:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678295167; cv=none; d=google.com; s=arc-20160816; b=UA7HwAl1VhYy5W65lyPBk9KZD5c3gOGF3pq82sYnCJSc4pE/vnfoBvxbfl/NJQWouM 51IPGyIgor2AT53tBdXQGzdUFi4goUvgcn8DVDr21xnoKyGRcP/qBMFCczBJN/e8K7Zg jKEdNRybPgniuckkVPs7oPwKjgD+/hlPFQtIee2KXyk8NGQD3uAW9Gv2k+2zxCdpyyiF YANIvCAjErPEkD0I44rfGh9vMDMo9ODUUsN8NJh+UWLW2EUdAAJ67tXjbXiT14CTA0uj 8uQ5wXRf1t+2kz/x7G2eHmU5eupGDSe3a95vMTzdtU2Sw7VipNz6FqDSXKuOPq5FF9T4 4gcQ== 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; bh=7IKAOvrBI0gTRVGvAc5fCcX5/mDJ2sdZdOUYRZUZgaU=; b=YgfESLeKiUB0qStjs60GeAGAYfbPLWOWcnjWiCIHwwr8WkHyb6uzk52kgJYmcRAybo mEH3X3Y437qYiEKKr8J68q3c41wg8kQDmWL/DgPQQANR1HZZuWagFPAQ3Fxw4LWzYhXr YPmHnI9BWL80AiAeMz/CQIXwxs/ZNsIG7j7X0ln7q4zj5jf0npI4gyywcQZaZNbVbwtl G823uHZI6UEi1RMJfOIv/4VEEO9tb9GlOSqObmGZWq9ffdqJsZb5dbMwV0bvjNueUxwQ 80o/X1OAshplBW/UMBRxbDZxy6o3m2ojA7dktm2u/m49iYCPlE+pytI2qAY+cUyDQxMV aXmg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d2-20020a0ce442000000b0056e9c022011si12427449qvm.562.2023.03.08.09.06.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 09:06:07 -0800 (PST) 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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZx7t-0004AZ-4v; Wed, 08 Mar 2023 11:58:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZx7q-00049U-2V; Wed, 08 Mar 2023 11:58:50 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZx7l-0003wp-Ur; Wed, 08 Mar 2023 11:58:48 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id C4811400B9; Wed, 8 Mar 2023 19:58:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 8186292; Wed, 8 Mar 2023 19:58:16 +0300 (MSK) Received: (nullmailer pid 2098262 invoked by uid 1000); Wed, 08 Mar 2023 16:58:15 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Maydell , Michael Tokarev Subject: [PATCH 05/47] target/arm: fix handling of HLT semihosting in system mode Date: Wed, 8 Mar 2023 19:57:08 +0300 Message-Id: <20230308165815.2098148-5-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230308165035.2097594-1-mjt@msgid.tls.msk.ru> References: <20230308165035.2097594-1-mjt@msgid.tls.msk.ru> MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+patch=linaro.org@nongnu.org From: Alex Bennée The check semihosting_enabled() wants to know if the guest is currently in user mode. Unlike the other cases the test was inverted causing us to block semihosting calls in non-EL0 modes. Cc: qemu-stable@nongnu.org Fixes: 19b26317e9 (target/arm: Honour -semihosting-config userspace=on) Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit 9788d4c007cbde7cda1b7a577b8b836335eb2b73) Signed-off-by: Michael Tokarev --- target/arm/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 74a903072f..1dcaefb8e7 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1184,7 +1184,7 @@ static inline void gen_hlt(DisasContext *s, int imm) * semihosting, to provide some semblance of security * (and for consistency with our 32-bit semihosting). */ - if (semihosting_enabled(s->current_el != 0) && + if (semihosting_enabled(s->current_el == 0) && (imm == (s->thumb ? 0x3c : 0xf000))) { gen_exception_internal_insn(s, EXCP_SEMIHOST); return;