From patchwork Tue Apr 26 18:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566070 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3842726map; Tue, 26 Apr 2022 11:33:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNjn3jcxJmPL8GwMlctZck8kQxE/x9IoCkIYQysX6MPFuJE8mjUX8EQIGVAGonNkIKZVa4 X-Received: by 2002:a0d:c005:0:b0:2eb:d29d:8bf5 with SMTP id b5-20020a0dc005000000b002ebd29d8bf5mr25142707ywd.404.1650998034214; Tue, 26 Apr 2022 11:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650998034; cv=none; d=google.com; s=arc-20160816; b=MjIlBYjnTRHHewtt9ibAw2FD5Gtk41Msq0JCCRRFYyxX51lRor7Jge02aMKtNQpgN6 UCV89merX0RV79gluOv+C0biOoNAD62PiKMdN8+Zxki29ITJ/ubnDFUxw2oUgYN2PxzC YuSI3JzQwgLLy8BTfaQ/HrCxfg+/4cmPcp0w2wlpGmEHNzx0ewwPMExyGlbMOqWBiqzu volhTEFzELwlJwGR/TJRu+CpT6VH33p3hsYPL8jFqoAaNicrYFE6yJruIfaTCGkLB9uG ZIYgKyJB8DCZNZPXGQEUrkvgtzC1BC9wXVIdzuZfoE7ZyhNb+vywiORRK0Ihcz9aRkB7 1kug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=Cz85jXXNTXB185MIdFgmydKGclnlgZjRARJ6+y2fc4Y=; b=BTphLBGAK6aP7It3xaGIxwyESW62x5R6ApNwDmyVaON0gndC43mnV68bz20BN3QA0K HlagQW/8ZlohAhkMunIaVs37TYjrXBkDpSHY2zJApyjMqCASotPJbHkY+See4x/Jwbe7 D53O8CiX2F7J5ELA9qN20T6hvZcbrU0JhseOE9Q2klf1SitF0vwFN9XaUP5eep/003CF 0nRRXLd65J+oFj6frG9thNvd0XyeekChAuMT91yQcg7NIBMRJsaVXMii9AgB7805mq5j 1jYDjURf4eVIg8/KP0XLWYOh23Yzexh1ryNUJ91ufKUJeglJcGPUfdhtdxSQt4NDNTg7 6HDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FP1MY99p; 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 a66-20020a818a45000000b002eb45d9bda7si13183282ywg.516.2022.04.26.11.33.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 11:33: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=FP1MY99p; 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]:45734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njQ0X-0006mX-Mt for patch@linaro.org; Tue, 26 Apr 2022 14:33:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njPmU-0002Tp-SH for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:23 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:46848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njPmR-0004L7-B9 for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:20 -0400 Received: by mail-pf1-x432.google.com with SMTP id j6so16380094pfe.13 for ; Tue, 26 Apr 2022 11:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cz85jXXNTXB185MIdFgmydKGclnlgZjRARJ6+y2fc4Y=; b=FP1MY99p6xmAdx+EPVzcnZ4AoJgvPHtHs5o6Ra846zjDuq9HdM3shz3u971zdt/ImU VQyNf2d9ycGiQq8KOn7E6fRQGELzjA7QV9/Yh5fNNstJ49dBz9PO5e/FawvWHZjwsqKr hMgcYD5S61oWcVXQsMsULrlxzbpXOmkJF4obYn9QAb0WuHiHX2bUERpm70CHucW2mWt6 G7QFiqbp2j+d1lLeNLwMRLR5XnTAlQuONFN2W+fKrLuA5oe03EaI3ROvqP5DWQ5hpRpr 2cL/imdMWJq5u/qMRF3sYyGHE4SFxH5yjGhv7GUiXL+6QwjFpI8kF7L8HdHjwmqjXBUX zjYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cz85jXXNTXB185MIdFgmydKGclnlgZjRARJ6+y2fc4Y=; b=TOULU6JWzBTBnenv1CuIeEefdYW7Niy6yn7/w2BDMiX2AD0jbygCfYIHkYKcs611Ju mb/skhpCLeQ0D3Wfz4hFUG1S21K+md7ljzDcxPWHTbgjJ8ZTVlfoQzlBRlVSfFmAPK45 ZsFhOAxzhAFfElp2OWRM/q1VkDtcq3d0eMev5m2Eb8CJxA7gheDuGxh6mg4mZ6DNMsMx /SGhw026E0VUjbeDdGFhf/NA6TZWJ6kcssQeZuni4fC8uzGKe067v6eT3FAU6c3a/BFR uMXl9qNgiAo8z79rvvXHZTClMUhP9O0JK7rdG3twTJG5BWYR2iEgYOLqkR/LBylXvwSw u8Hg== X-Gm-Message-State: AOAM533JI712Z59SFFvsEhYijbmwvhE0jNz7vPZ7SBkoWZZx0U4hMuHC 51EW0ZByjis7kQUsu9LQ8EyXcIhuJtfSpw== X-Received: by 2002:a05:6a00:1903:b0:4fa:fa9e:42e6 with SMTP id y3-20020a056a00190300b004fafa9e42e6mr25683929pfi.1.1650997152488; Tue, 26 Apr 2022 11:19:12 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id j7-20020a056a00130700b004b9f7cd94a4sm16482827pfu.56.2022.04.26.11.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 11:19:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/68] linux-user/nios2: Adjust error return Date: Tue, 26 Apr 2022 11:18:03 -0700 Message-Id: <20220426181907.103691-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220426181907.103691-1-richard.henderson@linaro.org> References: <20220426181907.103691-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Follow the kernel assembly, which considers all negative return values to be errors. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-5-richard.henderson@linaro.org> --- linux-user/nios2/cpu_loop.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index 91737c568f..63afba5862 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -55,9 +55,14 @@ void cpu_loop(CPUNios2State *env) env->regs[7], env->regs[8], env->regs[9], 0, 0); + /* + * See the code after translate_rc_and_ret: all negative + * values are errors (aided by userspace restricted to 2G), + * errno is returned positive in r2, and error indication + * is a boolean in r7. + */ env->regs[2] = abs(ret); - /* Return value is 0..4096 */ - env->regs[7] = ret > 0xfffff000u; + env->regs[7] = ret < 0; break; case 1: