From patchwork Fri Apr 22 16:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564889 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp698225map; Fri, 22 Apr 2022 10:48:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQr34bqtSE9o6z92QLeIQHFPWG5i7Ntt3S7wvhh/SYXcUhQQ0KCJWlsxvkj7zqV/Zg7fKZ X-Received: by 2002:a5b:482:0:b0:646:b85:ad4a with SMTP id n2-20020a5b0482000000b006460b85ad4amr1068025ybp.89.1650649723871; Fri, 22 Apr 2022 10:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650649723; cv=none; d=google.com; s=arc-20160816; b=lSb4X30Wnz8X/R+Q/lqfi7wfjTDNPMBW8fXQ88PMBPWpOO5c792tthvn2uDC0Slx3F c5TfJoD+xLR2xcOTfSM9kUs+egtmV1EK2xKdMBA0R4euy0kyjejFeGhXxRVvB2xtpjah mQ43YKtgblb35rD+qW1M9DRWMJ1yFSX/6RlLfmYtXj2ZwEY/NmQckn4NPGo3LSH9eWPO MfoJAaa24fFkBCXgM8DHAW7HMhZ3kCwfcTCcf45HZtIgvCLdasT66UsENU9nm0n2Jiov Iggq8w89eedmaHFPHJviI9IfWpUrpzRkNGCT++oDZwotl20Yh5w6RkCm4DQTop2+E88i PrGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KOjXySDL0Ufzbbr9M/xH36yPYqmTAVv3+nLLoSnWdKg=; b=AbBMkLA7zslirHmlG10r0NCMUgDAO3yGEP4DO9Fk0X0V1Fc7cspZfKXyWi5SsnCV/G rMF9rDPU6LK0IhcNzqPPBfkJt/DTKcMKzb2WNSUumwON58SxHIr8d5ESGojDX5z7WSSy WIpF9a1txeC1PCgz88zJVfoJFnuaoOeViokIyfoZUUksW+/iIP2n2Ifvv+IEezvmcSsf +tBCAynj3tGdPEP+X96c5opTRHnXJMf+xX8OtAc/igKog0n/No6HpvHaV+G3aCSAMvAR lPQL3gkohvCU9OQYPJZUUgctlUd/Pz0hA2Ig8x2gWUYIJy2WRSFkOxWB87W+Am+u6B0G BYdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AiRXOo49; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r64-20020a0de843000000b002f4ddcf22e4si4130966ywe.183.2022.04.22.10.48.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 10:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AiRXOo49; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhxOd-0004jt-Cc for patch@linaro.org; Fri, 22 Apr 2022 13:48:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhwb9-0000ic-GG for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:57:36 -0400 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:35728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhwb7-000849-WB for qemu-devel@nongnu.org; Fri, 22 Apr 2022 12:57:35 -0400 Received: by mail-io1-xd30.google.com with SMTP id q22so9243094iod.2 for ; Fri, 22 Apr 2022 09:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KOjXySDL0Ufzbbr9M/xH36yPYqmTAVv3+nLLoSnWdKg=; b=AiRXOo49rq/mLSIg7yP2HwzJvvpyPFeh68yST9wKKBcQqIuNTkr1cA1FEQZ6tVSp8w Gh+PcXfGFCaAwrjSj+VcC1tgPZwlmjf8XRs01YNsEFrSx1XfvqOgFsmU/FMFpyL+g5mN Q8C+9v3Z/XUgN9G9HutfHlVV1mZrQLOrtWhjX7wO5NNru9vHNp4B/iBx+U/lrZApPc+G uhwi8POEBrsebbsqTidX6vRf3pKMNVRBumvHIfFxP6vR9rZgfnMGO5+KW3XhuWp8QoxY ew8zeQdqCoYLOsKMStlcwSwLqCjScTXnusz0wS7tGeedx7jzcAxKQohHFMV8RHb37aUG BhDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KOjXySDL0Ufzbbr9M/xH36yPYqmTAVv3+nLLoSnWdKg=; b=JFusugpad7hDfVLMSqOlwTekLcU3izV2j1RT79iweyPK0O8kfqmXfn/PzszZFLN0Eq ZK6XfSLpdhAiIfg8T5j2lWmmZqu3N9p3fglxltuJraQAjAkcj8pSt7SI6NNcf0PrVpd+ F4z7NzmvEgRtDCCQAZES3Iuqid5109NhAA53JcEuRq8OZ4CTFIEwrej8NXWJhm2MGFOA 3FCLtiUXco29PcmLKwzvX4RKs3cPbzwgtVgmfL07+9NalVZyebvIfCO9jRdPaBZUYuHi GYhTthabhGIe+/S3TphBnZwMRbjBvkIzwexZ+Gn5+g7uTyEoFE9m0fyqUdwYy87hKq7b bp8A== X-Gm-Message-State: AOAM5315oF9hNBpP+/vqcGiBeaXUufwRv/EvyM5AMJfzSg7DhCjsQdFo u92eCecy3pbw3J/gAeyL9Yg1u+0Ga6w9s+NH X-Received: by 2002:a05:6638:204a:b0:323:e148:74f2 with SMTP id t10-20020a056638204a00b00323e14874f2mr2505862jaj.90.1650646653014; Fri, 22 Apr 2022 09:57:33 -0700 (PDT) Received: from stoup.. ([2607:fb90:27d0:b0f2:934d:3e2:9f8c:dd1]) by smtp.gmail.com with ESMTPSA id n23-20020a6b8b17000000b00649a2634725sm816380iod.17.2022.04.22.09.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 09:57:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 62/68] linux-user/nios2: Handle various SIGILL exceptions Date: Fri, 22 Apr 2022 09:52:32 -0700 Message-Id: <20220422165238.1971496-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220422165238.1971496-1-richard.henderson@linaro.org> References: <20220422165238.1971496-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::d30; envelope-from=richard.henderson@linaro.org; helo=mail-io1-xd30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We missed out on a couple of exception types that may legitimately be raised by a userland program. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-59-richard.henderson@linaro.org> --- linux-user/nios2/cpu_loop.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index a5e86990e2..da77ede76b 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -50,6 +50,18 @@ void cpu_loop(CPUNios2State *env) env->ctrl[CR_BADADDR]); break; + case EXCP_ILLEGAL: + case EXCP_UNIMPL: + /* Match kernel's handle_illegal_c(). */ + env->pc -= 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); + break; + case EXCP_SUPERI: + /* Match kernel's handle_supervisor_instr(). */ + env->pc -= 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; + case EXCP_TRAP: switch (env->error_code) { case 0: