From patchwork Tue Apr 26 18:18:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566076 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3846303map; Tue, 26 Apr 2022 11:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb4sJLNEl920WryqKHmLPIR/edWeg7uMxux7n7cCakDeuWirpUk2+sDSj9ng9zGihCe/xV X-Received: by 2002:a25:8043:0:b0:648:51c2:8a69 with SMTP id a3-20020a258043000000b0064851c28a69mr11965058ybn.10.1650998341297; Tue, 26 Apr 2022 11:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650998341; cv=none; d=google.com; s=arc-20160816; b=orq4aZk0Z5nTpPfaQASZMh3s+D7XDFK5Gs+YvvqZ2BkBRJyFTg2hoPvdmxvlT8dDiB KQQgO0BX9s+TNFf+uoVjqKZJOMn4rKE3TAQdP46hqMzQVPXYhVHD1O1/z5X5R6hnZX+R eZy/wNgREwdPxYnAY6kRsdta9Y9lIsQsKQdYId6Q3XnabJ6Ov2kvF1TA0VdnV+gGskO5 udU2ohL2XR5IvPdzYUl/Hb6XfubyB6zgAyogyZgr9RfcZ8b3MkOkS1cOwkj4ixYFoLP0 0hh8vI4ACvr1j5viU1cYRm0lngR5cdjVrQd2rJ1ktO64GlIgj3gmfJCiEOjHPOMUvKoi QJQw== 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=BaXzjQ4uHQf8aegyrwpNgla1ibfyULSXvI/9Vr/sAxc=; b=frWNjMserMtyn8gx5maViEB33cDrXWYWsj2FYS6CjEbDzwKnxIrwcaw15Iqmsdiaal g6Qo5WwX0/mlFMdhFnX4UiI+85jE++9BV/ewUoztKdyDkJBP8GyloxMzwOi5TpFDV/Wz NAbFgWtbL953FdmqCjag8GtUlgtlVm3pwAp/A1DHT2bEyM+MIT3/gJsTaPfUp6iunE4J 9D5fjrTN8f1OXUnef+ykaMZKrQ2z0zfTpmMgYZ/Kmfxxlz1og5QIwUE6dG+Xr2BeLXNi R+LiW+6Jr/dB2aU59AvTira4x09CcAAaJkRfHq7NxX2XMXohKvjl7a+wgoycGGdMgazR 5fnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KRnKrTVM; 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 t206-20020a815fd7000000b002eb725063fdsi15484630ywb.362.2022.04.26.11.39.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 11:39:01 -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=KRnKrTVM; 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]:56108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njQ5U-0005rb-Pk for patch@linaro.org; Tue, 26 Apr 2022 14:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njPmX-0002Xc-I3 for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:25 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:43876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njPmU-0004LA-M5 for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:19:25 -0400 Received: by mail-pj1-x1031.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso3273046pjj.2 for ; Tue, 26 Apr 2022 11:19:14 -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=BaXzjQ4uHQf8aegyrwpNgla1ibfyULSXvI/9Vr/sAxc=; b=KRnKrTVMScpLU/xoFxQbQTW+SGx7PnSpEZder1TS6rUrnpqqA9g+L+vOOf7d63Rk09 dgVpli8D5/GWTkSryl6aN1LNf8VwhNLAvIqB2dal2RBeq47Qz0QhG+pmn0glhvKD0Bj/ KTbYOZxkhXhgCZiD9c8Rw4hHiDOMb0RgKqEYPSpGQjpRIaHAHeD9jJ0saf8IhDVukpTg DNyu0O9SNcGSB173h8IyFGrJ1xAPjghY0hfHYjrsT1zf7aYN5iTo2IWa+sAgjAqbRNbV tzl3YwJmVN+hhr9uOJWKtOiRJcoUBtuTk3fFGNRLcDDSExX3KDS1D0tCy37KYB7gdsKL e4Rw== 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=BaXzjQ4uHQf8aegyrwpNgla1ibfyULSXvI/9Vr/sAxc=; b=v3yE3+fBmilw6E+6GTz8jf+EAx2WtYH+2C2u4Ve/QC+9XrM1pSvk9OT/KOGNiDS428 FOtbyUx5z4E/foruFveb/no+s7qbsJ40OWA2DEmzHGktczqnw4Xig+uHJr41DS2FlWHl L6qSg4OhgEG0GLpjAF8t0MRxuCGxEu8L5m7goQzGPPTHtRmhDl29kyM4DADfr9WebHZ/ zmxqBWv1XWpKSMGz9Jtx24uEQrO+fQCSIutKstur8pnqTJwAKWzEO8bnM7oIVjTh36KZ YixpA4u8D6MVO9JtheFfdQiYG0hfzOThNjuUx7uAuX6J9rDpX1lf/J4UJNrbjNDoK5xy E2GQ== X-Gm-Message-State: AOAM531g4vf7rQGfXDnNHOmJVX4mOgcYAcRV7Rr9G6bwA7ezEs9UgDJL riPLX0v0OZ4rBek0p4C2EIuJ5Kh6LpHGoQ== X-Received: by 2002:a17:90a:62c7:b0:1da:2c51:943e with SMTP id k7-20020a17090a62c700b001da2c51943emr132006pjs.208.1650997153292; Tue, 26 Apr 2022 11:19:13 -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.12 (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 05/68] linux-user/nios2: Handle special qemu syscall return values Date: Tue, 26 Apr 2022 11:18:04 -0700 Message-Id: <20220426181907.103691-6-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::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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" Honor QEMU_ESIGRETURN and QEMU_ERESTARTSYS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-6-richard.henderson@linaro.org> --- linux-user/nios2/cpu_loop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index 63afba5862..2963fc62b4 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -55,6 +55,14 @@ void cpu_loop(CPUNios2State *env) env->regs[7], env->regs[8], env->regs[9], 0, 0); + if (ret == -QEMU_ESIGRETURN) { + /* rt_sigreturn has set all state. */ + break; + } + if (ret == -QEMU_ERESTARTSYS) { + env->regs[R_PC] -= 4; + break; + } /* * See the code after translate_rc_and_ret: all negative * values are errors (aided by userspace restricted to 2G),