From patchwork Thu Jun 2 11:58:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 578098 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp478719max; Thu, 2 Jun 2022 05:11:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM9mPs62R8/DMNVtTC64HbZEx6weTZD5xBSQbZu5C73UO3umkxe16AJkpdvRgxsvaKhDbE X-Received: by 2002:a05:620a:c1b:b0:6a3:4dbc:e707 with SMTP id l27-20020a05620a0c1b00b006a34dbce707mr2671341qki.393.1654171872690; Thu, 02 Jun 2022 05:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654171872; cv=none; d=google.com; s=arc-20160816; b=z4tYa8gv6w76zELAGQLCQBVrOc5W1ccCos2dp1koi18qngiHMdhuc2EHcu8F5B4Pj0 0vrxzichkTMeOt3/XixaA+GOGd+nsESwSSA6y5BP6MDQl5AzXZvQ/KZeX9FZR/p9ggNa KNmPCNaK0mu6cZ4V8O6/doibcUs5xk/lc9xlAhKfWmQbyKrgm+gm0165WoH9WS901nMs swOdGEO86s6qEU/zzYYgDE1V4N0TUPoiC/egEZFxsQ+prLr3P85WIQiV1LONNgrS0TC7 szrO41gS0fIVbsPx52aiCotwJlYn7cQTKATV3AtzmLfXkbvISQqoskyE0y6VV6qCA4cY YxYQ== 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; bh=u0QF+2DucTLWKBOYS3gW/gddzD8bDVaHvPB90+XG+F0=; b=ul8cwynKQ14WUa3UvSgAJIiIop92hmyPiswZq1Qyn5E+08NhEFRxpCULA/YtNaN521 pInwI1f2B8KtsUODwHQloAYecZvD+T/oe6QDBC4LjoA4pGIhJXnccEfjcfZMi61Chi0k MBmmImhu2amvFsgiRZjNREJfUTAxmN9WeSYUlJWTWk+V2tztHu2ihA+pYbq27609Sirj Pi2iC0YnvwqFdjcvI9RVQwGWKX5b/a/hpvmCOOJqT5XSigD1mbfk2mT3xeJV8tHxk+qk I0HqltFvq0onB+z+R/qVZcJoPHSMxGjcpbnLl9BaDGikU7+jDKV0WoOphjJDsGVpFiPk qg7A== 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 h1-20020a05620a244100b006a67c66f084si545633qkn.653.2022.06.02.05.11.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 05:11:12 -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; 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]:41832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwjfU-00019v-7L for patch@linaro.org; Thu, 02 Jun 2022 08:11:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTS-0000Uf-0W for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:46 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:52839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwjTQ-0001DC-6z for qemu-devel@nongnu.org; Thu, 02 Jun 2022 07:58:45 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MacWq-1nLl1u2Qwc-00c8yo; Thu, 02 Jun 2022 13:58:40 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 03/19] target/m68k: Raise the TRAPn exception with the correct pc Date: Thu, 2 Jun 2022 13:58:21 +0200 Message-Id: <20220602115837.2013918-4-laurent@vivier.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220602115837.2013918-1-laurent@vivier.eu> References: <20220602115837.2013918-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ltkQRhIAjDRTaKjTXT+IRcKvQIyZQsLXbUR9bDbhZ79QlzA6Q4m gB0AQaMf/3s0NKG/VvSD6eANX2L/uUX+nvGLfPSfMQCOL4veC0hFuDi1buNZtS/Yz3vpI17 u+YtGWIthZgFUkQzC1oorZRbXUkjj67P1B/0Pb2cpKd20IpwWRpgp+buOVk2j9snmb1OFhN 0k3Gt9dVFf1evam+NG8pg== X-UI-Out-Filterresults: notjunk:1;V03:K0:rajuMxlQMPg=:COhWzAfA/M6RrO2jQH0iqv 4jfxgAeixx48fK2tQ+hnyuLJQ34+AfafOT7LDYbk3Wlk2xKcgDVYckbHuJ/Xs3mmbNbfJ6HRK IHg+93U8VsVuD9MTCDXErkDseb+lnOIjMApBP96NOFRvIvxg2T8WqNhj34LofaYSUSIAqNqBM jt8IjCQmVY/+U19kieBAaou0IGJN5OB6fsEwnmDNXouiuQHcXBIFw6IuggwcYh63vA3J+SdHw HHMzxB9VfX3nLFYAFXjv31g5WrElk2Zc/jwMFxD0zxh1Jp84ABrR7rAwUVaGCuyasNYPasYMa vPLrOkVvrNtXkdi3WWT+4LNqfzkZi1CyzvYV5rf520n4p4cuWoaiphe9ic1Avly4mLSpiBtQH UQgpiQK11H+QxpB1uyiIfj3tmqG3BBwLF/Y6hdqFtigl4ckiFuLn+PGKpsnwYID4PotOAka8K aHr1qGqk8u1wQbLZoztl+i0HZkILDlGAobZGaDtuNYIaFZI3Gek2hJUrGbUG2U4HQWwHciH1P DFjm6OC+m2pgiJWhMtefTnGo/ucJBYvEHu8cFYR1V9TSZwdCd0q0vZ1N5CXg/aw5n1vztDF3s KdRJJTlEoOrWxggBvLPHA2emiciMqT8XYQG8UIRrl+Y0ODccTunCEYX/npWZToEGNon92sVeE 9+CbvqLkfEFuxIz2jVWqbDrscSvg5SN1daFr3mHQko+o9IfLJf5H2f3nqxWyRBA+CkEOthFxW EqzPVkyV7LAp4Q7W+2PpGjXQRv2/bh3O3ytfjQ== Received-SPF: none client-ip=217.72.192.75; 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, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson 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 Message-Id: <20220602013401.303699-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- 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 d1bf8548b747..56417f7401dd 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 8decc612409c..d30f988ae089 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 e4efd988d2db..22e5379d3c64 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)