From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526380; cv=none; d=zohomail.com; s=zohoarc; b=EQs02COGyC30iCcE4Zq+pon90Qt7N9P8nIzJsaibeBTP4/Ox+KW9fLI/WEDnR3P2s6y4qAPBNTsSo0AR2RcZcR8TdTlS9qC8DEjshuqgjmFR5KFqNDWV18+lB951jMQeDdgpb5oP1/Xzap5l0UkBAbwzPXp2JUFVuZOB0AQgax4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526380; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4zhGePcD91yQ6ch+7pxzLZ4Aayz4MXPEoGj6QOyVgUM=; b=lP4zqQaetu9uaqIA/4jmbDAcYdOwhw7gQdi9irE+uGC77sR4JK/obrj6MLxlB/cw3pSLIKYnb0Drn/K3Yoy4YkI8l7ktC+nz9atiCOmO7Lng1cxGGxVFaDvG/MC4EfPJ+23+SByWXhzovoMr7ewKvfra6F7a3AM6vTv/T3epq80= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526380645597.0863518597957; Wed, 15 Feb 2023 21:46:20 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+Jk2ghDpboaawoTpxIjHvz7SsHU48wLL7Lcu3TrnTjtI0ptGxr5jOdYCjGg6e9Z8C3WvK1vA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526380997100001 Content-Type: text/plain; charset="utf-8" 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 >=3D TT_TRAP && trapnr <=3D 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); --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526572; cv=none; d=zohomail.com; s=zohoarc; b=GQrZ48Ku8tq1sYZvgZvcWdRTfp26yVuSN8w+uSacypUuJ+bPiMR0H+ULc8xOMVRzNt0LY2wMvfGGwYoyAO7lZNk2Irv6leY6ujkuuuAkxz70sqDoe2ONwA2sSnTCI2hgFsVA/OylmMiUlFrGpm98tI6XvMzv1Th5EfDgdDG4O+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526572; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3/GsGOhPL6d8HonZ9tvdFyDrYuAo6ZmEKf6gpoOjRcI=; b=XhwN9WCvjJWKuDgcGhIpspzernEPe7vN0JvhtaE82csVNxvJoMYdVHI4cTmVnKEeRcTycNsQjQuCC6/LMpaSq9w5+gYH/D7zCG38n3QV4OFzQcZ7oRfZ5l1Ts0snZe+Qcxg+XOTgUwkTj4Ib/unOqiUxo2zw1xybn4uHiisVAwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526572279173.2698494223181; Wed, 15 Feb 2023 21:49:32 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+jTw7mnmfV5kIV0lr/EOirk+JYwA/AwbGKDpwg4H/acG+2oLp4ikzEBUUyVlGwxe9K2+fxQA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526574276100003 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- 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 } =20 +#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 =3D env_cpu(env); @@ -167,13 +173,7 @@ void cpu_loop (CPUSPARCState *env) } =20 switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x88: - case 0x90: -#else - case 0x110: - case 0x16d: -#endif + case TARGET_TT_SYSCALL: ret =3D do_syscall (env, env->gregs[1], env->regwptr[0], env->regwptr[1], env->regwptr[2], env->regwptr[3], --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526484; cv=none; d=zohomail.com; s=zohoarc; b=ikEGUJis374W10A7OREsuZZxyczhNpIktyQ5Fn28nJpdlMjFj3Fw0ne1A+8Ss4pNd/FH4EJ0x02/FpiO7t8xlncoTwjMAJ1xaOMScwkWiDnBwnv0H76hyzqK61g0jfvy3ONdLbgS2JUVpe1SCx+iSFFlk3aYED2dpkRzhA65Sr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526484; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CwzhgiW7ITrxyd3SSfKf1YS1o/7m69672MVumGKkbhc=; b=dPfMmWh5YMFzwx6Nip5iszxlR3Em/7hEcT3JsOVFWRLXpNgiK693AdS3Fjv77eMPahEXoX8Bp0E8qYeNbyihPsV8fo/aZna6dYXtfdWlvu1X14mwqLWZQ+U0os47gbQe4avy06xhdTsvcIM7dO4E2+H0V/pSJ2wMwLbr/x66vww= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526484487298.16873888281464; Wed, 15 Feb 2023 21:48:04 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set9y8QSPcCvshcrSuZlOdocWD7+l+hK22V4HeR3nXJ1pXXz8t3Qs4DThKyGExQoOq3dPZzyuCg== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526485618100005 Content-Type: text/plain; charset="utf-8" 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 } =20 +/* 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 =20 void cpu_loop (CPUSPARCState *env) @@ -183,18 +186,10 @@ void cpu_loop (CPUSPARCState *env) break; } if ((abi_ulong)ret >=3D (abi_ulong)(-515)) { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc |=3D PSR_CARRY; -#else - env->psr |=3D PSR_CARRY; -#endif + env->syscall_cc |=3D PSR_CARRY; ret =3D -ret; } else { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &=3D ~PSR_CARRY; -#else - env->psr &=3D ~PSR_CARRY; -#endif + env->syscall_cc &=3D ~PSR_CARRY; } env->regwptr[0] =3D ret; /* next instruction */ --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526525; cv=none; d=zohomail.com; s=zohoarc; b=QxljCDw9RAmM0DFViaAljwfEEmXJYkSA1BfBn9/3B4GEI8Mq1mdjlQSz5f7ootumrcM474/Doe0JYu0hkxijxbQPySQFckBf7XW97yeaz6RCKouEMumcKF0ZNljkPmE7Hej/5HIUeAkACB3nkAkv4eo2S0oY5sLBtFsdH5CC/1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526525; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vnhKbJ5br8XBikjOI16wWyZO1yPpX72pZ9Y4QBl2Phg=; b=hzmCHyknP+2BH/qodVCos0pAHtctoRmUPxe0FQtEzpyR8bHp+/iyMr3cB7z+6MALv+tcD7KHO3uCYPm3FfXTCrf84mJfiJpDljXmzk/dMMUZEaHtdqrcS+NrIiWpf7/RB+ZznbmzndUHEj//JLDBtWoN8cXhg64VYHOkgXwZI+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526525973495.8038684444334; Wed, 15 Feb 2023 21:48:45 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set9vx/OBtc6MzNvUsrbQiCN4h6yRId5WHv8uAMcwQ+yp7J8oDz/ojWYCHS3+SPC3bmPRc95T1g== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526527996100003 Content-Type: text/plain; charset="utf-8" The v9 and pre-v9 code can be unified with this macro. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D env->npc; env->npc =3D 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 =3D env->npc; env->npc =3D env->npc + 4; break; + #ifndef TARGET_SPARC64 case TT_WIN_OVF: /* window overflow */ save_window(env); --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526579; cv=none; d=zohomail.com; s=zohoarc; b=C1da5TeuBZYWfCSoF5SO6pgZDARPH5kAwZ0RBsxGOYWg9FKTbFuuyFNx3RnueXBJ21OWqS++0RKTUKsMGCNwm17SO0VxJXiaZJ/fJ9DZYUgKTqnCFIelXUIjuTOxq7ypUbHeNcBLo8lCALulkj+EBpyqP3TtSF05r+OzL8jaZK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526579; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1qgOI+XbaLOlA8TDn/4BzcaH/ANI94JgR1D1gQbepb8=; b=Su0PTJ1O2Z9KWR1xkzZPEpJjL/4xTeXItgyGVei3P4JNDPGNkKN82b432025OcvVeJZnAy4460AYFXqdezfR3f0dqke4PcNpLnwkylL3fsLyexd0eJOfdQ4hWBWEty04D0QUOuDJ0XxxBGeSpYqKy+GSnNnrzw3f76XvqzNQeBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16765265797831.362625813276054; Wed, 15 Feb 2023 21:49:39 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set/UNzPBOlgRVfaoTHAQQ4snpKdecfOAlHwBwJpqAiGkrAGSurz/NobsuUXqpo8b2oxEIsaVZw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526580211100005 Content-Type: text/plain; charset="utf-8" Add some macros to localize the hw difference between v9 and pre-v9. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 =20 +/* 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 =3D env_cpu(env); @@ -204,20 +213,14 @@ void cpu_loop (CPUSPARCState *env) env->npc =3D env->npc + 4; break; =20 -#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); --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167652654524670.10996247129765; Wed, 15 Feb 2023 21:49:05 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+Ltrz9ZTLqVh0FawWnW+h5EYpsvHCB5Qb5phn0FKAr0l/XzQbqmcr3+PgNCODzQ6oxfKh9ug== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1676526546078100001 Content-Type: text/plain; charset="utf-8" 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 =3D env->npc + 4; break; =20 +#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; =20 -#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; } =20 -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) +#ifdef TARGET_ABI32 +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp =3D lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp !=3D NULL); + + default_sigreturn =3D sigtramp_page; + install_sigtramp(tramp, TARGET_NR_sigreturn); + + default_rt_sigreturn =3D 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; =20 @@ -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 =3D lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); - assert(tramp !=3D NULL); - - default_sigreturn =3D sigtramp_page; - install_sigtramp(tramp, TARGET_NR_sigreturn); - - default_rt_sigreturn =3D sigtramp_page + 8; - install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); - - unlock_user(tramp, sigtramp_page, 2 * 8); -} -#endif +#endif /* TARGET_SPARC64 */ --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526530; cv=none; d=zohomail.com; s=zohoarc; b=L6EkB3iVe+VxLsrElfqmnV6bqjgVMrIOMfVrVG19PGZHuvuek+PR+Qcz+6PXrsf/y0P+XdD47Q9GCU+QNnU4164dm+bKCK0u3xiYERXBHIFt+hnfcZWQsNMcZht3As3V6vL/GS8tEWVpkBToQoXkuvlzDSdtWuu6OAer7W78JbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526530; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nwwEZS3IY8awyA29AWhLSBTJfEFo65LkYzhDCm7Aots=; b=WpL9Sj3QPZSGqrKYPCGiK/OFK++LjmdsD275aa0QAewWlhe9nUkf/IbtnfZMJidnPcz6warN+v2iXs4O36vuCmUL/i8ehOZ2Mq/2BYuBPCR7qpUmD1CNzPil5wXJpxGHlnDlm6ufBi5ukaASRjmLorf0Y9tutR8bDdFge5USH6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526530957953.4036295675797; Wed, 15 Feb 2023 21:48:50 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set/HEUt8RViTR3+6vWcrUJi6U0rQO9P2ox7TsQCUQ2kwBJXVPa8FIDYjXJosb7eeqyFbZHhoUg== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526532029100001 Content-Type: text/plain; charset="utf-8" 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 =3D env->npc + 4; break; =20 + 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; --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526518; cv=none; d=zohomail.com; s=zohoarc; b=fZk1tOujygWpdYlCjPagrZq3MaEWN3VPPiz6DaOlj6FxPBWZU7p7u2ocsaBU6xCkFmAaNUnIfZJME0IkbDMsEiKkv9h61XDHjcgTG51pwscI6or7VfRCeaUZoYgKLEFLQHMs0/IdZh9sjX2Yyv6PJ8QMWGScgO4AZSYziJ3m9XA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526518; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KEAS/y4KNGAZ69Ie6TWO3D+vLA+vLuj0brYQYKVkagM=; b=Bl8or4EV0PrNwbVTeNLv4HTGNrwHgY89DXC1vPxxcDKGU0DnQdBUR2JlMkaQoo4LZW8dadXHreSw5zycm5dFVrkyKrAH9Ov9zkiUdruKiVz7emlnDnEabcDeDuyWWdGJzfi48q6YG0zU4RwJQa8fUzMcMTRd8eOO7bmLQFmMlkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526518521955.9133781911314; Wed, 15 Feb 2023 21:48:38 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set/0urbiz/MCsP56iMoyqW9orzTi44xsI1oGBkuIBK10teUyC2d9SGbbf20KsP18Qr/5OzGUxw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526519953100011 Content-Type: text/plain; charset="utf-8" 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; =20 + 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 */ --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526600; cv=none; d=zohomail.com; s=zohoarc; b=LGzGS702FILQbwQ8vBv/T/pW+qSSuP39joTXkc1TAsoS1P6HpRRyodG4L0DLeTaVQjpPKIyoB1LCRedVntLyjsjPjlPSTcXjnNlkdxvupJyK+DRdT1Od6/JNgdX9Scfl2a7gihYdY9Loqu8Ii1Axea+FPEi2gLtsDdL8f8OE3aU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526600; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qSmbYBWQTF40Rva8qm3+N5zMD+1Xf6L67/b2nj4sg7A=; b=Y3nHXcZ0TOnVpQsBBsPftufifSBgT0L+K4vXR8e6hG/fxmzZd5aOFXybEimhyBGipoVVHm6+0eLf+11dovMTaA2Wc6dUQDbxgpio9iev309VykDXjciv7Q1/V8fOldlv0CX3OOOGgFJcPtBWHq+FvVMT6+cU+ynPd3rouiMOSR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526599970267.883509812262; Wed, 15 Feb 2023 21:49:59 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+4z5thDkoiz6Qb0iojI86HwvRGu5EB+YK6DUx7uLxEdlBIrmjXuGXgatAYwDVWfmr9GBlczw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526602290100011 Content-Type: text/plain; charset="utf-8" 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 } =20 +static void next_instruction(CPUSPARCState *env) +{ + env->pc =3D env->npc; + env->npc =3D 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 =3D 0x1f; + const uint64_t TSTATE_ICC =3D 0xfull << 32; + const uint64_t TSTATE_XCC =3D 0xfull << 36; + const uint32_t PSR_S =3D 0x00000080u; + const uint32_t PSR_V8PLUS =3D 0xff000000u; + uint64_t tstate =3D 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) =20 case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); - /* next instruction */ - env->pc =3D env->npc; - env->npc =3D env->npc + 4; + next_instruction(env); + break; + + case TT_TRAP + 0x20: /* getcc */ + env->gregs[1] =3D 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] =3D do_getpsr(env); + next_instruction(env); break; =20 #ifdef TARGET_SPARC64 --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526517; cv=none; d=zohomail.com; s=zohoarc; b=H+YptJU7NgW8vmz7+UNdpIE+oxyOhsKdAERii1E1Ng9xFAEeXITHAzdl5XpYRfBGSMU3Vir1c5qG/IcF63K600r7nUaaP5hqBPgdjJ4wf5uDVnHgM2YSSEd+heyn06sxiMUhj2Li6HFYLA1xvKH9XnIoFL7T6AI+q1z3Fk67gLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526517; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lqIPx7LaEGobxbwlMI298ZSHYBP2+86sibEgBn2WTxE=; b=HP3jyXcDC27xa1PL/W0G3On/yKPTrdx+rRFCi6tfTk+CNGcnqlEnvKbEsMPuTA53+X9E06EJC9kr1HqFOl/9HKjAsmv0plw7MKrmaF9MfMYEbVzSmyLBtSVXSt8Lh3M2myg6yH6rn5eA/2V2ge2N1UErNGS9OD57XpBdoLrcwKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526517201976.4758169238795; Wed, 15 Feb 2023 21:48:37 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+GOexSRQIIIyYBwHPd2QT5OyIjIFBkaiDTrryqSEZCieE909BLhO9P48ufxsMPtxYovrRbYA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526517996100005 Content-Type: text/plain; charset="utf-8" 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; --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526515; cv=none; d=zohomail.com; s=zohoarc; b=Rj3mBWAKbXex5YVCaD6MOjdBJOANZH7RiU1ls74UCdY3dUav6T5KildjcZdIFplPKIm5wThMQDdRFlxtr0JwVv5dleHb+0oP67IwKyWc1Y3p9cnBSb4UG2X4e8qgyOMDYxjop9KebUbb9wCPNxk3oVs/akD547mW4Rkxh8stdw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526515; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QQH43IIj0vMoTyNfpAs94SMYkwmuMc8FS4aDkU85qBI=; b=nj3L+fRhuq7OHI/6tbZ/mwhH3Q+FywXiKNCnrPNyPzE5GAHlGj4gxoXrPKxyNuUs4QN2vFKiX6w/1YBpetctUqHdLhDBvf7J3ktpcjLbgyAl5VxtC4KdqtuAqP7h9MTzx4+zDqripqzZ4UlDielcgMhbZeA3dguvr+37vHDRMr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526515593339.8642869407654; Wed, 15 Feb 2023 21:48:35 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+NE2jxAdXjU83pkrr9Cq8U7sIveLEXAGfMDNb3vqXEoTWCQsVHey3Jkjwm/4YUmKgKkpdPXg== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526515970100001 Content-Type: text/plain; charset="utf-8" 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; --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526577; cv=none; d=zohomail.com; s=zohoarc; b=SMaq9W6c6AH3Vk+MOMsPUSCmoGXpiW947gfrVWS9gxId/5MUZA5vvzoAr/2FnRPO9fODHzJcClXjc/hr2wxCZY3pXk+pKTUmNYFrAAXnH9M+FR4+cCEpvbaCQL9iRWA0tOPPmQBQ3cEQO81zq28lmrtQnipw0uEH5iA5NU/KveI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526577; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0RV/Pw0nPLtehqObgMiaovu9PpCvAiBoNRoo5G4UtrA=; b=dKxL6teVHioYT7yIMBi28O2TgsT8owzhlcbO5qVIDm7dhnHT3VXFzpgnlct4hXc1aIGQ2XvnCJ43uMEvozXCPqdidH673sst4i7PoCgwYuBd6IQ/TKTLmD7XNeHsDFrIle/j1DgnOXVj3TTlcGgcgRKAVaEI555Sx/wVr+gZLQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16765265772561019.283552991447; Wed, 15 Feb 2023 21:49:37 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set/vUmjat02jemZtnNSZS/FiAik3n4twQLWBwy5IrIsuycDXgP9RZcDYyO0lj4NKoOuLbt0RsQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526578196100001 Content-Type: text/plain; charset="utf-8" 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); --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526597; cv=none; d=zohomail.com; s=zohoarc; b=BLAed+CzqXlNXjmbOGpFeihO0bASyT3798D9+0q2nlwcDWQIeaVsDKMhCe9TLT3YeA89nS/RpgsI7cSOGEnh6FGIDey6jqpZzleEh3S/CFFC1yEuSCDEVjObLoZ0elSu2PWvrEI4H2KipeybYZsbfodAL9DroV8noygIGraaMW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526597; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ADJUDCuJvLZTfwvvTitHGj1Ym2hlIeqZfcpR8Lo5PkU=; b=Jxa3fmAU/KQsWg8+JmH+AfvnpvIbGmgY04sUOsNDOL58aodD6D1pvoWWdzYcJIlhlBHVzeu+owxfRjKTSxsk1y/vA1WmDXQ7cgQnhgXY+T27K6Xr1fAV/chCjTG3h+IzkmWu1627WqPt7J6dWAgqDG80L63vrdXr5fMk5eUM1Xc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526597286188.42601225058843; Wed, 15 Feb 2023 21:49:57 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set9XbbZJeteauJUonzCKiXR1DgyU/xwbW2pih1ia7Ce0h+5ir4O6+gtPM2DLlnbuRbOEuPuD+w== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526598302100001 Content-Type: text/plain; charset="utf-8" For sparc64, TT_UNIMP_FLUSH =3D=3D 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); --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526582; cv=none; d=zohomail.com; s=zohoarc; b=XHsVgIaM/c6JFvOeBevkNRSyhiHZ1PZPucqeFGzQM45VY7yoVbkMXvczXGEXOw1cgn3Qnt0aSHToDY+8JS9A64HQ2tHU5L9OQzM8DyXQeOTpM8Ovfzk/RULHAEDvSN1b9nJUN2I0trr5Th/83uoQBx8j8Fk6iV7ew0Q7Rm1T4Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526582; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KDYAg9I9XuYyh8hpIEHsfEqclaDeqHesV69onSq1kZI=; b=RMOfERBP/cTWvB/dp6krTSxuoxUFZtOPv5fF/nANXhhE30v1x/EEGAE+plld7mta9pahOpZLVMwd5ElS05es0FlBRcVphoFurFpNH6U8F600MH6RhhsnjEbQNKuRAck37f8edGPHL8wveErNuBjdADmsSv90/ixKVuJ9GmWBJqE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526582404974.808396218685; Wed, 15 Feb 2023 21:49:42 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+/tFqrNILQq3GGiJ8CR9QRMoDocaYJoyMKBXyqC6EaDtfkHoQisOI3ni49gEjKG6Oc2cyJ1Q== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526584242100003 Content-Type: text/plain; charset="utf-8" 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; =20 + case TT_FP_EXCP: + { + int code =3D TARGET_FPE_FLTUNK; + target_ulong fsr =3D env->fsr; + + if ((fsr & FSR_FTT_MASK) =3D=3D FSR_FTT_IEEE_EXCP) { + if (fsr & FSR_NVC) { + code =3D TARGET_FPE_FLTINV; + } else if (fsr & FSR_OFC) { + code =3D TARGET_FPE_FLTOVF; + } else if (fsr & FSR_UFC) { + code =3D TARGET_FPE_FLTUND; + } else if (fsr & FSR_DZC) { + code =3D TARGET_FPE_FLTDIV; + } else if (fsr & FSR_NXC) { + code =3D TARGET_FPE_FLTRES; + } + } + force_sig_fault(TARGET_SIGFPE, code, env->pc); + } + break; + case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; --=20 2.34.1 From nobody Sat Dec 21 13:05:39 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676526566; cv=none; d=zohomail.com; s=zohoarc; b=CEOO4/kgks62kDX5YYCIMtxyIBso5K2v23WSJzG9njV3S0H7Kg2P8cWmhaRiuaobad6kHDnBFrTvCuBINjpEbTSc6XxaY/fxPqep++WqeRka+tRkTFDZZPDDYsjC74YcvqL6TohnkB3spag8KdXeFr5YV5QZ+9ZltTU05/wEy8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676526566; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6To1l/rwYRVp7otgwGVfmpklbsVH868KF7IZeYGHIKI=; b=m5FcJRQS7fROCHuPwxIEoKW7TorWnAlhwID/GiylH5fgivgQHRO+jmH5tlva6AgxLbSb3j7bDJw18dNlVyeq+FZURxhQorSQhSkC+41MFJslWvwRMKs7k210l+wBcIT1YWTbKQ1MsYQc38PZWT40Oxysdy+wv3mSQO8IUvg7NVE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676526566982935.9947271105978; Wed, 15 Feb 2023 21:49:26 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set8ALSwHFdo2ZZP7kM7pzSWGypf3L++y2gFmjaHL3LjXK/3POwBXqjoYbAM43/IM90nEPsvmiQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676526568204100003 Content-Type: text/plain; charset="utf-8" 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_sig= nal.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 */ =20 +/* + * SIGEMT si_codes + */ +#define TARGET_EMT_TAGOVF 1 /* tag overflow */ + #include "target_resource.h" =20 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. */ --=20 2.34.1