From patchwork Mon Aug 22 14:12:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 599194 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1886200mae; Mon, 22 Aug 2022 11:49:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ksW/85gkpTGF35dDO6KFDLinlxfxx/Rqs96miOefE5Iw5YDacpMWLopXkXHWvjtKD2GOV X-Received: by 2002:a05:6214:1bca:b0:496:d73b:fe07 with SMTP id m10-20020a0562141bca00b00496d73bfe07mr7818273qvc.110.1661194185434; Mon, 22 Aug 2022 11:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661194185; cv=none; d=google.com; s=arc-20160816; b=sx6jUcPWO8qfToxV7W9Op8srq4+tWnqacQkvmOh/1MhNKkBUrVRdVxTyorF9e2vgGS g6T/KchmuEFD6xjvS8zFE3NJIerDSpBWkiKKogGmBvfgQMmA2KBHlotsfzwWwPums1Gu Iphhwpb011KG0SZlHwncU9HD6KyZbOUV3bGZbJANj511Plcr6T6yH+/ZhU9wkmiSavbT JVC29bBtkX4U/LnscshfogrEP/xabi1rxVrGnoc/F0Un31TOOShHaATSW6yt4oSZKYa8 ocj24UdLL7aegbfZaPWAtjG1eKgxb5j/46tVxLi6/EBJaO6puVimcIP4E9rTASKy6jmw zB+w== 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=otAuKbBd7la4jsEiv/+EcRkvB4vfTN2cbw4MQWM69+A=; b=SXHsM4Glvn8vWx2NnFF4MK+baegXUfDjX8MHrYtdA/vqbsXSxrqVWIyjzdblV+n2/Z /qTjJfOxdTgYAFXDyXzUgsHNGRbCcq/r3xf2X3+Yxctdbv6sJGPk3TDfmj+HH5+vup7+ MHNwId6SEsBie248kHUY5HP6z5mGR2wupihq5+YCdmrBJy5sSrNZiDSWdTTMH1dMfo7f 6kMfhs9RGc/cr9AsDqSJmlsyW5UTTREDtpKSV0x/ogq7DBtugfewFLx42gNIJbqtyCvq zg+72jYUFmA2/zF6EuiFCGHVqgtmM7L9yUNtWbqhIQfV9GuXQkDtci5a3c+/UGyLd9Qb lZcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iGrhbUTY; 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 b24-20020ac844d8000000b0034494e6d658si4230644qto.290.2022.08.22.11.49.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 11:49:45 -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=iGrhbUTY; 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]:58160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQCUb-0006aR-1j for patch@linaro.org; Mon, 22 Aug 2022 14:49:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9ju-0001m3-In for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:53:24 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9jr-0005Hl-KR for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:53:22 -0400 Received: by mail-wm1-x32e.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso8030720wma.2 for ; Mon, 22 Aug 2022 08:53:19 -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=otAuKbBd7la4jsEiv/+EcRkvB4vfTN2cbw4MQWM69+A=; b=iGrhbUTYZzSuMCovEXQuIMu2UGmKnnYiHdDlMwDoy6GlMj9NKUHv56fC0OgpwsIsKg kM5A24R7LWh2SHaQCyqJMcwFCJoO+tHHazR7NNBTQha22ewFwhETodZq+iFsNrK/DIeH Cgcwp4aFpNQM6aM0bA5aJvcyeiVly9aKJnngSdz9y7VeOBoqPgzJ8Q6+BKw+iHDT2q8o 9grvbo9KeApdAM0vA7TdBbchqEBsZkqMXqxFtEwLEx7SWJWE2qy3KOkpnmsJQIqP52L6 eKGCH2BGOcZcyQa7A3k/ZwJeDAWxzjyEC4PG4z4CDDfVXgyqO7rfitdhL/PElCh0ag2N Yafw== 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=otAuKbBd7la4jsEiv/+EcRkvB4vfTN2cbw4MQWM69+A=; b=1tnhG8QJl7tHaST+vzUP3cKdOf+FcGhaj+BXOYDUKSjVFrgBxch4z1vlSmUXt2xKm7 iAzrFsqDnlEf1kdOhlVCxEv5toDSme1T/o3lFazCjD4JHqJgPqIMrbXmQciyo3WYMbLp gDx6phdT6HIPXF7yT8SmG7GOCrumsYmV5lbBQ6uHMeqqkPepBoYl0tl9Jbo2ZfqQ8m5E CZspWJJR4oKqDxXYub4+hCERs/dhgd70Qf1Y7iLHaqVoLmwHd9Z3ISsHwHIE38fdWyBm s3pdmxm/uJUoJzPeblZxIU93POTTTocuKUQ32DT3nAyZjVtqhCtlNs4lpiIjmBqc4Cji uIBA== X-Gm-Message-State: ACgBeo12LlMM05UHlS4WCx+GJGgn+jSDJNOjV51B5j8+mL+rXAjfWO94 NSfbG8WOr1xxBVCp1zxHZEOBpeU2DOFODQ== X-Received: by 2002:a05:600c:4f4f:b0:3a5:a530:4fd7 with SMTP id m15-20020a05600c4f4f00b003a5a5304fd7mr15782794wmq.36.1661177560235; Mon, 22 Aug 2022 07:12:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 07:12:39 -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 5/7] target/nios2: Honour -semihosting-config userspace=on Date: Mon, 22 Aug 2022 15:12:28 +0100 Message-Id: <20220822141230.3658237-6-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::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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=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. nios2 semihosting is not implemented for linux-user builds. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- 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; }