From patchwork Thu Feb 16 05:45:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654008 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp177281wrr; Wed, 15 Feb 2023 21:46:20 -0800 (PST) X-Google-Smtp-Source: AK7set8rs5IE4BfQq07AHcXGpTbv5vBkvaeBPhraJ6Ic3sDf9eXeJrxMhiuJoZF7sxIZFzuYtuNn X-Received: by 2002:a05:622a:50c:b0:3ba:101e:88c6 with SMTP id l12-20020a05622a050c00b003ba101e88c6mr8080886qtx.48.1676526380148; Wed, 15 Feb 2023 21:46:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526380; cv=none; d=google.com; s=arc-20160816; b=LEX19M0A8mqEsEjjk77VLvU5lFDQwATZeiyAEXfL7XkENHZEEvF/7l42JT5iS2I4wn f7rgNoJorLbkYl9+hHwm8abMRQI0EnLAyTc5YzVAOyC6OQvbuJlyBSyfyH0UP1vlJYyN 0MPqgV4Nd6UsAmGvwOx1Z42wHgqduu8IxT84li3gcg7rE+Z1fPXPxA/8iHnvEL2O35/R /mKNzXF3x1vmIuXZ1kJh+BgLb7qACCGmNbIOLD7hXhlBSr8T3WoqMIqZWLlq7C+FAPkc Nyv+U/K4+SUk3Je2SjlrDtoFoo9DkVEY8q0dCjbGaTqu1W2+1hFWgBKSRVSwP8JrNDJi j1Xw== 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=4zhGePcD91yQ6ch+7pxzLZ4Aayz4MXPEoGj6QOyVgUM=; b=MFUrumsdyRHttfWc2bGZZLd9iwHzNlhnem1ONF4n6OjmaJNJTSJLtnb9tAiaTtcGnR 7QhORGO9BnG/LavDom4y0EpqChbUD0IyIJkAf7RGeNo1VS91L1PdDQI4+wJqy1kPEz4e B6im5gZPZ7FJ54g8l8xw1JLKxrC2ckTIOlLYuQgU2/26NiQSUD/8y0eTJzXJlvkvA5EN fDRK/+0VvWU2wojGY2KdYkC+GsQFdRyd6/94LEpQFJe8ZU0b5tHRR1K/DHgYturytYZ9 vxT/8uSrTxFD8pO5XLS2aRybkBkCnD7WCddxhWrOSyyNzPK1uMyZSxAT6lSqsnqWaEy1 KFTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PNMBYKOb; 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 s205-20020a3745d6000000b007169c14b660si680425qka.167.2023.02.15.21.46.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:46:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PNMBYKOb; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX5X-0001G0-VV; Thu, 16 Feb 2023 00:45:48 -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 1pSX5N-000115-JK for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:45:38 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX5L-00012Y-Qs for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:45:37 -0500 Received: by mail-pl1-x62f.google.com with SMTP id jk14so974563plb.8 for ; Wed, 15 Feb 2023 21:45:35 -0800 (PST) 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:subject:date :message-id:reply-to; bh=4zhGePcD91yQ6ch+7pxzLZ4Aayz4MXPEoGj6QOyVgUM=; b=PNMBYKObCsz9WrJuxjzHRldkjkZuouINoye/Ir95MRsAhV+ZdwMvogcORdZQrb048v UoKCoQRRiNCu8G+k3rdWdYhpDgDr0LTfarXVDkpw9urzp3cjI8GkPDX9kE7XLKZQBDSs ol0MUH7GlBFHWW4Qf2uT69lF7S5vUitidTYeSgmGmYECFkp0+agv/xMCNNtAzQoY/+fd PcC062P2uWm2eCeVRoi84iKESkX6eISdSS8xj2q8FU+oSnuEO/rBuH5DoxqetJ14q+DT htFObL+TRfJzZYPtHQPEQGW72zb7LOk1p0i9bIg8GHoUKcMLdNfCk1ZocfwCdXJdXOB1 HGEA== 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 :subject:date:message-id:reply-to; bh=4zhGePcD91yQ6ch+7pxzLZ4Aayz4MXPEoGj6QOyVgUM=; b=Xal5ItFFcvfoEhuFuBi9SVlNZD4bwJ322X14S4U0PzVffKW4b5CRnFXhhNpQ6A23kx sktpleZY8LSfBcTa0XmePu5RZoQExwXB8ttySghiZ30969RC+a2JZGPDEriVK8tuXWFN 0PFouEd7fiRbwKFNfklswnsp/d5HKB/bGCH8++Cvfw5yhqaO15XfH8phSzB4n7+0GDKZ 3Ewo2hBct/RZVigPfboAuJacV222q3wxA6ok1uOn4euR5Hrcm1ghGH4AA+bBBtF3d9fw 1fd+f/ZS/LmWkTgkchUp0Vg1nPY7bMhQ8DphAuKOkE3dmhfTL5n8cGoD9iKnXs108dDI fzhQ== X-Gm-Message-State: AO0yUKUbBhp7BkKq6dLBEfirB51xCOpxTwArOWF+ZSOut/y6olHbD7ED T7dZ4bcRAyNBo5lMoO5xm8ZOM4ueA4AeUWKnGNM= X-Received: by 2002:a05:6a20:7d95:b0:c7:23ad:63eb with SMTP id v21-20020a056a207d9500b000c723ad63ebmr1073519pzj.10.1676526334190; Wed, 15 Feb 2023 21:45:34 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:45:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Ilya Leoshkevich Subject: [PATCH v2 01/15] linux-user/sparc: Raise SIGILL for all unhandled software traps Date: Wed, 15 Feb 2023 19:45:02 -1000 Message-Id: <20230216054516.1267305-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 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 The linux kernel's trap tables vector all unassigned trap numbers to BAD_TRAP, which then raises SIGILL. Tested-by: Ilya Leoshkevich Reported-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 434c90a55f..c120c42278 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -248,6 +248,14 @@ void cpu_loop (CPUSPARCState *env) cpu_exec_step_atomic(cs); break; default: + /* + * Most software trap numbers vector to BAD_TRAP. + * Handle anything not explicitly matched above. + */ + if (trapnr >= TT_TRAP && trapnr <= TT_TRAP + 0x7f) { + force_sig_fault(TARGET_SIGILL, ILL_ILLTRP, env->pc); + break; + } fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr); cpu_dump_state(cs, stderr, 0); exit(EXIT_FAILURE); From patchwork Thu Feb 16 05:45:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654017 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178379wrr; Wed, 15 Feb 2023 21:49:32 -0800 (PST) X-Google-Smtp-Source: AK7set/ggYiwwT09j/FF84vU7D4XE1TGgv+kwRvZem5VaUy8rsaDwYX9g8ze1t3kMkDclmF7X61F X-Received: by 2002:ac8:5c52:0:b0:3b8:60b9:e75e with SMTP id j18-20020ac85c52000000b003b860b9e75emr8707168qtj.4.1676526572583; Wed, 15 Feb 2023 21:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526572; cv=none; d=google.com; s=arc-20160816; b=PjuBuofd6KjUzt3QR3QY/2fOv25WHME5QHEgm7yLgwOKoNi+X2P3qdsq++4LxrSomL LfgNhWQJxZTG4g/bIx4pWGxt+VbsX6nurTi7DXS69A/Nrxmaaff0Gph7EKqgpn1zZHX0 bSLLvSV2697bTqYz7LX5SsQSxoRm+yo2EAGhjCQNh28LRDiisxOgPWkE5d4zthldLBJo LSdHFqutHDyxoaG6lKBX5LVKhJe4tJeIs+FeTEcEtPiT2sWVTRARveWohvBCqOKbeSFg W8tMqsMdKiHVi9iV7lvty33CV3vs3piaSm3R4DBvrJcOjs/E68y0/vDhQPzd8DZmV+lA RoZQ== 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=3/GsGOhPL6d8HonZ9tvdFyDrYuAo6ZmEKf6gpoOjRcI=; b=SCUixQypsha8gTvl549WnecEvTZfESyfYZd4eJtGn9iCC2LZH9kXnE89CGoe2pQ7cW FkfN1fmCD4sise4IOxFKPoINmPQjH8srjm7kQ3k2OOSJ7PR3C7GcZMNXoGY4Izfc0fR7 DsYiguflDa3um3bYeniUOStYwVnPKwxust19trLIyJJRpidppmEq09R9TbiOC7PGr8Ij EdccC1SyHBiHAwO8r5skRlRqd2MytW0/+zZMb5bZ9l4y5Tk7s7s1VGXZs9JsK8VLDsSC 3d8NK0YdpS8T5iap2SGsSipe/iRYqPdn/lHWxYOzXuXOxL/1BXhAKM7KQp7aVR4Fb7Hy VZmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HQB3PJLu; 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 z1-20020a05622a028100b003ba26e15f75si777884qtw.478.2023.02.15.21.49.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=HQB3PJLu; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7e-0003lc-7C; Thu, 16 Feb 2023 00:47:58 -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 1pSX7c-0003l4-La for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:47:56 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7b-0004wc-3T for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:47:56 -0500 Received: by mail-pl1-x62f.google.com with SMTP id ja21so953293plb.13 for ; Wed, 15 Feb 2023 21:47:54 -0800 (PST) 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:subject:date :message-id:reply-to; bh=3/GsGOhPL6d8HonZ9tvdFyDrYuAo6ZmEKf6gpoOjRcI=; b=HQB3PJLuA9MUG6bqVFdMuKez6pm27N5ZO2YnZFwvyh3Tyk1OQCVJYA/rtuYcFKNbqi KlzniEAY9LyGjZ6yjdHgC0Dmna8J5Oj6sMGstpAFvY6GXjxbjaDgETFC0AE3xH4flL5S CaZjCy/NwqXBEHnvcYegxUJw5lhQtUzGzrgdzWpNCq+bqx+1QqF3DRAhR7ZNu8SC9Gt1 3s2pGoHiNDQ33wr8JDkGmd4CML/K+1xEayNJ2UX79BkYwd2d/nxAS4pXlkOktNNtu7dP D/g9sjXsQGrSupzHg+TqBXBCjbLpQIikAxFoE62/4Yzb92NNsWQfc10fiFXXgx3T1pu+ 3RBQ== 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 :subject:date:message-id:reply-to; bh=3/GsGOhPL6d8HonZ9tvdFyDrYuAo6ZmEKf6gpoOjRcI=; b=jhX8u97O5f3vw5jgE50/17qEoRc7bCZJdaUvW5eesWzaYaYOEm3E0z/pm8yTf7dcog RH/7bvVHdZhxlxHTHyMAaF2dBg21C9eOqQK+1suPYa3TBfIn9GJRo51yNHnTbC9R6zqH +ksRoi+z3E/rEMUXHiQFGxx4JMjwPAKpObjquE8MzjlwickRwiJ0psGZ0JMqSdGA9vwV 6tmXmIwlhDAuX9/Il9ksZOBVQHFoO6bwdqzoJaLM5ctPx4/qHppCdSiD+EPkcxvK9ZPT s8ab6QbvNGEwiM58gwrtUHRHalFFvI6HuisBJQu9hegGBlCqlk4p/pbVM8KwgIHKTQD+ J8qg== X-Gm-Message-State: AO0yUKVytprh4OXl7YXWcyWOo0r/NzBdWHhfxBVNXrRoHy8b5rstggXe FUbPXU6OUuja84s0uwyxQ5RwGVfSo0Q2zCyZLoM= X-Received: by 2002:a05:6a20:244d:b0:be:b8bd:83ad with SMTP id t13-20020a056a20244d00b000beb8bd83admr5174680pzc.0.1676526473761; Wed, 15 Feb 2023 21:47:53 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:47:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 02/15] linux-user/sparc: Tidy syscall trap Date: Wed, 15 Feb 2023 19:45:03 -1000 Message-Id: <20230216054516.1267305-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 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 Use TT_TRAP. For sparc32, 0x88 is the "Slowaris" system call, currently BAD_TRAP in the kernel's ttable_32.S. For sparc64, 0x110 is tl0_linux32, the sparc32 trap, now folded into the TARGET_ABI32 case via TT_TRAP. For sparc64, there does still exist trap 0x111 as tl0_oldlinux64, which was replaced by 0x16d as tl0_linux64 in 1998. Since no one has noticed, don't bother implementing it now. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/sparc/cpu_loop.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index c120c42278..d31ea057db 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,6 +149,12 @@ static void flush_windows(CPUSPARCState *env) #endif } +#ifdef TARGET_ABI32 +#define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ +#else +#define TARGET_TT_SYSCALL (TT_TRAP + 0x6d) /* tl0_linux64 */ +#endif + void cpu_loop (CPUSPARCState *env) { CPUState *cs = env_cpu(env); @@ -167,13 +173,7 @@ void cpu_loop (CPUSPARCState *env) } switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x88: - case 0x90: -#else - case 0x110: - case 0x16d: -#endif + case TARGET_TT_SYSCALL: ret = do_syscall (env, env->gregs[1], env->regwptr[0], env->regwptr[1], env->regwptr[2], env->regwptr[3], From patchwork Thu Feb 16 05:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654009 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp177865wrr; Wed, 15 Feb 2023 21:48:04 -0800 (PST) X-Google-Smtp-Source: AK7set8P9PL6zNLT4aFOquXX+aRSaIwVOuHyDrIQQgVW+LevtabIpCeG98N9BDnNcCKalIhkFf2C X-Received: by 2002:a05:6214:300c:b0:56e:bff1:83a7 with SMTP id ke12-20020a056214300c00b0056ebff183a7mr8684966qvb.18.1676526484078; Wed, 15 Feb 2023 21:48:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526484; cv=none; d=google.com; s=arc-20160816; b=1B6bzidwXJzMQWDRpmFZ4Hib1WIFjOflXDyBlHe+QUxi345JnEMP9Hkufo0hxaRXCU I/HYy0GLrWsI5vHQrU0HG3smjpfAMHxWXPRW5tvdHo2au0WYaG72hN+Z3R5/gRuJA6ak ASPFyIohrVV+dlVuKs/67GY1ulKftYejcOXMbfgUIgPq8ok1e+ya8cqLTZgLqX0XNn9x QKOTXcAWX2xDtxCf++KNql6DzgWSUPd2jIIQbDeGO2SSVT62WDkntmWiBVcNWH/0BTmO dJW1EUxMAfwWgACDQmBr01aJjzJxT2LpMUfL8X0Ge321elrG+2EEQ3Huc4JsuBDh8Rz4 llRA== 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=CwzhgiW7ITrxyd3SSfKf1YS1o/7m69672MVumGKkbhc=; b=zqa3htkU60+CQrlIKTlULqZ/mqHzK++2EWtBOdaiyBGn2GtYCMuR5ScWlDfXrvtM8u GAs+ktIrFV3pIwC9xgkOncnc9MV0kuX5f1YOXt0Q9G00wyfsrdNAuyveXLO6NAEqDExR CP0wKdCbkMS3VBWaApZMYw8U92Gvai42HLiHtpAazC2PpEdAjjD9hICpCVYglmr/RzXa Cj1ZhyEl5AMbnXuOL1TVRiP5vzUuL1lMLNbfJoYejGrGHvVQ2lEvhlrtCpOGy9NJUlUJ 7UT6CsEWW5zv6vRm07g3o/6I37vRF3qce4BTkFUmpAL+k9I8TZ9UTyXNv0veA6EHpHMs wvbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OsDhWQvR; 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 fh20-20020a0562141a1400b0056bea5ad78asi471239qvb.363.2023.02.15.21.48.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OsDhWQvR; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7h-0003nU-TS; Thu, 16 Feb 2023 00:48:01 -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 1pSX7f-0003ln-SX for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:00 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7e-0005C0-Bk for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:47:59 -0500 Received: by mail-pj1-x102f.google.com with SMTP id bt4-20020a17090af00400b002341621377cso4751086pjb.2 for ; Wed, 15 Feb 2023 21:47:57 -0800 (PST) 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:subject:date :message-id:reply-to; bh=CwzhgiW7ITrxyd3SSfKf1YS1o/7m69672MVumGKkbhc=; b=OsDhWQvRTDlaXx4+osPMx5z+xX15hix/wXxVqMvk3M9wUA1Re83C3h4I+2i+bt0YpT WNBQWuozrYNRSSQKxynymKm8imFC+IrFUTIrWXKPftI4hm/aR4H/DZhrQeOQAOzgFEm2 X74Vd9m1rvp8TCTHRUEmc4OX3onJy8XCs7rIkLp3sYb8B9ids9O/akQgxq1GbJGsit8N ZEI7Dc4sVvhe3a0/TieHgNj9vHT1sYvcu3XAhXANojrnODL09EArstXuyyuAUjQpbH3y 5uRcgggQrVyiMDiYX56GeExKQwSMOAR2xQIyxhYWmpUW94rAAuCZ3jjsBcXnfEPjFPzs E3aA== 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 :subject:date:message-id:reply-to; bh=CwzhgiW7ITrxyd3SSfKf1YS1o/7m69672MVumGKkbhc=; b=gCwNPsOlNlsGWd7OpUwrlnJK3nKZRKJ2/KsZdurDgCvOn6TVJx7wFeggjHzjCCP+bN dtvKtrOJ3VFA5GvU5AihN6W1Gsik9RDAgMGKqLWpFBHeEzvAiWf9Hs9arPnBiTuJw5Se Z/jr38ynTnBbHyl780QvrDJ3qEyr7E82iToEr4tNDxvWX0ve7bd63YJZA53WJ2igqJj5 Wc65um/cx+53HF2Tz9lnPfJAjUd3IWr1goUDXDzctslEH2c5FM+WTSMEeD8+76JACfdT vLgTirT/3uhWHEEiAcrueLdVM+dIwmFzVkvZ01dEAb81KufZfC7TttPGDr4NM9dky5Pi 1loQ== X-Gm-Message-State: AO0yUKWXWNT5hjtHUyqlh0+Yu1uWqPwyrHUeMKECpn2MtnSBEXrJ/pzZ RaOhYcjcSccdPU9W6G3+38D9A29YO0Un30JC+N4= X-Received: by 2002:a05:6a20:12ca:b0:b8:66d3:30aa with SMTP id v10-20020a056a2012ca00b000b866d330aamr5436650pzg.50.1676526476980; Wed, 15 Feb 2023 21:47:56 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:47:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 03/15] linux-user/sparc: Tidy syscall error return Date: Wed, 15 Feb 2023 19:45:04 -1000 Message-Id: <20230216054516.1267305-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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 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 Reduce ifdefs with #define syscall_cc. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index d31ea057db..051a292ce5 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,10 +149,13 @@ static void flush_windows(CPUSPARCState *env) #endif } +/* Avoid ifdefs below for the abi32 and abi64 paths. */ #ifdef TARGET_ABI32 #define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ +#define syscall_cc psr #else #define TARGET_TT_SYSCALL (TT_TRAP + 0x6d) /* tl0_linux64 */ +#define syscall_cc xcc #endif void cpu_loop (CPUSPARCState *env) @@ -183,18 +186,10 @@ void cpu_loop (CPUSPARCState *env) break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc |= PSR_CARRY; -#else - env->psr |= PSR_CARRY; -#endif + env->syscall_cc |= PSR_CARRY; ret = -ret; } else { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &= ~PSR_CARRY; -#else - env->psr &= ~PSR_CARRY; -#endif + env->syscall_cc &= ~PSR_CARRY; } env->regwptr[0] = ret; /* next instruction */ From patchwork Thu Feb 16 05:45:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654013 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178151wrr; Wed, 15 Feb 2023 21:48:45 -0800 (PST) X-Google-Smtp-Source: AK7set8ofXTXlh2rjK0i4Pu7CwGkh0iJgyiB/4Nrc/iay53ROHN8YYPRlNRtZ/1P/Z90POvxNsl6 X-Received: by 2002:a05:622a:4d:b0:3b8:3a59:6e13 with SMTP id y13-20020a05622a004d00b003b83a596e13mr8757914qtw.62.1676526525515; Wed, 15 Feb 2023 21:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526525; cv=none; d=google.com; s=arc-20160816; b=Q7OsC9ApgYHa2wI/ZFsSLwJaIDzMMk3gcCm8j/7uNknS8gXzfvarl7ZIypDGMkjx/6 mH3VYyQ/u1hmj5MuaauWVMgsK4lvhIBtrE07d+IY5gXE6Sd4KgAP/iwyoYHglniBeuQE LnpQxBnXK6QbMBS6vTzHoAbOXFIEP+V733gBBt/e6UJcisJ0Cl4J/L69CbXkg4gE/Tg4 1zaXa8dsRQ9Cl2832xDzKVquEJhS+YGNzQHpZVj9mBpK4oTlPOFFrgOloHlUYe89wSLz nbnL/z/UWWQ3dP+u4WRxteKZMC0Uay2ERtOQ2/aAhDYUvvu6Y+QDAqOypnmN2PfIL8S+ nc8A== 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=vnhKbJ5br8XBikjOI16wWyZO1yPpX72pZ9Y4QBl2Phg=; b=n7/011pO0eDOxoaukfJbHAUjPhCzLaAc5Qr3S8crJqlKZ0+h/T1gQHjvJspy50q1qw pPBPIS9GhILh6m9zBzOLzl4kG5R3VFO2LP5TD/eI5Oxv5Xf6VofvEmcibDLY2rjQGcSk JLtkKiYo6Hrt7ZyIvdfxqw7OIcSk6tgnpDDbsKnKM23iOQxjqirfSykfatb59ArBwRFp FKXMT8G+d1KG1aCwsF36KgjR+JQsjpaIX+3tNNf1nWJNSkBgBuVxgASDQa7ulUK+zWa3 aDry+QtP0V7iP+uDwS8QXJwj3zM0v4BMwMSfJpGG7IXB1B1f7+UJwXnq5hUdyLqZU6nF 8KhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLxZiQwS; 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 q28-20020a05620a2a5c00b00706b0b16be1si746221qkp.420.2023.02.15.21.48.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=bLxZiQwS; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7k-0003tO-Lp; Thu, 16 Feb 2023 00:48:04 -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 1pSX7i-0003nX-7p for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:02 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7g-0005Mc-MB for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:01 -0500 Received: by mail-pl1-x62b.google.com with SMTP id r8so1006092pls.2 for ; Wed, 15 Feb 2023 21:48:00 -0800 (PST) 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:subject:date :message-id:reply-to; bh=vnhKbJ5br8XBikjOI16wWyZO1yPpX72pZ9Y4QBl2Phg=; b=bLxZiQwSNWAxa45jXE8pdoRN3rA+2psit6BO9G9fukKSvOD+7AKTc7HRIG4Rv03Fk7 LtwXGQuMujEuFt6ypp3nl7COeUD9mQIuPquBK5VGRgQUf/SvU4oHnOxokzloE5FAvfiq Gqf59CwM1Setrr7YI7y7KCyE761F/1+hAOY3CkOS43QfVpagIKbqlFiib1FUrEeBf+B7 JwSdA9xhHTDD/bAHUzbm5HRRmpImpFUJtjrhbUvl/CBGBd5oAC3jK0NA0hDrcO731NR5 ncxJwwBsjsYw9oaWnu/k5OeGU+sj80lRLwcl7EsWoEIhL0zz/H21RZFkElTCCCwDaYyk ai0A== 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 :subject:date:message-id:reply-to; bh=vnhKbJ5br8XBikjOI16wWyZO1yPpX72pZ9Y4QBl2Phg=; b=J/MVNPpynYutN0iRyd0/E4FZb8GUB1E6PpyRFdpOgUYjWu12BH47FeUQucV1AtX/1A rhEdRTnyA+9poLzaxzpCVYw9PnhXxPxVACzYKitRUD1CcGtJ++7UOV++2+RgNqU+YC6g cUyCyOzCxCwwO43yCdWHcT3l3XQJFtrya/Zq731x7wO4i8jwia2wxeailnq4BE70rXUN JNt/4NAtpqaEZ75DfBul3mlI00PQVzFh/TNNmcllTvi+ezeYFqicoM+V5SpgQvvbEsXp 3wyAGh6w4Pb/WAYZ7TWqL8KTiHrc/u2vBJNOE9NMD1epmYovuOutTdPbHROx1hg8ox1O zSuA== X-Gm-Message-State: AO0yUKVd4ZpbrKp25CyrX4p2h5M6yv0sx8TVGCQ/WSn042OKUJLdkfUT LxG+to+mxpoGougNDm3MgqapJ9MyKTe9Ev/sAao= X-Received: by 2002:a05:6a20:a10b:b0:bc:d4cf:d647 with SMTP id q11-20020a056a20a10b00b000bcd4cfd647mr4801289pzk.6.1676526479049; Wed, 15 Feb 2023 21:47:59 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:47:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 04/15] linux-user/sparc: Use TT_TRAP for flush windows Date: Wed, 15 Feb 2023 19:45:05 -1000 Message-Id: <20230216054516.1267305-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 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 The v9 and pre-v9 code can be unified with this macro. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/sparc/cpu_loop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 051a292ce5..e1d08ff204 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -196,15 +196,14 @@ void cpu_loop (CPUSPARCState *env) env->pc = env->npc; env->npc = env->npc + 4; break; - case 0x83: /* flush windows */ -#ifdef TARGET_ABI32 - case 0x103: -#endif + + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ env->pc = env->npc; env->npc = env->npc + 4; break; + #ifndef TARGET_SPARC64 case TT_WIN_OVF: /* window overflow */ save_window(env); From patchwork Thu Feb 16 05:45:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654019 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178416wrr; Wed, 15 Feb 2023 21:49:39 -0800 (PST) X-Google-Smtp-Source: AK7set8y3guZk4l+nrBa4cpeN9+vBCh3/UMEEDk74wTgVRTuPjXI5GFNrFA0ivavGfKf2h3MdjPB X-Received: by 2002:ac8:4d94:0:b0:3b5:5234:e895 with SMTP id a20-20020ac84d94000000b003b55234e895mr5887692qtw.15.1676526579490; Wed, 15 Feb 2023 21:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526579; cv=none; d=google.com; s=arc-20160816; b=zNd4zBSzQ23lcMqRpUg3qWX9Bi5OvioFyaXwCS7+gKjwwtbROTZdQhleaoeI+M1jrl 4sO0JtFHD+qHd7gZjv9AOpca/nWYw3JTV7GOcDSNtBzqZ/dYMSbftt5lYZkeluRJIiF5 A6PvY3cAJnr1+cEC8kzgiBgb0I6RYwtBJN2Fd62bQETngNfw8zrkmJiaMwWv/r0IO1Cd 5Qdt0jvyiPmXCPvcQTWC4H3JiIlnB3qTPGmvs9UgAuILT0yRBSTemtGdGPPY+rQcwZFP Z+ozEySYDs/42ormAYqlHkhrFvu44vqhA+M5u/hEMVLX72Gg2PrZ029xZBH5LhfgEfPy 1D9A== 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=1qgOI+XbaLOlA8TDn/4BzcaH/ANI94JgR1D1gQbepb8=; b=z5GgckjBkMZGteKVieBypRiOJymXPH5HA4RFGwt1feL/05g8//zu2wGE2J40ElSrFV lgOnjwskpVaPPArPkU1r9tzCs9bJ2mTBgOElqP2Fod68nsST9xEWF4We88y5B6XVZdcF AdP58fPWkNkeLvp6okZ3g5rUoEphDBXkWW0rl7o33GStobiHPplP1t7Mr4OjKyyGOTOE wgLucgegMhWvphxdn1A+jF1L2rurxQxy66SBthk+ESjuVGaxtOPv6wlGmc5v3idHWRHI JGQOy6GeMpIgH79PH4ksB5IV7rZlXwydPo14c3Oj4fhCeo4lTHw7mRDCJO4CjYN+0b2o TNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cyXHauOS; 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 d20-20020ac85ad4000000b003bb8704f3dasi840420qtd.150.2023.02.15.21.49.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:39 -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; dkim=pass header.i=@linaro.org header.s=google header.b=cyXHauOS; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7m-0003v5-GN; Thu, 16 Feb 2023 00:48:06 -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 1pSX7k-0003sg-6q for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:04 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7i-0005On-Kb for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:03 -0500 Received: by mail-pl1-x62f.google.com with SMTP id r8so1006159pls.2 for ; Wed, 15 Feb 2023 21:48:02 -0800 (PST) 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:subject:date :message-id:reply-to; bh=1qgOI+XbaLOlA8TDn/4BzcaH/ANI94JgR1D1gQbepb8=; b=cyXHauOShPnKy3y8Gm0vSQPfFNJDVuXG+tFbj9zRo18zzqzVe1A/RSSDxDx7mWsFZi 7MaybDNyyE5JYLcrmchPB8ErHiKNnCwn1Kv8y7mp8XI6S8on/ks/M437umUfxYNfryYH e+IfbaFZODvEbe9MwPHtYo3WEgGODXP1G43uwk/ZCLpvX0HxS0JwBzPJ2Qs4yRIomFlS lB7lFZny4oWrXbyZClqe8rJeFGWbz0DWw8Uf85KQhzYvn5cx/3AUuRJmQfwWNeWCCvls I8UGbk3A1CO2Ya+Rprm5kwfx9SeX6BAc7MYWImzWAEMZIXto7LUrkEaCbIyh69WpozQm m/mA== 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 :subject:date:message-id:reply-to; bh=1qgOI+XbaLOlA8TDn/4BzcaH/ANI94JgR1D1gQbepb8=; b=aw0tdobcr9mZ6kxmKVCRGSVW6cmoCpeKJv7CciWKEzv0M78YOklWe78b2infxT2syq Kjcx+wVGu0OCIwb3XwE2IhGsu6tEHjZrmhfF8cOyXXl8srvVYf2CEM80XZ9+uQTGHILL noSzRvy5idRE8TcFmtKBL5fW0c4O78k8fH1X+IaGRc/PxRYV85QHdB/EnZKuK1tjE70S XMLjUpeJgWLQwYtvAHLq/KEnOe7v4BZBQj9iLX09nMrPRqu1jeiSl8QJKr/O/8/nozD2 JcB8FQDRazfT5MBhOww0Lz6zLX0havDy9Zk2D+2mpTEsCy6OBkMq7CDzu3Uqcl+OhZMK XoDQ== X-Gm-Message-State: AO0yUKWeVPf5KLKhihCxsHLvkvhKre8Q6+DGNpLsvQSojUz/IMxLQHMc I0QD9yDtkpKVDH4s0Hi259njH9L1CtcyNtu0Akk= X-Received: by 2002:a05:6a21:9985:b0:bc:51a4:d14c with SMTP id ve5-20020a056a21998500b000bc51a4d14cmr5512143pzb.16.1676526481411; Wed, 15 Feb 2023 21:48:01 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 05/15] linux-user/sparc: Tidy window spill/fill traps Date: Wed, 15 Feb 2023 19:45:06 -1000 Message-Id: <20230216054516.1267305-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 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 Add some macros to localize the hw difference between v9 and pre-v9. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/sparc/cpu_loop.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index e1d08ff204..2bcf32590f 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -158,6 +158,15 @@ static void flush_windows(CPUSPARCState *env) #define syscall_cc xcc #endif +/* Avoid ifdefs below for the v9 and pre-v9 hw traps. */ +#ifdef TARGET_SPARC64 +#define TARGET_TT_SPILL TT_SPILL +#define TARGET_TT_FILL TT_FILL +#else +#define TARGET_TT_SPILL TT_WIN_OVF +#define TARGET_TT_FILL TT_WIN_UNF +#endif + void cpu_loop (CPUSPARCState *env) { CPUState *cs = env_cpu(env); @@ -204,20 +213,14 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; -#ifndef TARGET_SPARC64 - case TT_WIN_OVF: /* window overflow */ + case TARGET_TT_SPILL: /* window overflow */ save_window(env); break; - case TT_WIN_UNF: /* window underflow */ - restore_window(env); - break; -#else - case TT_SPILL: /* window overflow */ - save_window(env); - break; - case TT_FILL: /* window underflow */ + case TARGET_TT_FILL: /* window underflow */ restore_window(env); break; + +#ifdef TARGET_SPARC64 #ifndef TARGET_ABI32 case 0x16e: flush_windows(env); From patchwork Thu Feb 16 05:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654015 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178235wrr; Wed, 15 Feb 2023 21:49:05 -0800 (PST) X-Google-Smtp-Source: AK7set+/wxLjYf01PQWnrTejM75DX6aZ93wOSMTLCg6rEx+ZuRgyLzJa4LBjv2VFQm4q6aKUcxfr X-Received: by 2002:a05:6214:c44:b0:56e:bc4c:b55d with SMTP id r4-20020a0562140c4400b0056ebc4cb55dmr7811015qvj.20.1676526544857; Wed, 15 Feb 2023 21:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526544; cv=none; d=google.com; s=arc-20160816; b=Pmh9Osbrcm/KZ/vu6M4o6unlcuQNMrWuUYRudIZYtuhoquYBrKVi+kDT8JKLNatRs3 u3+DFUWbrQAlmIIY5cgSkPDTLUP2U8yDNPGHDUJgZKM+HCDcFyTNVS4WqCQ3J+zs3Kba s8qFxS4UaM4UceO1iTYRyD9I2CNcd709mmKkNL0nhMS8zo32XCLPsuQFXfLYxog5ZNmH IcRcTsj3i0nA4mGt3F2bmPbe/906SPK6sSrxi1V2ecoyF7OJ+1kUtKHE5vdSX+ag3vhC srnTGwiieFFMClXR1cYrDgDLlz4Mbl83X95+opBbGE8vZxytX9xMHLAsTKSk6kV02/TK vp8w== 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=5lc1shs6HgaujiRT2ti/1E0puXb58K6tNRWGGe1EnPI=; b=lApuhHg6oRdwPJMXkkJ0XevMzh2rkiVXUE44zbjIqvxVVLWNRfVgNpsKxkEV6u5+04 E9UsMWW5AlFpjPUzNCr0l/d46Ccha+bxQknLKNXs6ddPfmh21x3+byV9dj3UfShiLmCU ulAAsL3Vmh4CbaPVldW2FmT6PyWd+D3yEn3WdDGYrRiAe/EluNAdFIq+0L3LfRyUVBC6 zLWMWcBPH/d7NcEjNxs3Cu2TZHPCelRTgLBZPo7cJpenIKec0i+VTy7YdpXzmPZ8O1qm SxDkCbNA0v5aDtYw9PkzkPSzeWb5vbZd9UxFRyTyBgQtgxwAxfoS1mlpO4XritdYFHjn 4AhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UGDWOFJA; 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=fail (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 z8-20020a0ca948000000b0056ebdd6c30esi479043qva.126.2023.02.15.21.49.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:04 -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; dkim=fail header.i=@linaro.org header.s=google header.b=UGDWOFJA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7n-0003yY-9T; Thu, 16 Feb 2023 00:48:07 -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 1pSX7l-0003uo-SM for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:05 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7k-0005P2-7K for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:05 -0500 Received: by mail-pj1-x1033.google.com with SMTP id pg6-20020a17090b1e0600b002349579949aso686879pjb.5 for ; Wed, 15 Feb 2023 21:48:03 -0800 (PST) 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:subject:date :message-id:reply-to; bh=5lc1shs6HgaujiRT2ti/1E0puXb58K6tNRWGGe1EnPI=; b=UGDWOFJAvpVw65wrhMoagDlBEby2vJE0j/BqJHLcemxjN4sQuAU5olrhRBWWtIatPh I8aI8hOC2MIJtuB01iwQgSjXOXwPWPoFMIiLlaqmQZgElOOh3L0zyrd94uGuzuKM2ziD 4RjU1JT8yt1o6tieRPUNKD/B3tikQoBSEgA61zseVq7U08GD35z05Zj4ucxhU5fw8Hzt Eg8Nxe4FUxBXXDgVa/4gSLG+m+ZhNQXz/fKpmoPAbMyMxHEAwZXhhBbyYNgHObru02cr hm0LkatvzgfG1fWf4/4ziRPyg2ZSwvLH1mQlHwzHJLvWtaoVv//cdngXGCTtTCkgfGVX qUxg== 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 :subject:date:message-id:reply-to; bh=5lc1shs6HgaujiRT2ti/1E0puXb58K6tNRWGGe1EnPI=; b=HBLVImT+qJRm6dHlMjyp+dnw0F4AdFwPJZcZgEErivvRdRQsjQKXdb8g/0qj7M6g0i ygCzkp7fVCkfWfK79t/UU87N62I0CC2ZN1LB9/bLDR26UcReitXhsu+ePKgJoNr2i1n1 F2jIB23MoVCezNNp9ecWs6WsgqDjpm6cKmPpGzStGo9i2Wul5WVCy5WPI5mz6GSlP5Jz jP2mopvnM1q3Q2YjbqC0gd8Hp90pXqnTtM0xSuuQEtlCykVhAJ+GpzbKU/rGU1frMqFt Pp7RqLg0cN+AUKeNgkv7NEC/QH2Ia/geRlTycnUKAAGrFtW5+sj3VW2Ok9myC/aYIKzk W+XQ== X-Gm-Message-State: AO0yUKW4qvwikAVRC5pI9aOCSX4cbYSTwadOROUxVQEXv5UnYdQqy7vi RdTkfQyMyg4jLFz8rOvAfBT779FaJ5XulBvk5sA= X-Received: by 2002:a17:902:dad1:b0:199:4934:9d33 with SMTP id q17-20020a170902dad100b0019949349d33mr6111347plx.15.1676526482759; Wed, 15 Feb 2023 21:48:02 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 06/15] linux-user/sparc: Fix sparc64_{get, set}_context traps Date: Wed, 15 Feb 2023 19:45:07 -1000 Message-Id: <20230216054516.1267305-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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 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 These traps are present for sparc64 with ilp32, aka sparc32plus. Enabling them means adjusting the defines over in signal.c, and fixing an incorrect usage of abi_ulong when we really meant the full register, target_ulong. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 23 +++++++++++------------ linux-user/sparc/signal.c | 36 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 2bcf32590f..edbc4f3bdc 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -213,6 +213,17 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; +#ifdef TARGET_SPARC64 + case TT_TRAP + 0x6e: + flush_windows(env); + sparc64_get_context(env); + break; + case TT_TRAP + 0x6f: + flush_windows(env); + sparc64_set_context(env); + break; +#endif + case TARGET_TT_SPILL: /* window overflow */ save_window(env); break; @@ -220,18 +231,6 @@ void cpu_loop (CPUSPARCState *env) restore_window(env); break; -#ifdef TARGET_SPARC64 -#ifndef TARGET_ABI32 - case 0x16e: - flush_windows(env); - sparc64_get_context(env); - break; - case 0x16f: - flush_windows(env); - sparc64_set_context(env); - break; -#endif -#endif case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index b501750fe0..2be9000b9e 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -503,7 +503,23 @@ long do_rt_sigreturn(CPUSPARCState *env) return -QEMU_ESIGRETURN; } -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) +#ifdef TARGET_ABI32 +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + install_sigtramp(tramp, TARGET_NR_sigreturn); + + default_rt_sigreturn = sigtramp_page + 8; + install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} +#endif + +#ifdef TARGET_SPARC64 #define SPARC_MC_TSTATE 0 #define SPARC_MC_PC 1 #define SPARC_MC_NPC 2 @@ -575,7 +591,7 @@ void sparc64_set_context(CPUSPARCState *env) struct target_ucontext *ucp; target_mc_gregset_t *grp; target_mc_fpu_t *fpup; - abi_ulong pc, npc, tstate; + target_ulong pc, npc, tstate; unsigned int i; unsigned char fenab; @@ -773,18 +789,4 @@ do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); } -#else -void setup_sigtramp(abi_ulong sigtramp_page) -{ - uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); - assert(tramp != NULL); - - default_sigreturn = sigtramp_page; - install_sigtramp(tramp, TARGET_NR_sigreturn); - - default_rt_sigreturn = sigtramp_page + 8; - install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); - - unlock_user(tramp, sigtramp_page, 2 * 8); -} -#endif +#endif /* TARGET_SPARC64 */ From patchwork Thu Feb 16 05:45:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654014 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178171wrr; Wed, 15 Feb 2023 21:48:50 -0800 (PST) X-Google-Smtp-Source: AK7set/aEbax6/BF+Likr8YPiVkmDfhnws/NS8Gj3U9znsP7iLfzQ/KIrI5o0lvUg//ih7aQV8TG X-Received: by 2002:ac8:5ac4:0:b0:3b8:2e36:efd with SMTP id d4-20020ac85ac4000000b003b82e360efdmr7518970qtd.55.1676526530658; Wed, 15 Feb 2023 21:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526530; cv=none; d=google.com; s=arc-20160816; b=MciIeMObO7RsJLtlbEm2QhdyyCkVWaUyAjYAE/XWbfEcxIBT60BQV3aiLcAjTRvZkR DBzG7LrV5uYn3GflgrxCOF49kmb+pgxPVQ1SmbIrkuJY1HFe+JwAlOKGtju9IfyxelM5 3k7gp2VAYihOfAThfT9nRQ6msqCRNOzQv/jBdvi8cT8bTC24j1sgszqJJMW0MK+DZVPs Ma97pbRY4FeLYsv3pfC7WeYKpUOJT4mlTX6dKktim+J6cAMoj+Xisr1RtUZwzNQHI0fP LlpRrqYYwLhBYv3MTnOqs31SwMIjFwJtviPTuI/Eu2rhZpWffwVBL+M5PtH2h4OciQXj sxQg== 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=nwwEZS3IY8awyA29AWhLSBTJfEFo65LkYzhDCm7Aots=; b=MwrQg5n1h7OI21x4IkUkoSaQqBTqnXcpguEW8akunKN0mKH+wFosgKdPRMArGeTbsv eYvirpqH6TiORgl85PT82lF3icOCRwe7NbSoEr2W/xhCP9NNJwybiSCQdaeNOCaDIrpD oK67wT2FM1U2r4oq4+53UQcq3MzQh5nFaZuaxrmWdFU6xEr+WlSY7A6WewH4qCG1+6Cs yBNQECOlAVSbNuBsuf6YVpZELrfLxihXuSotxVy3talHUIdRTcfyT9Cjlji9+4jPIna1 8ZZdSIy6CTGqS6iAk0MWQY+nEqvbNm409bbV6U2PQFpaEQ/haEBQmLs68yZFtCTMXQAp JSwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q2qsPbeH; 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 m1-20020a05622a118100b003b686c06bf6si850770qtk.384.2023.02.15.21.48.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:50 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Q2qsPbeH; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7p-00045g-IG; Thu, 16 Feb 2023 00:48:09 -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 1pSX7n-00040b-Ks for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:07 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7m-0005PY-0b for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:07 -0500 Received: by mail-pj1-x1036.google.com with SMTP id gd1so864172pjb.1 for ; Wed, 15 Feb 2023 21:48:05 -0800 (PST) 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:subject:date :message-id:reply-to; bh=nwwEZS3IY8awyA29AWhLSBTJfEFo65LkYzhDCm7Aots=; b=Q2qsPbeHO32QlZccTd8vPfrj4vY4qHL1tKim9kQChPhw+ommKTfWdM0+sYikGZ4/u+ fmVllyIjVzRCTWDUQu0zE0+QhXSGTvRs8bxD2f8YODOjdtn0o8zgiLtfZwy2bCGOBcrX m/gIBbMcj/QcgZTywWMMSjwWoUgxLiGPme/4bwVj2D6lbqet4ZdZhB+6Puj9sdcNWAAG eTPXHI3TxS0d9EOqOaBomAQr8AyD1tt+N0WZD782C04yz0/uofuPHExexGweJhaCrc3C IWGiaRW72KEa88CswtsHLSh0WX+08/wxZ3Tf/OuUWNG7QUSegv4m90c7Vpl3hpT5u8wd ljlQ== 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 :subject:date:message-id:reply-to; bh=nwwEZS3IY8awyA29AWhLSBTJfEFo65LkYzhDCm7Aots=; b=M/7FcT36CzZbHBuQlyDgyX9SJA3bo8U1GE+ghfdjL6wL1wvKl9Pz4NAnnE5tuFCJ/w VXu4V6TzqelZ4flfuQwOpepYU936QZmARGlC2Yka/ppLg0OQJ4Jj9LPnnHzFti3t7K0z 0BNg5uLpJJ3ALTEvUCjE9BvdnS/z+mgbeRnnX44J7zI+lJNBv/MDyjtCzkgseNv1Lw0f gPAIEU45MkvhqZnnu4zp0dMHwhydaucRQH7HTgqDzmOOErYx3prX6CVWxW7KJE1H4oqj cWuh7MRu7FZmPS/FiYT2RSr0t4/tBUFEgM0fIEZgSxFMe/DbmIvOlqXEqOWLoGcvSybe 9o8Q== X-Gm-Message-State: AO0yUKWs8SxQNF8FFSNTAFYT57j+reSjKZQtconvTZNXVgTe4fBz3A39 uddJ7fbWvk9fcbriPkLdoZNfaAKLvSRyRpV1H20= X-Received: by 2002:a05:6a21:78a0:b0:c6:d8bf:265f with SMTP id bf32-20020a056a2178a000b000c6d8bf265fmr4026741pzc.28.1676526484522; Wed, 15 Feb 2023 21:48:04 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 07/15] linux-user/sparc: Handle software breakpoint trap Date: Wed, 15 Feb 2023 19:45:08 -1000 Message-Id: <20230216054516.1267305-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 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 This is 'ta 1' for both v9 and pre-v9. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index edbc4f3bdc..c14eaea163 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -206,6 +206,11 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; + case TT_TRAP + 0x01: /* breakpoint */ + case EXCP_DEBUG: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); + break; + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ @@ -237,9 +242,6 @@ void cpu_loop (CPUSPARCState *env) case TT_ILL_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; - case EXCP_DEBUG: - force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); - break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Thu Feb 16 05:45:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654012 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178106wrr; Wed, 15 Feb 2023 21:48:38 -0800 (PST) X-Google-Smtp-Source: AK7set/10u5Q/f2ygrFlOZJoK2QAiBG7b6rnToka+VLO2rFxZi61WYZ4ZDqQa8PNOHzfLUUJfrIU X-Received: by 2002:a05:6214:27eb:b0:56e:b30a:142f with SMTP id jt11-20020a05621427eb00b0056eb30a142fmr7751326qvb.14.1676526518036; Wed, 15 Feb 2023 21:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526518; cv=none; d=google.com; s=arc-20160816; b=m+tGYYV4GeX5+7q0vAIkXMC2+SEhUL7Kh1DGWfPumoq6WISQ2fd0tHKdPn8ZDR6gVi erM4paiwu1oVvn7/ymko4/87Q7WZ09P4qe2pHYNbFcoBBwn1YyNHtvYL/e39pftGwhIz zDMQPZ1Nxp8mv4y6axlQSDJEQGY9pUseEQR5/ZgNvCC7Pue78PKPksx80u+ct2b69jO2 mMqcq8ZzBGbtA05eZmxKCG2pkRoXeGW9XshtFuDzkWs5mlv4smqEtQio5W5FAz4u7NFU VmMcsuhcLVouDW8SPmwOWm9OxDuYxw8TunzrqJ5WIb1ypy8lL/zVRXBmDelpuUG2715K Vvnw== 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=KEAS/y4KNGAZ69Ie6TWO3D+vLA+vLuj0brYQYKVkagM=; b=gtGzuG7CqK0jhj5up2tYnoSp5JEL5VzOWVEq8stQc44yBL1xh0mFK+D2MGE7nywfuQ O0f5FgkjOlVXLOimJAk1qtjZEOjezaKaaOIu8Z1u2vRru0h9lKt8xYlyv4xi8RPm4kQ+ 5UVF0EYqQWwShIwTX56uQDrbjxWCYoQKDQ81pTKsDVZn18OWtU+fN59jV1cSyvr+YKmP +XrEAHqM/3Z9ncqeewc/uduS1A/4lYlt9jYnjEW0QR4HqK9BEdkuegM804wqrVdbrTrs aMiry7NtlFLH7rpFFDXaIhiViJlg7523obdm91irezkQIGdZ4VZEfRKXvjRwznYXKaS+ OIwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AgkGz9FM; 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 d12-20020a0cf0cc000000b0056e9cad6bb6si464314qvl.170.2023.02.15.21.48.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:38 -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; dkim=pass header.i=@linaro.org header.s=google header.b=AgkGz9FM; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7r-0004AM-DL; Thu, 16 Feb 2023 00:48:11 -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 1pSX7p-00045f-CR for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:09 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7n-0005Po-QZ for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:09 -0500 Received: by mail-pj1-x102a.google.com with SMTP id d2so831418pjd.5 for ; Wed, 15 Feb 2023 21:48:07 -0800 (PST) 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:subject:date :message-id:reply-to; bh=KEAS/y4KNGAZ69Ie6TWO3D+vLA+vLuj0brYQYKVkagM=; b=AgkGz9FMADk2m7a001mZe0XMkPa3ZGm5T8zPPqRqBsSHfbswfzyYFLk9Xzw0S+i19B yE/onJreUEu79YZ8PcsAYFb9OMaCtKky5gQEPP8QqlH2Y7gKo53tjBciO4C+rcPpueoS e9ERLs3A2ad+sgnfWY1mQr6ftPBwBIsVmUXkTG8bMSVxIo8d2ATmlBfLmyZsdElJUH/J 4Y3vdO5ZI4xEE4d9KqPpmqGh0SDZ3m4QM9811IKL6d72fxIcJUyts3c4+ngpt42bQfTc wh8HB4sVK7SJJl+lsS0j4+QRNoB2+895fxN+jdI8lSfvlF8KS1p8FwOI+Jegt3mF9zRA ORnA== 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 :subject:date:message-id:reply-to; bh=KEAS/y4KNGAZ69Ie6TWO3D+vLA+vLuj0brYQYKVkagM=; b=dO94Vl9K79gG7iaLslAoovcGbHo9QBQIAEMkR0miVR+HcczCBZA7zaDURF+Y09k8li TmAzF/2k5qfYEaxMn5nGXdC/ie7Gtc77mHdx5z0/5CLy+dlf8W+nW11tTnPoG6rVlm3b rVeMybMV3wcRIYJrx+ZifWN5ykgzX7TgoRKP1W88QhdcxTjbsy8ZOtrPbbb49KaXpRpe B8ElR1BsYcHM8EO0VldvGmhI49+GPKTzJ8wVglus/XGWXj5A9O6EsMc8JZV02iHtbkGM TDJGeeJqdtyx3g5iaRzG4r16/vfvN+YZ6NXZPh4Lc64sM+iYgT86HJLMpw2P2T6cqics hERw== X-Gm-Message-State: AO0yUKUgi5qQ3PUVvqpgcHtPGysY42tAHB3eqNfIxlqh6YSSsBdYhztj 0+YCbi0OZasS2Mvx52zEHRqMcJKUynDWulwkyAI= X-Received: by 2002:a05:6a21:32a0:b0:c7:164b:8ab7 with SMTP id yt32-20020a056a2132a000b000c7164b8ab7mr1746151pzb.22.1676526486308; Wed, 15 Feb 2023 21:48:06 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 08/15] linux-user/sparc: Handle division by zero traps Date: Wed, 15 Feb 2023 19:45:09 -1000 Message-Id: <20230216054516.1267305-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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 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 In addition to the hw trap vector, there is a software trap assigned for older sparc without hw division instructions. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index c14eaea163..e04c842867 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -211,6 +211,11 @@ void cpu_loop (CPUSPARCState *env) force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; + case TT_TRAP + 0x02: /* div0 */ + case TT_DIV_ZERO: + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc); + break; + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ From patchwork Thu Feb 16 05:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654022 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178519wrr; Wed, 15 Feb 2023 21:49:59 -0800 (PST) X-Google-Smtp-Source: AK7set/vb5sFwKrDpFQsBn0mcZmgHI3G+akMBvHsUYLqvMwpcIK06iHSRe7v2nESDEgt6ICuoBQz X-Received: by 2002:a05:622a:608:b0:3b9:beca:8d79 with SMTP id z8-20020a05622a060800b003b9beca8d79mr8477224qta.12.1676526599713; Wed, 15 Feb 2023 21:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526599; cv=none; d=google.com; s=arc-20160816; b=o61YtQ8e9ka3O21TpHQnz2cn+oEf6U7jjbQCSUnkn40NVhlo/mf2XjINogDbu/BqHX NvwrR5hkwZvLauj9eO/TiwL88auR34VOZ/3XLR5aYPrkAECgKAQcRdrPJB3h2y8FxY68 XxjQMg8dqRilRdHXNyUeCj41QO5eIR81mEqr5oxL74pruYesGOZj40Hy28AEjGAVgymx hhX9DrEtDlhsJeVDRevKL5DC1XHFbXD2xRapHIpSAvid8lH1078SG4XPvxfC8x+a1C8N nX5j7ScLzrqF93Ods6+JPd9QXAA6iTmbq1fkiKFsmWS72bpzvjguOB1jRqyFyBKG7sFG QIZQ== 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=qSmbYBWQTF40Rva8qm3+N5zMD+1Xf6L67/b2nj4sg7A=; b=xRWVrYg5icbauxn+TiqJ+go6A2u80TSG1qWFHVqEaVxyOnBlNcbn2wn5iTYkOZ2N72 knu4Uf+ewogSc+S1CnW77lyjyAwI9EfLwtFebCB99dkJZip/9Vg1IYOEqH3HA2bUMsXn Wla0FrQztF271ua65fgKTKlxKHaBpIb52PDzJh6Y8Io2Nt9On7NK5P1Wjeqm//nzlkUr L0cy03agwL+xm2BXsQHFWcLzzWe2MiHg7T7d6dflzlydX53n7T4iGpPE4b0LoFg7eoE5 FWiQPHQT00Of5RAOInR6blwXPJnu65vXcTQhqCFBmM7qMwq4JHPZyCiWw5DIj8G9AhG2 SsMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ObhLEiYI; 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 x6-20020ac85f06000000b003b9ba127bfcsi838283qta.499.2023.02.15.21.49.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ObhLEiYI; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7u-0004Dp-Cz; Thu, 16 Feb 2023 00:48:14 -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 1pSX7q-00049R-UI for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:10 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7p-0005Mc-96 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:10 -0500 Received: by mail-pl1-x62b.google.com with SMTP id r8so1006375pls.2 for ; Wed, 15 Feb 2023 21:48:08 -0800 (PST) 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:subject:date :message-id:reply-to; bh=qSmbYBWQTF40Rva8qm3+N5zMD+1Xf6L67/b2nj4sg7A=; b=ObhLEiYI1mr83aGHLYS1qnkquYAQil6CcMmleJ6NuodZI12HQ+XtNI5UgsUVbZPZZK uWeoq1BM5dNZzRXI1gkN7t4UMSEOl2CQu7m56oqOe+iClHI/Od14Zhopo8V0RZ2pnx0O dgBuQ3jThqU/6hTTQ1PhrCTt2wY4OeW/TMGNskUe/DpYsqQdIfnvewRZ2tu+Bc2mfNLQ HT6fr14WF7+A+Sv73d9voU/qeYDdtclqr/AhEQxINxDZChTNx78tGT69V24sw0qCt9ha k7zWYHJTC9hxQ6soHkUxr8JZKFRAWrP1aOpHy3szPKkh/s8QCKMfWP74W90c3hILkIip FEow== 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 :subject:date:message-id:reply-to; bh=qSmbYBWQTF40Rva8qm3+N5zMD+1Xf6L67/b2nj4sg7A=; b=NXBE4hiiFaBndMMCc0DF70JW4W30+lw5BnbLlkhXyet540Tb6bRmdoFraN6KbGHdXk AQSr9L914Nj1zdRFsesXCCA7OXnz8GITSWgL7/E9mfYSFKYDumPl4MXR+t3VIO+WxZo1 EWmoiDOizy6nIjZDvLngRimUmP0G36yfwdwnQMpbq8FVRYtY7FE8+fbsWEo8tGtjw403 swhBfuGdumPW7B8okcuWOq57JluejberT2Zv6oVRfG+9s+8ADBd8sTUaC3l+6S6aBx33 Kwmspkl8SQ19eLi2pfozvWM1Z+0tnc9z5mfpyr0H0vM6v1f6qBUCkRZMPKaEfu/CwoPC N5WQ== X-Gm-Message-State: AO0yUKVRVNyWBtZqEKCRWUiZF97Y78uAkjuF5RfQFB4c3Z/xaPfEnElR 5kUe9YPIrORo2pA5khE+8JB1jlDHJwqWy849KEQ= X-Received: by 2002:a05:6a20:7291:b0:b9:6932:7d71 with SMTP id o17-20020a056a20729100b000b969327d71mr4878058pzk.26.1676526488439; Wed, 15 Feb 2023 21:48:08 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 09/15] linux-user/sparc: Handle getcc, setcc, getpsr traps Date: Wed, 15 Feb 2023 19:45:10 -1000 Message-Id: <20230216054516.1267305-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 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 These are really only meaningful for sparc32, but they're still present for backward compatibility for sparc64. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 62 +++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index e04c842867..a3edb353f6 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,6 +149,51 @@ static void flush_windows(CPUSPARCState *env) #endif } +static void next_instruction(CPUSPARCState *env) +{ + env->pc = env->npc; + env->npc = env->npc + 4; +} + +static uint32_t do_getcc(CPUSPARCState *env) +{ +#ifdef TARGET_SPARC64 + return cpu_get_ccr(env) & 0xf; +#else + return extract32(cpu_get_psr(env), 20, 4); +#endif +} + +static void do_setcc(CPUSPARCState *env, uint32_t icc) +{ +#ifdef TARGET_SPARC64 + cpu_put_ccr(env, (cpu_get_ccr(env) & 0xf0) | (icc & 0xf)); +#else + cpu_put_psr(env, deposit32(cpu_get_psr(env), 20, 4, icc)); +#endif +} + +static uint32_t do_getpsr(CPUSPARCState *env) +{ +#ifdef TARGET_SPARC64 + const uint64_t TSTATE_CWP = 0x1f; + const uint64_t TSTATE_ICC = 0xfull << 32; + const uint64_t TSTATE_XCC = 0xfull << 36; + const uint32_t PSR_S = 0x00000080u; + const uint32_t PSR_V8PLUS = 0xff000000u; + uint64_t tstate = sparc64_tstate(env); + + /* See , tstate_to_psr. */ + return ((tstate & TSTATE_CWP) | + PSR_S | + ((tstate & TSTATE_ICC) >> 12) | + ((tstate & TSTATE_XCC) >> 20) | + PSR_V8PLUS); +#else + return (cpu_get_psr(env) & (PSR_ICC | PSR_CWP)) | PSR_S; +#endif +} + /* Avoid ifdefs below for the abi32 and abi64 paths. */ #ifdef TARGET_ABI32 #define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ @@ -218,9 +263,20 @@ void cpu_loop (CPUSPARCState *env) case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); - /* next instruction */ - env->pc = env->npc; - env->npc = env->npc + 4; + next_instruction(env); + break; + + case TT_TRAP + 0x20: /* getcc */ + env->gregs[1] = do_getcc(env); + next_instruction(env); + break; + case TT_TRAP + 0x21: /* setcc */ + do_setcc(env, env->gregs[1]); + next_instruction(env); + break; + case TT_TRAP + 0x22: /* getpsr */ + env->gregs[1] = do_getpsr(env); + next_instruction(env); break; #ifdef TARGET_SPARC64 From patchwork Thu Feb 16 05:45:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654011 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178093wrr; Wed, 15 Feb 2023 21:48:36 -0800 (PST) X-Google-Smtp-Source: AK7set8quJwgLJgaTVTIg9p+UlkNP/LvBtM7oOLdcd+t/Z6RwtWR+3jNRoSCtyFNYQ/N8CwG4sJl X-Received: by 2002:a05:622a:1741:b0:3a8:dae:d985 with SMTP id l1-20020a05622a174100b003a80daed985mr2073193qtk.14.1676526516785; Wed, 15 Feb 2023 21:48:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526516; cv=none; d=google.com; s=arc-20160816; b=W+4Mwen/vX0cN1RqiAR5QjUKdq7wjaKYiQakoUtyJEGXmwWokFuCTNuzls20Jsem0P XKKIG5aeuyDPuq19+Ep+KWpNis4H8/l3hWbmMLfRqorQ+rtE+S3SAh+h/Y26W0OFt0pa g4EmQG4NGfXeCSfXMLioSsAUMPScwN6yfyRfj6P9JRkKRvfU11D0HpykCXGyGilANrRR 4vz5bWcf1FcYbNRHNKI9kLMV1Vl9YwzB/FSHqON9jdoMx/pV8h3es9Jl8/qTSNg057fg NT54bP6dZhmi+xf2VD2LNT/lMFxT/Q+3lfF/gro07Iatcu21QnggeQHGf08Vfrm6qiAW g3fg== 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=lqIPx7LaEGobxbwlMI298ZSHYBP2+86sibEgBn2WTxE=; b=KuC2NFkz2JqH3M7UULQgP/BMwgizhmz1ouga95Ia/g5zSSdfys5j8/KYErOyPW03e5 iil43R6krcoTYBHgY9JTDYjfvq41+z5gcqCohnG+zCeVFCePULXfyHhCedYEOGXaQiw4 miJcDFCKJrcS9gICEejIjqzNIheO5dRo+z6Ft2hMRbzeenlYmhBtKhHWYF0qLHAJSIeH H/6FNurGAEmcbvW9oFSPliGcMnI+R0xhpnbF8+91xFL4UItONi4/1fP530ZJmAwmRlqD +Es5WhRPXMBkw+AH/S7B6jfzOhaino1CHmGvvzz0eRqB/52K+HUa0WXunWFDTOq+YMgv OlZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vt0WohoA; 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 i8-20020ac85c08000000b003b19d09ddf1si836354qti.618.2023.02.15.21.48.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:36 -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; dkim=pass header.i=@linaro.org header.s=google header.b=vt0WohoA; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7w-0004EM-M6; Thu, 16 Feb 2023 00:48:16 -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 1pSX7u-0004Dv-I8 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:14 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7t-0005Qp-21 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:14 -0500 Received: by mail-pl1-x629.google.com with SMTP id k13so1038769plg.0 for ; Wed, 15 Feb 2023 21:48:12 -0800 (PST) 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:subject:date :message-id:reply-to; bh=lqIPx7LaEGobxbwlMI298ZSHYBP2+86sibEgBn2WTxE=; b=vt0WohoA1cAZZ+XkC0u19HfvsvcOeOwvfQuPhMqa4fKBtv87tJrMT3UIZg7O0bfk7v PApNxu0mLvZgKpdHbIwaUCpD7URts1YNxJ6GqDxD+7ul2MlOWxwC66uLvK8OuQW9tsGJ Jd1Fn7kvsFRNCTJU8uvNSwC7xYM1XhVxwNyPYXi8aqnWQvahOgXCnqS7U2ylTvP1yvOD aZwzTlTUJOedFIt+0VpXCQF6CNtFbjyRAb8gGd8fHVFct7/qSrWO49L0sxF6RmgdhXQv 5KPnBpQfxfoZaRo6HvTuZXG5dNIGpu50jRwLWPxpdu+zDa8rBS/Vn6+fT157QzngzfGU tKSg== 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 :subject:date:message-id:reply-to; bh=lqIPx7LaEGobxbwlMI298ZSHYBP2+86sibEgBn2WTxE=; b=qeCAd1oMaP/8cUAIoTHVrhu/MeQlAMeEaV1GuwSzbTJImzxG/aRNZlNw18dF3M+mRW lYfeV9OZT6pX6llIWVDVSmGH3e1nSRgcVjUKKg/R0MUzzxdxZXIsIE1Tkx7gwtK26fW2 SsA+jlXRED1IfyRz/Ldd2OtYpqAgUhjL2hov5AsNpgy5202M3Wws223ZpxtDoHuo098/ ReaxkAXbFjTwfMy5NgatNtD6xKqvOR7MvcCST73Qus2rNznSikNNt421dl8dSfzC57zN LYz+4uq3I5PCnlogJwSVIuPy2OuGaT/Uy+hf6SGHEsH6u6wXjlpz2C/lnysTp0bVbPs3 WFTg== X-Gm-Message-State: AO0yUKVQg3H7iv6uRy7FX502bp5+L3w2IBU/Y+cFbvC52dOqUDNyWFKx tyc01VDm4ygMTtVyU854ucOMUOMtHQgR2FV/R9U= X-Received: by 2002:a05:6a20:244a:b0:c3:2bec:2afe with SMTP id t10-20020a056a20244a00b000c32bec2afemr1218127pzc.11.1676526491491; Wed, 15 Feb 2023 21:48:11 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 10/15] linux-user/sparc: Handle priviledged opcode trap Date: Wed, 15 Feb 2023 19:45:11 -1000 Message-Id: <20230216054516.1267305-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 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 For the most part priviledged opcodes are ifdefed out of the user-only sparc translator, which will then incorrectly produce illegal opcode traps. But there are some code paths that properly raise TT_PRIV_INSN, so we must handle it. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index a3edb353f6..61b6e81459 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -303,6 +303,9 @@ void cpu_loop (CPUSPARCState *env) case TT_ILL_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; + case TT_PRIV_INSN: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Thu Feb 16 05:45:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654010 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178076wrr; Wed, 15 Feb 2023 21:48:35 -0800 (PST) X-Google-Smtp-Source: AK7set8lk5XVX5ldZH45DTDKQWpsMxOO/1ZiLr/J8r/9gDug4/S6AI6uqivyZSypu/nqwt+FEL1A X-Received: by 2002:ad4:5b8b:0:b0:56e:92a8:e18e with SMTP id 11-20020ad45b8b000000b0056e92a8e18emr9259138qvp.31.1676526514963; Wed, 15 Feb 2023 21:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526514; cv=none; d=google.com; s=arc-20160816; b=MMFlEGFnht0ia1Ephzc5MSzHHSrjd4Syw7CdkEWpzy+QFRk3Kid9DPCgOTz2Mr0wwp cDGxCBjgdAhQe4qsWiGjE8eGSPuFaTRlySr6l91x5lCeahnT4a3+7OqHAVCR3TGg7o8q nmDO+J9AiqM7R4INWielX5kG46+o6IRE/j98FCqzuhX9Na6x4LDoakbHg26vWaxN9Z2D 9nIXmoMu3ahLAgyGmGxa0/bApYvHBk/WtOWpeclDGzfAdzvJ9zaLATHmmxuxwld6L18c pYqmZe0TBL19X4DwSXTn1ZzdhDBgnUU1DoZ3M+trRcnJ4JxAiOmoOy9CfxJvZBy6Yx44 Xtsg== 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=QQH43IIj0vMoTyNfpAs94SMYkwmuMc8FS4aDkU85qBI=; b=K2e004dFkSkirNi4Ujyow67uwRtJXBMq3HUHslUtAqgjeGqNUA5+BLXtjjFn/DLGN1 yvDX2mGs7BuZ3Qf34dCuXSfSQ2989V1Es0Aj7SoQHy+Ivus9Go2AGnsRtG3sDC7Pp/Th 1CAiz33nMpgPbNvym2yB9D73vneBVKIONg/wMgUW1HFgTbfS0eXQ/58KYHnTAtw4LzQv msLYs8tPcFQ/oDiP6kODxgyMEBMRceg1sztyYw5nGMg+rGEjWe75SG6c6SbqQW9bNZ+1 I92aRD0gkaIywLMLs3bM8qiM0ePHFR9iHuXw1vXMekx4Avp+cNgfAoRqvg96+dej12XV qcEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tW6dw9Mu; 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 l13-20020a0ce08d000000b0056ebddea6e4si457070qvk.65.2023.02.15.21.48.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:48:34 -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; dkim=pass header.i=@linaro.org header.s=google header.b=tW6dw9Mu; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX7y-0004Hm-7M; Thu, 16 Feb 2023 00:48:18 -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 1pSX7x-0004Gi-6E for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:17 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7v-0005RD-L9 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:16 -0500 Received: by mail-pj1-x1031.google.com with SMTP id k24so857819pji.2 for ; Wed, 15 Feb 2023 21:48:15 -0800 (PST) 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:subject:date :message-id:reply-to; bh=QQH43IIj0vMoTyNfpAs94SMYkwmuMc8FS4aDkU85qBI=; b=tW6dw9MuAU208GKuM1hRdHzi7GO0+vEEuEuDU7o+wNi2NvGt/DtNK0vvd384dC98j9 O7tLp+6nkIat9OQ9+FGnag7qETjDJk7YqnfZ/kGyB66EUQmfBxB/ZeH8P3gJuHvF01LK cgrpvXqmCchzRTD/NdduqA5Lyksw/HJOGR1b+7Ah261a9CuLocQa+DU62gB8GeWP7ok2 U3RLYYQDrSbErb0e/BlwargkEPkuY0xFNCKJ6DVSxOSoPy2+uW8eGzfY+m5ugZL0B1Ml q6SOm62obt4V2j9xeSgcpsUFrd0NCcnOMxhSP8nGmv12gDFiG5pIKUzaZ4KOkBeOOVaY G3yA== 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 :subject:date:message-id:reply-to; bh=QQH43IIj0vMoTyNfpAs94SMYkwmuMc8FS4aDkU85qBI=; b=Qn62Dpwsbsp4nEX8kEVZ8te2rJXC3jfaMia36mXPyLj7/EoSepFvWh/LKld6y0GeX+ JpyFgupGXsGHvQA8gu8iPVG9BbCoQeocM+1TIXH1fJLjAWYxp+LpNgpQlPAfD5zo8JvT PSIvFXRn6Vu6VZlprLXBP3Un3qwv+UXKKb9gu1pReQ9wDrViArw9madpwF2aUQjDNsaa Dyf1pRjANxhDVN8Lx3ujylPZdG3LFXWSqvwZ14HIHW+Re8w6kTIKiDGVH4PrMDQDUgrA lPDUyY0IXf39kTm/hN/NlnH/mlK/sXA4zC0WR+QUwTAaz1WH+RlACa8GhOxIKm1kK9j0 W+Pw== X-Gm-Message-State: AO0yUKV/cldpf3/J70O41aa/GTKT9W1CPe6pwCdMy0rlMEWaNvk1+FQK 2KZ/0afXdeVeD83d2VDWZO9GOirTZGoa6mGt+J8= X-Received: by 2002:a05:6a20:a10c:b0:bc:d651:f267 with SMTP id q12-20020a056a20a10c00b000bcd651f267mr5573881pzk.2.1676526494341; Wed, 15 Feb 2023 21:48:14 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 11/15] linux-user/sparc: Handle privilidged action trap Date: Wed, 15 Feb 2023 19:45:12 -1000 Message-Id: <20230216054516.1267305-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-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 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 This is raised by using an %asi < 0x80 in user-mode. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 61b6e81459..43f19fbd91 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -306,6 +306,12 @@ void cpu_loop (CPUSPARCState *env) case TT_PRIV_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; +#ifdef TARGET_SPARC64 + case TT_PRIV_ACT: + /* Note do_privact defers to do_privop. */ + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; +#endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Thu Feb 16 05:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654018 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178400wrr; Wed, 15 Feb 2023 21:49:36 -0800 (PST) X-Google-Smtp-Source: AK7set9K6hCturfdZchoL2+DIAjL48ChVDAtUsICfkZKTMSeXRlIKtCq2/pRprfvN9jMsUoARM+8 X-Received: by 2002:ac8:7f91:0:b0:3ba:3ac7:ccf1 with SMTP id z17-20020ac87f91000000b003ba3ac7ccf1mr7922895qtj.58.1676526576731; Wed, 15 Feb 2023 21:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526576; cv=none; d=google.com; s=arc-20160816; b=thFngUt8VltmtbwnX0J0X5nijKkW5JbCv2zqbSRY1a0V6UAFNwP+IaDjukHFJSMnrh fGGpWqeTHPlHVivSK+umTZE2qClsNX5JQ/xsKupavX+va7zRpwVa9/qoSoIvFMI/9kqJ oIY4Mre8lh8cj2VnrGvDKquaHoE92XyVgetSLOp6+vaCyW7W3Rw8QTwh/HKAq7lDVKEc PbC3FdJSDUKI8fHLm1kOlvlZrVEOqwkaKHuDCSH8+ugSRJq0YXcHIWnQb1bhMpf2zrtz H7md8b2Mmery+lcAyukU0EzDbxPAfWuQJAcvhCEavvNUaRNTo7jRmo5po3mkA0dEv2Np kQcQ== 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=0RV/Pw0nPLtehqObgMiaovu9PpCvAiBoNRoo5G4UtrA=; b=txfkgmxRqPTH8P4ZLv+tYTOoRreJ993Zt9Aew14OMWrsGqdi74mZkCwpAggOhIiq4h O5dpQvxkKfkrnQ9pQOfKs0sCxaC3OvSoiXTp1Zs2LnQSzZmxxFVsEML2B8nOpiHvQrXC 1efchxhQNGCpg/TMa5QE42Jjb+tGAOpO9X+lIClkXLh9olOxjFxuW3IJs0ysu18BfX1k Bn1ja+RJLhxWy5dqsSIeUXZCWnCQfPoWf/oIzmmFCOonZb8VDJx3IyAEelmCSMEoeFff 8YSg+6BkaSIKM0I2K8rEdpd7JH9QHfYJGz4CGfxEufo2QBW7SIPFypzReBnscolA76AT yOnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ibS+aqAH; 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 y4-20020a05622a004400b003acfa987080si879535qtw.16.2023.02.15.21.49.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:36 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ibS+aqAH; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX82-0004Jn-76; Thu, 16 Feb 2023 00:48:24 -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 1pSX7y-0004IZ-UN for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:20 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX7x-0005RM-A7 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:18 -0500 Received: by mail-pj1-x1035.google.com with SMTP id f16-20020a17090a9b1000b0023058bbd7b2so1145696pjp.0 for ; Wed, 15 Feb 2023 21:48:16 -0800 (PST) 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:subject:date :message-id:reply-to; bh=0RV/Pw0nPLtehqObgMiaovu9PpCvAiBoNRoo5G4UtrA=; b=ibS+aqAHi20YDxR6+3nRSJQIDs1qahGY3mJ7rc/E3Ls2SGd4tSDkVQGLnVo+/0p+/S 18GHHFyLmf0AKMVVrFHkivqVf4jqFgsAk5xNCBw0JQRvvDCDBaQhC6G+cBGOHHRFsNrN xpv/djp88Q5aZYoD3DwQCbQvbgW2dVUEQuL5YAGBxp1wY96VHPA/dFxuEfXxWyFzMAfc dUoxM8iTTbAzETGYGy+kQk9W8Fx9tEOff2vpHpjTFQFA58+loh7xm0mrh/PBX+IhRZQt Jyc5P9IwAoh7MCwh2xXHlTailYutoYUxtZLXC+TcNVteTIcnfpCooM9/QExelkyddZ0h G4fg== 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 :subject:date:message-id:reply-to; bh=0RV/Pw0nPLtehqObgMiaovu9PpCvAiBoNRoo5G4UtrA=; b=j9oHI0Tjnry6bB8sE8zXv5dNkrmv2HOvKSJV78HPK6mOON3lJV3uUj5Lmej31b39fD 6Fa4Dbqlk31dATPY9epvcfNL1xj6UeXGrqJBxIkK/sfUrw8M60Soq9GKMhRwmXb9XXux EVXgDon4XXsnSFljE3sQ1upuVNv73oAifaB/b6WvTEmYnanDDMx8ENdzw/AboV/F78C1 jX9Lg1sBLx8fVi8wxPRP3IG4wTQW1sn+qf7lpHG5yYtt01okuaC+ItqzsqObL6bd+UbA 2ImkzPuwRg1C4Ei7JZGl0Vfn3JMl6mZToVIIdKQMuhLctNx4Y5pZ4FcVdL1RkZKWeqLy DjjA== X-Gm-Message-State: AO0yUKWhtH1DmIgbfK2rIPM5rQj5xS0ucUnrClCmG8WlUq85Y9h88+tw KwpzSFwhx7Y2MXrlxQvG0HczI10MqMxfTJJpd10= X-Received: by 2002:a05:6a20:3948:b0:b8:90aa:1956 with SMTP id r8-20020a056a20394800b000b890aa1956mr5651413pzg.20.1676526495932; Wed, 15 Feb 2023 21:48:15 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 12/15] linux-user/sparc: Handle coprocessor disabled trap Date: Wed, 15 Feb 2023 19:45:13 -1000 Message-Id: <20230216054516.1267305-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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 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 Since qemu does not implement a sparc coprocessor, all such instructions raise this trap. Because of that, we never raise the coprocessor exception trap, which would be vector 0x28. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 43f19fbd91..bf7e10216f 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -311,6 +311,10 @@ void cpu_loop (CPUSPARCState *env) /* Note do_privact defers to do_privop. */ force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; +#else + case TT_NCP_INSN: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_COPROC, env->pc); + break; #endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Thu Feb 16 05:45:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654021 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178504wrr; Wed, 15 Feb 2023 21:49:57 -0800 (PST) X-Google-Smtp-Source: AK7set+5uH4hngIP/Eaf+lZAi8LGFeDOvTS+A0R1qdlHF3DA7TsuMnWJ/RxrvIZk2xRLXuambmm8 X-Received: by 2002:a05:622a:1ba4:b0:3b9:b112:e86b with SMTP id bp36-20020a05622a1ba400b003b9b112e86bmr8145111qtb.13.1676526597664; Wed, 15 Feb 2023 21:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526597; cv=none; d=google.com; s=arc-20160816; b=mYGuUe6sTHE43FXGcDmSkM7ufjaJEhUkN21lngrTCKCm8F/hrrnynGMWhaBtBh4WCr VGyP5OrG7SCJxEdhBtitF847a6y0jwONX5xWI13woQeyaKt52/8GReU5GpIFPjV1im22 bHAQbCO6maL+ZyYtGKIgrvOMtRX4ySCnxg03F/DMJgo/JMJ/OkGq1bPLxs+1NKckyg/D Poo1X7EVr8mxTur9jQsFmIH0tNX4vBDswnHC8K65/26mSp3jbG6zVbwR83k66WXCpnRz 0VN7yhLDmWrioaCIeBhL3Y/WpD0/UzgYz45aQ8Lx/BaHaZI47NcMEeQhWi8IUmDlsuui 0Zgg== 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=ADJUDCuJvLZTfwvvTitHGj1Ym2hlIeqZfcpR8Lo5PkU=; b=ahCKW5lgF/gOB11tHIIdOlZC+dHCxk9GxCYCDJNShjYZAlp7txSus5ovow1j1dYCCl Xxp/UAUmO10hWyAziiu3AObA7mY+/0GL8seuOpBBmhyNmNyIGqgyCDR1yL43MYZ0Hg35 J+OSdS6uXm0UVhGdcQKZmQVzaPWrhpwi7b1cFqN78xV3q76SsW+Hoa7eDilehWIHD7SE qsjA08IVqWHJR7a1vnFmpeVLoRwpv1lM1kCebDiRD8WuLr5n7lNpi5nP3XBHNKIj8eZA Ay/qdA/CCxWC0afOC+RheJ6ysZCb3ZmYJumUc2ZqfuZIg7nKxKUmKhDJEXZvajHWYDxs EfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eo5FFjz8; 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 128-20020a370a86000000b0070665b358ebsi714836qkk.139.2023.02.15.21.49.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=eo5FFjz8; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX8D-0004ZI-B5; Thu, 16 Feb 2023 00:48:35 -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 1pSX81-0004M1-Ke for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:22 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX80-0005Rs-3S for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:21 -0500 Received: by mail-pj1-x102d.google.com with SMTP id oa11-20020a17090b1bcb00b002341a2656e5so1115601pjb.1 for ; Wed, 15 Feb 2023 21:48:19 -0800 (PST) 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:subject:date :message-id:reply-to; bh=ADJUDCuJvLZTfwvvTitHGj1Ym2hlIeqZfcpR8Lo5PkU=; b=eo5FFjz8yLATRAi82bpjJ1onqV060Mw8G7Uyq7HZfRGzRbuAu4VIf+blALn1G7Dq5n Qvq/ECAVc9jZOBE1ODnOgsPT4NIK1tJm3WJcYadYAX7fTfs4KzIEoxf0cNhxhpC23aST zAvPJRsX24qO4rWAbhtG7L14OFwwgJUJFWPXI+STuTuEh1kB70IIONS/T0SHSJQWBjpv Twz5XkopgTS+P9kFzTLlspVzYa16EqOe9TNlkt1pfATSo16jIGND6IJ26zNeflzl3xZj +cSys+ZdrY1kCQwcWN6EJjKZ6ADsZQ9k4THf9+padckFQgT6aaO0ZBHFoHSDKzYcq/W6 AIcA== 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 :subject:date:message-id:reply-to; bh=ADJUDCuJvLZTfwvvTitHGj1Ym2hlIeqZfcpR8Lo5PkU=; b=AEmPOrsmQhGAnNrejQ+bVDGFIwv2lACFWc7iWViAumiSFMtv3UcIybgxxURyesy3KO 8E/Rm9YeuVv3Y421vqKH7r0swfyvW1o3+5iBqI3O7hHv8zqqh4Gu7BPSM4VhsX54eBXl F8c3NuuEY8YcS8jiGI1EBJu4OJJ+scFXDvj3hT6Um70tXor8XI0V0PQTxqAzTc3a5jvZ NtvodaE97HB/m14axBwo1vxLgfAtTYt84K4r7Thvkkx+9SIQGyK1PVPMccWnl2zQnHsS NCAzgxiRFKgjpJRb2aIXgjmg6rn2eAqP3cTtSJREErwVSw6jbhfSkf9aSoHspU9YvXVC orCw== X-Gm-Message-State: AO0yUKUEcFjPU6RwtpJPh9t6In4FjnaU6WncBK6VJyiwmp3C4PtIzpLc mvErD+qs5nlkyfSYBbSHa1Lt2i+BfliNQubYAnE= X-Received: by 2002:a17:90b:1e05:b0:231:bb3:b36c with SMTP id pg5-20020a17090b1e0500b002310bb3b36cmr5691012pjb.42.1676526498840; Wed, 15 Feb 2023 21:48:18 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 13/15] linux-user/sparc: Handle unimplemented flush trap Date: Wed, 15 Feb 2023 19:45:14 -1000 Message-Id: <20230216054516.1267305-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 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 For sparc64, TT_UNIMP_FLUSH == TT_ILL_INSN, so this is already handled. For sparc32, the kernel uses SKIP_TRAP. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index bf7e10216f..093358a39a 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -315,6 +315,9 @@ void cpu_loop (CPUSPARCState *env) case TT_NCP_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_COPROC, env->pc); break; + case TT_UNIMP_FLUSH: + next_instruction(env); + break; #endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Thu Feb 16 05:45:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654020 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178431wrr; Wed, 15 Feb 2023 21:49:41 -0800 (PST) X-Google-Smtp-Source: AK7set8AgMJlnWlkSv8WQhw9kLSxpfz8gK4z31tqcRziHZZp6YAKYU2XHpOdwcl09r5SvBPnueCI X-Received: by 2002:ac8:7e84:0:b0:3b6:2f3f:2713 with SMTP id w4-20020ac87e84000000b003b62f3f2713mr8487544qtj.25.1676526581581; Wed, 15 Feb 2023 21:49:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526581; cv=none; d=google.com; s=arc-20160816; b=SuY2f8yZHJP6oK/P6HhInjtVPGjFo2A+Zwfs3nJAefVbniqtWlvvIwKT8lthStYEHr zUn+jx2myEIk6wwPtQ4837IKMdtzrnDV25AlRQX6nq+JpTbQERBY2K9DGLwh/1/NAjJF auaQrxqjszggl8RdIQeHxp0qWkV12FJ2NtTtYXKISBoktpSX4nCmE1G9Q2gIgVq9zGpT Bo85XaRjpaDzmke8A+YLgnWNis1kM5Kw+TFadiyrD6eJj8It2KCoDEUV88b3+Flb/JXe A1+v5AHoOs/4ptQkJGAmkui5OgiWviFGZIveAR1whQFXmHFFeeCRX35/VLjEdVyJynC9 g+Zg== 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=KDYAg9I9XuYyh8hpIEHsfEqclaDeqHesV69onSq1kZI=; b=Wf8OYIT/8ZZuV3y3LlA4iXqmAgbWuVQLHApB0mEzRapYU1W4zNqqDjgxbl6DIsGQfO 463rX86afTeOm6ZmxYyu0weT/zFEAgYwvL7Y7PS5I4uats0si2uV8ndeWDDwmandsClE 2fyO1rmD03pRlqtNGhXuXHDlSsmzJn/11dkidI9YUFdOQPGLpK0XyYLsgR/Vo23djDXN Lr0xYt3Qm6vlZaZIGnaCWwMnD1hXKxnHZtp+H2FLtfNyR2+uUJMXxsIHWqBzqYCsfa7T Y5A7sWQr/6qk152QBva3Q1gNdPZHV+7G4NE+b1HzwZ5wHmS4qqO/2IiA546ZpGaz/x6P t2Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jmHyrIza; 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 bl40-20020a05620a1aa800b00721db04a4fasi746936qkb.252.2023.02.15.21.49.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=jmHyrIza; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX8L-0004of-7o; Thu, 16 Feb 2023 00:48:41 -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 1pSX83-0004Ux-BI for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:26 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX81-0005Rz-H2 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:23 -0500 Received: by mail-pj1-x102c.google.com with SMTP id n20-20020a17090aab9400b00229ca6a4636so4786979pjq.0 for ; Wed, 15 Feb 2023 21:48:21 -0800 (PST) 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:subject:date :message-id:reply-to; bh=KDYAg9I9XuYyh8hpIEHsfEqclaDeqHesV69onSq1kZI=; b=jmHyrIzahPLDXsOmIsPHZ4tg2OiSnp/vI0nw74/VGHNeR27wFiMSOjxVOGd76SEosJ YzuCGyYUDytU1b5n/73N9ySSZvMxBIJfE/USGSazrE7a8ZwL2FjrVYWObbDBklN9sr/k hQfrSiBUI9MMw1gxmhp7iIgMH8Ed9bJyd68RbmMWYBViIjFvXwGAaIxVFN+NogCiFgO3 RHPogN8E/KFc2RTbyFpaheumA74ujjuyVKuREPVkHyiGDz9JorxDrauB+TUz+o+tQhrD hn5jB14xDwb5COOgahMjumOORDOGgpVK66NB/3bKZbH5SuiH3jtIZcbOgaZC8OjQdBqJ gqrA== 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 :subject:date:message-id:reply-to; bh=KDYAg9I9XuYyh8hpIEHsfEqclaDeqHesV69onSq1kZI=; b=0hKEPXoO7WVd/NBGDYjnh3R5vXvLI7hpRruE68qnJNVwCQAIZq+ZTA8dANOk0qjT7d SSczcQoKd4vRFmzwpjgCsLyVxnVIAvgKTMOpfN2b7WFxoWIEi4NJHj/QCfMx4FlR8yQ2 n+oDjpUqBidhf9lIP87e7tWdpOSEh+tXF5jVkVCrtpDIea1hdIyT22ASszqHixMfXSEq qDP6jVFbruSR9YER9MveBT6E23VnRt/nmgeFOO5HkEOkf/6LEhpPNZDdocfjb42HAvnU z+5Oz/k7SkSEPlLWTrKw7yoZnwkap4GqC89qRAf7U7didZcSqKj6CW8USGQkPm92bthS j5sQ== X-Gm-Message-State: AO0yUKWtqx61lNMpRUq47Nq/azrJKEabu1k07wBCtyqBSxB5jX8CnQeH GK27zupIs1Tg9Ahtz6e21Zq3Q8ZkpbOle7Mwlw0= X-Received: by 2002:a05:6a20:a1a5:b0:be:b878:6d77 with SMTP id r37-20020a056a20a1a500b000beb8786d77mr3603822pzk.1.1676526500213; Wed, 15 Feb 2023 21:48:20 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 14/15] linux-user/sparc: Handle floating-point exceptions Date: Wed, 15 Feb 2023 19:45:15 -1000 Message-Id: <20230216054516.1267305-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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 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 Raise SIGFPE for ieee exceptions. The other types, such as FSR_FTT_UNIMPFPOP, should not appear, because we enable normal emulation of missing insns at the start of sparc_cpu_realizefn(). Signed-off-by: Richard Henderson --- target/sparc/cpu.h | 3 +-- linux-user/sparc/cpu_loop.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index e478c5eb16..ae8de606d5 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -197,8 +197,7 @@ enum { #define FSR_FTT2 (1ULL << 16) #define FSR_FTT1 (1ULL << 15) #define FSR_FTT0 (1ULL << 14) -//gcc warns about constant overflow for ~FSR_FTT_MASK -//#define FSR_FTT_MASK (FSR_FTT2 | FSR_FTT1 | FSR_FTT0) +#define FSR_FTT_MASK (FSR_FTT2 | FSR_FTT1 | FSR_FTT0) #ifdef TARGET_SPARC64 #define FSR_FTT_NMASK 0xfffffffffffe3fffULL #define FSR_FTT_CEXC_NMASK 0xfffffffffffe3fe0ULL diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 093358a39a..5a8a71e976 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -297,6 +297,28 @@ void cpu_loop (CPUSPARCState *env) restore_window(env); break; + case TT_FP_EXCP: + { + int code = TARGET_FPE_FLTUNK; + target_ulong fsr = env->fsr; + + if ((fsr & FSR_FTT_MASK) == FSR_FTT_IEEE_EXCP) { + if (fsr & FSR_NVC) { + code = TARGET_FPE_FLTINV; + } else if (fsr & FSR_OFC) { + code = TARGET_FPE_FLTOVF; + } else if (fsr & FSR_UFC) { + code = TARGET_FPE_FLTUND; + } else if (fsr & FSR_DZC) { + code = TARGET_FPE_FLTDIV; + } else if (fsr & FSR_NXC) { + code = TARGET_FPE_FLTRES; + } + } + force_sig_fault(TARGET_SIGFPE, code, env->pc); + } + break; + case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; From patchwork Thu Feb 16 05:45:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 654016 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp178353wrr; Wed, 15 Feb 2023 21:49:27 -0800 (PST) X-Google-Smtp-Source: AK7set8umDxuI1E5+MJRtg8diRE7zsS0PY813ugPHB09j5fg5h7/OUBgJyHp9DRi++E4kmBmk1yy X-Received: by 2002:a05:6214:202c:b0:56e:b16d:ec93 with SMTP id 12-20020a056214202c00b0056eb16dec93mr10217951qvf.4.1676526567703; Wed, 15 Feb 2023 21:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676526567; cv=none; d=google.com; s=arc-20160816; b=Q6UWzseiZJ/CrTBWqeqm8/xEtKLwdnbhPieGmeDjjkt1OuGSZKFTW1XSbqRwJ2efjA r5mK5JJsBbNFD/fD7K7LKHFjk83v6Gi29LahNCJbgOlT1tEYzjgtOtOnGOo4o6bQCu/Y taVkyc6iOlekZtfPXzISTw2PQhec3wr7G4tC73a1SnegMPyLgLQYpskQ4y8r1OIw6HV6 ZW2bEtbsHoWeXRAnOSNPN/06cJ5w563Ut/U9KyeKcYyxFV46itZoXCQzGuYKfA1w0SqV f9X6J6LHAOR//1g4poazFTJ8UOjOqDDl127EQMyDoq6tRa0EsB+2Wg15fGn9U65b41F9 ZoLg== 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=6To1l/rwYRVp7otgwGVfmpklbsVH868KF7IZeYGHIKI=; b=aWPQcfsGkbquH+ybqZ/SR5BM7AGR3QYvr22h2YuXt2j3foHBAyruvPTwUMogZ5yBxn WbPQWOhmQY67pseITzYER5mpmAqdUgPJM41aB3g2gRgEXLsX/N2+Sxxv3l03iKpz1OJ7 FZqieoWvOgctAFvE9modI93ATmej0jOoT2BhHj0pf17GWDDL2vcKdBkOvwQ+yuBYIUEM BXZYUfrehGK4fpBs6QstJ7f4zJp5rt9LABT9TJhcGYd6LAPaaCwOHSttYKNn/vOuCzsy KafpxK27NHXYAA9le/0qs+ikZYanY/1O/h6EiLR0lRYC2mO9DDQkkWR7OmkZhaFRDdGJ zSsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H342DsQn; 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 t7-20020a0c8d87000000b0056e93b6d992si450327qvb.78.2023.02.15.21.49.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Feb 2023 21:49:27 -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; dkim=pass header.i=@linaro.org header.s=google header.b=H342DsQn; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSX8O-0005FV-1F; Thu, 16 Feb 2023 00:48:44 -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 1pSX84-0004V2-NB for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:28 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSX83-0005SC-28 for qemu-devel@nongnu.org; Thu, 16 Feb 2023 00:48:24 -0500 Received: by mail-pf1-x434.google.com with SMTP id j184so753220pfg.10 for ; Wed, 15 Feb 2023 21:48:22 -0800 (PST) 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:subject:date :message-id:reply-to; bh=6To1l/rwYRVp7otgwGVfmpklbsVH868KF7IZeYGHIKI=; b=H342DsQn2aeKcFxR+fxJWoTKbrQEl1cl2RawPxaEUK6uYaTW8LCbX6Z0TO2uh+uvF6 uya/2KkLwRs6YUSltkqLWAhSuC8OuJw/HXiSMBZ2DlvERRQ5680BROUE5uCKLqC0lh8N 13SxdPQDxtw3TZWa2rzsMML3H6cf5wp9+qmo5gD1LZg2MZ+cUrTCYAUXkEsdcbRrbG2n Rbjc1woUU2LVeDttMPS+Y7Di5QfFcOISiWa/83nj+t+I33fAJ4CUAi87zAKsVC6Yd3gK 6fGqoxIktnsZpDY8zmWzj78xG3G80ra2eixzKkWK8XJ1kGSXww4UYfBFI3miMeO8Arx1 oCsQ== 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 :subject:date:message-id:reply-to; bh=6To1l/rwYRVp7otgwGVfmpklbsVH868KF7IZeYGHIKI=; b=q/A3xCRzKob8N3P5lE864L7SNP4mC2wD73CfghEXtOSCwmpSosOR83xThz6OjZskBq ONasI17ioDVGLl2+Wl+CM6l3/kGj/p/cEFC59DjfZEfzoF5QW+x44fs79ZnjoMDZQ+yS 3RGTmmRNlelTBXcdM5n33V4A4dOzX2oyCBwIrKW2wqgaAyTsyE+mWGj1dPT04IDUUpyQ 1eeebkrHf1V4b4GDJTjFI77iQ6T3rpJDS/ZPfsyb6qr80kGKWVimIZkGmSScX6SSKljD 64lz/g6pjs8xVlSMDkuj+eZsHJQJrYgU/cLLJyR1eUxIuB6p65RI12b1DKKYRLEjVKuv cW3g== X-Gm-Message-State: AO0yUKVEOhQ2hv5nFigq6kz8nZ8Ayjs6VT2qEbNs7d+YCEhYSs89vCDP gklZFdbfaxj/fD9zga//bVFKrDcJGYE0GusLmEU= X-Received: by 2002:a62:384d:0:b0:5a8:af22:32e7 with SMTP id f74-20020a62384d000000b005a8af2232e7mr4606483pfa.6.1676526501591; Wed, 15 Feb 2023 21:48:21 -0800 (PST) Received: from stoup.. (rrcs-74-87-59-234.west.biz.rr.com. [74.87.59.234]) by smtp.gmail.com with ESMTPSA id j184-20020a6380c1000000b0047917991e83sm358034pgd.48.2023.02.15.21.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 21:48:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v2 15/15] linux-user/sparc: Handle tag overflow traps Date: Wed, 15 Feb 2023 19:45:16 -1000 Message-Id: <20230216054516.1267305-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216054516.1267305-1-richard.henderson@linaro.org> References: <20230216054516.1267305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 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 This trap is raised by taddcctv and tsubcctv insns. Signed-off-by: Richard Henderson --- linux-user/sparc/target_signal.h | 2 +- linux-user/syscall_defs.h | 5 +++++ linux-user/sparc/cpu_loop.c | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 87757f0c4e..f223eb4af6 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -8,7 +8,7 @@ #define TARGET_SIGTRAP 5 #define TARGET_SIGABRT 6 #define TARGET_SIGIOT 6 -#define TARGET_SIGSTKFLT 7 /* actually EMT */ +#define TARGET_SIGEMT 7 #define TARGET_SIGFPE 8 #define TARGET_SIGKILL 9 #define TARGET_SIGBUS 10 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 77864de57f..614a1cbc8e 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -717,6 +717,11 @@ typedef struct target_siginfo { #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ +/* + * SIGEMT si_codes + */ +#define TARGET_EMT_TAGOVF 1 /* tag overflow */ + #include "target_resource.h" struct target_pollfd { diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 5a8a71e976..b36bb2574b 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -328,6 +328,9 @@ void cpu_loop (CPUSPARCState *env) case TT_PRIV_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; + case TT_TOVF: + force_sig_fault(TARGET_SIGEMT, TARGET_EMT_TAGOVF, env->pc); + break; #ifdef TARGET_SPARC64 case TT_PRIV_ACT: /* Note do_privact defers to do_privop. */