From patchwork Sun Jul 3 08:59:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586859 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2943784mab; Sun, 3 Jul 2022 02:36:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLjXG15Bb9IyuQto5tRkJZmi46BX6LVA0AYnlAUjvsqr3t3dSH7FeB2MKncuY8D2mz/ooD X-Received: by 2002:a25:d717:0:b0:66e:23cf:7f95 with SMTP id o23-20020a25d717000000b0066e23cf7f95mr6553775ybg.605.1656841006493; Sun, 03 Jul 2022 02:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656841006; cv=none; d=google.com; s=arc-20160816; b=j0FBC3P1JtS2eCXap1q4DJmzNqd0TlLHNo51yr+Sxd040WsXmonkXu71Ihu8jJA7yP OYKxBvlgGGWABuZKjfXziAusdCc6UH07qnSfeBRySpHgI0DRCBNoWvJT8VMbMu3Jpdii 40nHSaK5W8mJEFKCo2HPkeT525fiNCAQjqLAVk7e3qyXNWNPiM+WdpI6oH8FrgfnZxK+ VqgLvZ/1DsEe/7MhxkGtTNG/nUWzcKmO02I8J1d6VPzIwUk/q27P+6KLuzrfG025pZ+H ccsfVs2n+kej6VUm6DStUEeNKONHWKV/motHPfpwjOYMC5k7UmZ50oTfEvWgnYuAxtuF guMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=EfqDpsTcJxKPM37kmlU36BXRfQJWd/kk/Qw5f2Mrrd5INzV2AX8rOIJOpA0G7htR36 prI+iciTQ+ezxoM+GwfTFq/NZ6F21JPl8b0cmBS3deNSpGv8LIQVjgiRff9r15XB58lA u9NqhTueIOui/nvc3XQRq8nh6t+QuQvN9iCCdUZwDg4e69QenOA8smMFxFceNCqGYUoq ASN4PFVcVXzfU5tLD+biYJzBEVWQn+I+FKwLusT6B/zpGkDMSA3vEzr0zvKB/Nuiuarz SqXEGEomWr+b3gGombkRa3pjjvmVVBqhhhNQ83bjo8iYb5hFiVN4hwG+mMy5Tlv14EQz gVSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AIncmNIg; 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 125-20020a811783000000b0031c73b3e71esi6552638ywx.248.2022.07.03.02.36.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jul 2022 02:36:46 -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=AIncmNIg; 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]:33436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7w22-00083J-1n for patch@linaro.org; Sun, 03 Jul 2022 05:36:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7vSI-0004x3-VT for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:59:52 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:33313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7vSH-0004BZ-3D for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:59:50 -0400 Received: by mail-pf1-x42b.google.com with SMTP id n12so6441899pfq.0 for ; Sun, 03 Jul 2022 01:59:48 -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=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=AIncmNIgsPxl9MXSNLcvQ30eUNuW2juB8Dlnc4+xt8WBn+Pmw3TmvSNncAb/3yXXE8 lzEmfJud6SW9Nkg1hUK8mO2M9jf3P+qEkxVWBS6PiQHeKW24sGgrddVYqhbONeW+CGdB Ppoz+rBHnl8Hfqfhcbjni8sXUJQ38L0fllc7GEKEgMoiXzX6EtUKW/p+BWWSFEEl2615 NoXkuUi7okCMH8iRxMjpS1zHE5zX9RbDlJYpbYVfoLIfAjsUpjyfUX9DqfKXNEEntzAh 5VV1L02Rd2Gpeyb5DIK0s3NugbJGrHNxBAPgB2wXKG+MIOD719DqPwiw/YgnGH3WrXXs btrA== 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=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=PKA4FWr+PAb1XbfqBc9zqtB7/uvjSXcrRuSefnlS+avxJgLGjyqG6jmv7lpyu/CkoH 6yqID1t1aiN5Mms1fQbnY9i3jaeMioIMMvHNO8iH9cXBppJH48Y9Wp50NjFS+rq4vw0F pOvViN3w1upDTn2N59TIdHK+7wSJ5NeaX/oREfxH+DBkG95I7FT/coYzE9lys2rkn+HI yMwOECw+e75QXbXUEVUD33raxxW72PojzL66WqYQNUpXPLBU2F+zmfklAQhXyp91OKtV RNQPy3Kw3uGQJgjwDB2A26TITGMjrcqJVuuLYSj33oI1tqCgFFKrwVdajWwuwZ7/CTOR QgFQ== X-Gm-Message-State: AJIora+616sa9uoD8ZdWifaBoVcBv6fEVARkiWVYGhJZwoiYF7C6T0CV zGBijbYWHx30r244E8aRdvc67kiYTYf+P0Op X-Received: by 2002:a63:8ac2:0:b0:411:8061:c10f with SMTP id y185-20020a638ac2000000b004118061c10fmr19074295pgd.262.1656838787789; Sun, 03 Jul 2022 01:59:47 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id cq16-20020a056a00331000b00518764d09cdsm18777593pfb.164.2022.07.03.01.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 01:59:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Song Gao , Xiaojuan Yang Subject: [PATCH v21 09/13] target/loongarch: Fix helper_asrtle_d/asrtgt_d raise wrong exception Date: Sun, 3 Jul 2022 14:29:09 +0530 Message-Id: <20220703085913.772936-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220703085913.772936-1-richard.henderson@linaro.org> References: <20220703085913.772936-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Raise EXCCODE_BCE instead of EXCCODE_ADEM for helper_asrtle_d/asrtgt_d. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-10-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 2 ++ target/loongarch/op_helper.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index e32d4cc269..0013582a3a 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -51,6 +51,7 @@ static const char * const excp_names[] = { [EXCCODE_IPE] = "Instruction privilege error", [EXCCODE_FPE] = "Floating Point Exception", [EXCCODE_DBP] = "Debug breakpoint", + [EXCCODE_BCE] = "Bound Check Exception", }; const char *loongarch_exception_name(int32_t exception) @@ -176,6 +177,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) case EXCCODE_INE: case EXCCODE_IPE: case EXCCODE_FPE: + case EXCCODE_BCE: env->CSR_BADV = env->pc; QEMU_FALLTHROUGH; case EXCCODE_ADEM: diff --git a/target/loongarch/op_helper.c b/target/loongarch/op_helper.c index d87049851f..df049cec59 100644 --- a/target/loongarch/op_helper.c +++ b/target/loongarch/op_helper.c @@ -49,14 +49,14 @@ target_ulong helper_bitswap(target_ulong v) void helper_asrtle_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) { if (rj > rk) { - do_raise_exception(env, EXCCODE_ADEM, GETPC()); + do_raise_exception(env, EXCCODE_BCE, 0); } } void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) { if (rj <= rk) { - do_raise_exception(env, EXCCODE_ADEM, GETPC()); + do_raise_exception(env, EXCCODE_BCE, 0); } }