From patchwork Mon Aug 15 19:03:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 597267 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1759780maz; Mon, 15 Aug 2022 12:08:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xDedO+KxBOXyHLARDnQy623w+bv64JKmInky1PrkOI2W86Rh5z4b77moUYgxUqpdUrS6W X-Received: by 2002:a05:622a:1789:b0:342:f439:f4b5 with SMTP id s9-20020a05622a178900b00342f439f4b5mr15396422qtk.298.1660590534154; Mon, 15 Aug 2022 12:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660590534; cv=none; d=google.com; s=arc-20160816; b=MIBhXZxTVrTlbP9RStWEHi6Edk2btUDmnyJn7Q+G8f2dho2TLeNKCvnZVb4yVwMTXw lZxWCfGogMCuyEekePHauiYCW07Ln1ecdOz6PKqbKv1+BJTCFOAFCRRhwTSxseGP0W1e oCUV2P9xEzl0VNXWl2NFKtKNsew/JyoB1JReEroJ/59LcZ/sgSf5a/BBZFGSwEmINU/Z 4SHF29JyRvTaisC/uIevBCMeBVY+vYubG0toxTaeLQ84ohQITCDxmxkmZfzP/OvBGPZ5 iICS50OzBBG7LOlZQU5SlM573jNXULYDU2IrnaxdBzt8bzLwOSqUOspheDXS4M9XP9Pe KOVQ== 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=sjyUnMJzfq++0t8oacR/+QsHL+4P2X7RJJ6Y2pg/KDw=; b=zXyaMZCiEh6G6t1erNx18sgnJ5yPKDAQ2FEpYeuWGl8L7UvNkJGL+nQmil/IgLJ7gQ OKK/mqiE8KZAuItBP2Ljtsxet1kRoCBL7pHvxtC+bgIcN029md1Vz7t4cD/cboHDIapP lat54nK1La5A9OPCGY31yMIBHuoTeyNxnnLRNYAKR3nASjk6qChRGDhWl0fdL100n8HQ K3jZhgYodRLJdjzMO5STtry2WqAih5c7TmcmZFTcZ6TqVRXHQOgXmZ/MjnSlgBirbchQ 6Tugy9/oJPJTE0VcyTHJpAwuXJzLGTBhJ3baKW1uK7LNeFzjVY9DyvVogtU6HCtW5B0S /gNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UAj+CaFG; 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 l12-20020ac8458c000000b00343719d1d3fsi6333643qtn.655.2022.08.15.12.08.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Aug 2022 12:08:54 -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=UAj+CaFG; 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]:41228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNfSH-0005NF-Ny for patch@linaro.org; Mon, 15 Aug 2022 15:08:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNfMy-0002uL-T6 for qemu-devel@nongnu.org; Mon, 15 Aug 2022 15:03:25 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNfMp-0006KM-Uy for qemu-devel@nongnu.org; Mon, 15 Aug 2022 15:03:24 -0400 Received: by mail-wr1-x42f.google.com with SMTP id j7so10093024wrh.3 for ; Mon, 15 Aug 2022 12:03:15 -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=sjyUnMJzfq++0t8oacR/+QsHL+4P2X7RJJ6Y2pg/KDw=; b=UAj+CaFGYzEL5D7ZNriTDW2N797k1BN6Unm69rAFCPmO2hcVm+vkEeESdpQJ6eSDQf AFbHWqnSV/jqgkVJXkdIaFvvolSyadh41KMoII2FTx3yLWKN4Q+WY/a8snn2hc3A5HLm BRgGkdFRvSJ60eajasO4kykeAl7KzDv1TdHFXmvJNJClB1zbSTujppZ/nMfZw4KnHxb8 d8qlOnKn2f5ihClsar14O9GrtYNL0ooMGtI/vRjEb0bTsGRVR7mK7S8hUQ2053nvuMge 5QIcmJhcO9ZqM7UsODkBMXrCho6owfYQlNq+9onCMZjFg9ynF3bBepJqQ6E97fHrOI1D 1fLw== 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=sjyUnMJzfq++0t8oacR/+QsHL+4P2X7RJJ6Y2pg/KDw=; b=moWorx0d1jmC66CamXLOVQZ97tbTBbXTvVYshf1bRW+Igo++LigIdiWwtXNAwc3H3y +ZvXqbkhkmVUtEGESNcKiHJyRpU389XCE/y5YtJtDeU7t+QGF10g+AOvhXXriMp4xOwJ Ok8Xk8QRyl5oVzCWbK/sN8EbNVXY2j086zBOj+OqGPxnkNF4aorC2EljZxhr59ZHCuzs QpAk5RY4yQx0uzWqqoztKty6jKe0lthMn9It787ShBl6bNrQuojXMr7TR1HuuJRGupFs Rk+0Taf/OGJhjqHICPH9f/TeUoM9kQu6ePKLN9mfBh285qSPzv9PEG52Ve8IgxkpjcXh wJzA== X-Gm-Message-State: ACgBeo3EiU/RL7BqmMc+PeKjkBm8d3eLwhe+EHNZbu/X5DJ8RcNeFJpG xVsf3HfTnct5zW/p/q5o5+uWnA== X-Received: by 2002:adf:f7c7:0:b0:21e:fc10:b81b with SMTP id a7-20020adff7c7000000b0021efc10b81bmr9854483wrq.51.1660590195164; Mon, 15 Aug 2022 12:03:15 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 12:03:14 -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 5/7] target/nios2: Honour -semihosting-config userspace=on Date: Mon, 15 Aug 2022 20:03:01 +0100 Message-Id: <20220815190303.2061559-6-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::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no 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. nios2 semihosting is not implemented for linux-user builds. Signed-off-by: Peter Maydell --- target/nios2/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 2b556683422..d1786b43a69 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -817,8 +817,9 @@ static void gen_break(DisasContext *dc, uint32_t code, uint32_t flags) { #ifndef CONFIG_USER_ONLY /* The semihosting instruction is "break 1". */ + bool is_user = FIELD_EX32(dc->tb_flags, TBFLAGS, U); R_TYPE(instr, code); - if (semihosting_enabled(false) && instr.imm5 == 1) { + if (semihosting_enabled(is_user) && instr.imm5 == 1) { t_gen_helper_raise_exception(dc, EXCP_SEMIHOST); return; }