From patchwork Fri Mar 10 22:09:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661651 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14447lty; Fri, 10 Mar 2023 14:11:13 -0800 (PST) X-Google-Smtp-Source: AK7set9rr56GBDXR4YSsjrP60bgqnjexpyft2q5TAOHgojLmi5ZSIApASLqVoQRkXFdmoF14qd4e X-Received: by 2002:a05:6214:da5:b0:56f:796e:c3a5 with SMTP id h5-20020a0562140da500b0056f796ec3a5mr1294641qvh.4.1678486273313; Fri, 10 Mar 2023 14:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486273; cv=none; d=google.com; s=arc-20160816; b=oUqk1syM5NsZWwU7tLXUnXnTKhZ2JswaKAp01kl+M4MGtuGA5+PI9MBEz3eVIG6iRI HEvMVKKF6CUUkKtkFIuLkW7nzPenOYksGPUP8+7bGo2OPfaHCl1yZYkBKUmGQ2yELJke faRfdGFMs0WTN7goz8lmEsRfJEXQ4NOmDwzFu8L+4T0119WzwzoOwc1q9jcYSzjdtlLe Bch9ZjXKt0+8WoWdQtxgpEgB9KpYQ9kSGNER3cwMPnvKJ46T3qcSw12+oapcQechp2Xt E+4MscYgM0+KzHwCHhnoLIJP5vVPI7cks1rKnWJzBluInsfSFGMgcuRX4ZLZClumiDN3 gJBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6/4suWoKJkkzOTjlrRZ75Xs825QjcHR4Gp4asLoum1M=; b=oF5/3rJBXwNZpM6jO7hiDzHM+Hch/l9U/io3qzRr8jonACaFWmUs7RL8EjuGyp92+P avJ+Csz+Ozl5xegmn5eU7iFPhv8aAx1WXderTs+LJ/xNup4faOWHdNcY/4lrEKyK2ce+ Z0bfO2LlRx0hI2J4RxSeqYywSWfCXXl4ncJvoTcWV4kBvUYZXrle17wEV2/HaZbjztn8 Czv3YKiFSrgW+J9tCrxRPZSb4VXZYgWDdRwAztj8T2dffxL9VubH09uBWDCTYDmbxGs/ EVevr5qQIChEYdddjlweFistUwvH5JHd8WN+K9RF6Dbrcg7AZlz2DaKPodRgqhTp54o5 s3/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w9-20020a05620a424900b00722cc4470eesi673895qko.450.2023.03.10.14.11.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:11:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pakvq-0008I8-NO; Fri, 10 Mar 2023 17:09:46 -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 1pakvn-0008FP-NQ for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvl-00033Z-Jw for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MMGAg-1psyZR2eFK-00JGYq; Fri, 10 Mar 2023 23:09:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 22/28] linux-user/sparc: Handle priviledged opcode trap Date: Fri, 10 Mar 2023 23:09:21 +0100 Message-Id: <20230310220927.326606-23-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:P4ONyuy7N0jy4CWnfH799ipb6/iB8eLiOxaqw5I/3U0l8KdcpMB MLP7pf/taNgSwnLq1zhXx3YTrqm6j6r50T0NG0l/KFc1CXgdaOE61SSxClimcFMVt/sHYpu oCe56XVJj6X9/XuG1ZO7h4M8fjFaDGXWQxjeUDd9hAx0+5l2weljiKVoLwFyj+rFmR+BlDs t4y7JL/m2VlYyflIilkZw== UI-OutboundReport: notjunk:1;M01:P0:+348JhsZYXg=;m3VI980DQbhz2WEZJ7A+hs6emRy l/h8YK4c1UU1Y0XPxUe2796kOheZCxiJImTIDktRY0VnjjKSgaiYfrZ4bsECtDrAAp7qBvCEI CPiOuKjrcCTSFw4vZO1z2RoCQC1m8NRdNQFwaHs4BrjRt7PiIxmRHJaA9EKfGEsuvdR4yUU1n UZjTwvyp6JMMxJ6zEoQ2OKIS67gl6Ux78ribOuVN7TJSC9KLGTy6NsYTOYv/BlYJjuHsvXq6M 1g+cVLuzwsrbVeAPABvTIvflwIthvf/TschlODbWeYryAHTa04EpBcHGsrhafWtqRBvTELW8U dSfNO97SHjGHFBQokYYRjdno4Qn54K3QnYh7tfSQBTF07UHgsHIVmxuWiwH/o/kIYYsPyfqIv M5jx7Tkn3Ozuq/jMx0uyivk08kAgodpzCEFYGmsTa9kP2FAoum+UgaKlyrO54z6zvsa4xIGoe wiwqkIGFub2U3bnxbtlNIn8BK2W0JtRH6SfesJwKQj3feNZ/up5RZTdOCg1tBKOXwF9VuEsGv TPx08kGXCaT9p3efiXgmj+cvAJ3pD1apzXUTFetJGazvtp+0DNNOmPykmmXgQhUq/OeTbnqym UYTesNyzaCyvHLelrRhZPIYXlej+NXrT1d0RW8w/Hc1SWV9s/bnL1alDTqEJ7LUwoArVfasQ9 BLr76MiDQ9KQ5n1FVYSJ2k6b3mKpvGUvEjAcem8PGQ== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson 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 Message-Id: <20230216054516.1267305-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 a3edb353f6fd..61b6e81459be 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;