From patchwork Sat Apr 30 17:53:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 568144 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp7369504map; Sat, 30 Apr 2022 10:55:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHYJKbkNqr9xLSEgY4V/7p+W/t2/etLBlbTZK9PZOFxzL+jcijQ1xjhiv5eIua0p+geNfn X-Received: by 2002:a05:6214:c82:b0:446:7a39:41a with SMTP id r2-20020a0562140c8200b004467a39041amr3926160qvr.81.1651341301259; Sat, 30 Apr 2022 10:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651341301; cv=none; d=google.com; s=arc-20160816; b=LTl3BzbwKC+PhlazLcoI6MdxVvliOPyz1HXFSAg5vpdqwlrKswvOZlm4R3+wviFBJ4 D/Myx6XXVhHrQxUsiK6aAIrSnqUxgSxCrHtnOl9MpZV+WiJXBYYRlQoS4xzK+TzjYOBC zyrs+YJdhoFUFGt+m6lrMNnZr3W7/+1fHjWbLoiiAIE3EMXZ1t/GdDGl5JUQSZfvodOc oXF0i2PVjhjXbKrK0MuyIYDj1Au0y1v+V4dDme4ppw9UGVubFCKthKgAGhKgR95fjVsJ Xe0xk4jrjwBYOkK4Brs8ul6r6dxxowuIMsZDnYVRi8/1riTcMhSsxLc1ugrC6DTn39n1 zpOw== 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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=i+LYA8aIDFpKrwltV4hDJuPOu0Q8D1RTvpuOHmVlFQ4PAgGnYTX5omuaA4B1dGQPYK JIHEl2OOGlWeuyzEkZDXgI6hC77Uj/6MJZAvrJmizHP3TMYElivZTdRsr2atXiSlJL7m RmxCep7V2Lefs3swc8GLCEhYEx6Za03wQVKCTE9NjDY4OP/bN034gjmgEWniZ0pP39Z7 0xmZjdWei8SvL5/KrP9sCbkmim8dg8jpPUtnaIR6O0tFcxhXmcJSZUXxAstlhqt63u/9 uFdGv6/oxvGfmOpWs/4T+tm28wrfB0YX8Mi4edZOQZMzOxiZWXWoyyIHiLpVK7yc7KO0 EYdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NVnL/mWE"; 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 q2-20020a05621419e200b0045a7c9c75desi928150qvc.561.2022.04.30.10.55.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Apr 2022 10:55:01 -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="NVnL/mWE"; 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]:33442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkrJ6-0004Th-No for patch@linaro.org; Sat, 30 Apr 2022 13:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkrHv-0004Sy-Ev for qemu-devel@nongnu.org; Sat, 30 Apr 2022 13:53:47 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:36810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkrHt-00080p-Rm for qemu-devel@nongnu.org; Sat, 30 Apr 2022 13:53:47 -0400 Received: by mail-pg1-x52e.google.com with SMTP id g3so8815340pgg.3 for ; Sat, 30 Apr 2022 10:53:45 -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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=NVnL/mWE6QEmcPQDULe7H0h4Ra4GIcs10ieZtq1UQIg9Z7lcSeo2y0wGgvW3QRUBTn x0/Ni42kmkg5NOg708YivN2Y8SO4KFAzTje/5QqgcbvRKw9pbqSBA5PLhN2bvN+0GbYL drBolSCnPlc9TJx83X+BBq0UUijfB2Jq5upy2bJOu2kyByIGZkhqQDI57k9irkH8q3eY aGNS7oAmp3CInl6zYdzRWaxn6eF17eQst3mZIoaFMn2QIrDtDlGTh43XMWych7dCztE/ fxHbnr2Y2cp8Lw97X4O0/YROTd8kNzdZtYD6LM2XHA6HhU1nYNWSoNL4mwPH5kOYPsAB Kzmw== 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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=otOh9sdz1c64VKsKFgHWQ7j2jKRYypGQkPSXZY0Ipgu66iwXE3FrpVVXPHHWCwAgeS E63kCtc6gY4pnmPfbF1K93iKnzj44ToN2kR9Q02sM2j2zGaZJ6pcw++0rYu8lDKPmS6t vNQWp/YttKdjOoKPGokrouf2xTi5NUi2dAmExcp8MfvHXxCqFa5Ol0n54omu0oykHvm+ WJHApJbjNXfU3IEW5V2syhgYcgbvUdw6ax+G5rW/kAo0b5n8OnLGQw9WCRxG047L/tlB 0toxvycvkYZ9H5/Kbb4wGYdwbeLs7DIXIyvZPTV64xD1osYAlcq86suUUjL+B7NdYezY gwrw== X-Gm-Message-State: AOAM5324wTT2R7yKelCJM1IpjkurvRwuL20M9t7FXcNpkgo0ks7L4YoD jXbiJZXQ6cj4/MpBohtX8XHWFfJvzJre7w== X-Received: by 2002:a05:6a00:1411:b0:4fd:e594:fac0 with SMTP id l17-20020a056a00141100b004fde594fac0mr4474679pfu.79.1651341224414; Sat, 30 Apr 2022 10:53:44 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c20500b0015e8d4eb282sm1740910pll.204.2022.04.30.10.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 10:53:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 01/17] target/m68k: Raise the TRAPn exception with the correct pc Date: Sat, 30 Apr 2022 10:53:26 -0700 Message-Id: <20220430175342.370628-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220430175342.370628-1-richard.henderson@linaro.org> References: <20220430175342.370628-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rather than adjust the PC in all of the consumers, raise the exception with the correct PC in the first place. Reviewed-by: Laurent Vivier Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 1 - target/m68k/op_helper.c | 9 --------- target/m68k/translate.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index d1bf8548b7..56417f7401 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -56,7 +56,6 @@ void cpu_loop(CPUM68KState *env) { abi_long ret; n = env->dregs[0]; - env->pc += 2; ret = do_syscall(env, n, env->dregs[1], diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 8decc61240..d30f988ae0 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -217,11 +217,6 @@ static void cf_interrupt_all(CPUM68KState *env, int is_hw) cpu_loop_exit(cs); return; } - if (cs->exception_index >= EXCP_TRAP0 - && cs->exception_index <= EXCP_TRAP15) { - /* Move the PC after the trap instruction. */ - retaddr += 2; - } } vector = cs->exception_index << 2; @@ -304,10 +299,6 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw) /* Return from an exception. */ m68k_rte(env); return; - case EXCP_TRAP0 ... EXCP_TRAP15: - /* Move the PC after the trap instruction. */ - retaddr += 2; - break; } } diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 4026572ed8..6d6d026e3c 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4860,7 +4860,7 @@ DISAS_INSN(wdebug) DISAS_INSN(trap) { - gen_exception(s, s->base.pc_next, EXCP_TRAP0 + (insn & 0xf)); + gen_exception(s, s->pc, EXCP_TRAP0 + (insn & 0xf)); } static void gen_load_fcr(DisasContext *s, TCGv res, int reg)