From patchwork Thu Jun 2 01:33:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 578076 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp103904max; Wed, 1 Jun 2022 18:36:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBcHbIL9PNvIS355lbF8piAxl6E58Xk+1uOzWZ+TRfFLHJJxL/8D5s0cMV01FFb8VwiUyx X-Received: by 2002:a05:622a:1895:b0:304:8024:332d with SMTP id v21-20020a05622a189500b003048024332dmr2085242qtc.682.1654133774368; Wed, 01 Jun 2022 18:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654133774; cv=none; d=google.com; s=arc-20160816; b=HXOjryNQcdzae/rQ/qMPDOIeV6qfefVBv66b0jgmFTiG+8lODt2pSaTO1hx3hdAZVI osOvGlgTQM/0TR3/iRBtftpfoJ4ZaduCTIW9FH+IIXeR+wpv7Vi7QxRy9nG5r5xwkg7C ieS1UOalyOTS705ShwinGsTBDGqKc7+mq/awNaLWPvEriT0Am2WS3bjrYpNcpVAqQ1b7 Ejjkx3duvL7bfbDNh4X8N0bW+ir6pPu8ThLwk21zAPw3kXg31VavQjTwugSBGQ3pD6mr y4xt2fWO5ulsuD3Tmuz0/g++VPHMUKm3wdFq/ggsbN4QQ8KFaiPCF7A9meNm/A7Y7apn 2WEw== 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=v6GsMd9l2dAfQx+Uj+qJ1gCQp2pHPy4DQInBPdc5TCM=; b=JHXKVtFjaRn2tc3HYpC7bygGRn4dagj5vNWSYtdZHSMrT6hRyHHALDGLWb5YOp/nM1 lb/216wNDyMPPV+HlU8nVEeHRUaQiJdVlhqcLkpyuFVNMJxSPhOzaMyvmLjilN3e5iUP tx4DIW7qcaLqQ7yaBu11AGmndaVI0ern2MLujqI+RLzHIJoKXsSkG+dKrv9FAUCeIXYN MzW4eNOHVvQUq0H90Laxm9H64ybXgamvk+tFMj9wheCGtglx0TccYCQ5H8IWwX38rHDc SRvLFZ0B1V3c8JxVPFO51T5SEFakaM0Px28mkibTOSiJw1VYlzU1NUth9a5+gfFaSODB Q7cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qg8/PLu8"; 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 m25-20020ae9e719000000b006a60314078asi1529307qka.434.2022.06.01.18.36.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Jun 2022 18:36:14 -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="Qg8/PLu8"; 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]:49120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwZkz-0002MW-TK for patch@linaro.org; Wed, 01 Jun 2022 21:36:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwZix-0002KI-17 for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:07 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:40670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwZiv-0005E2-BY for qemu-devel@nongnu.org; Wed, 01 Jun 2022 21:34:06 -0400 Received: by mail-pj1-x102a.google.com with SMTP id n13-20020a17090a394d00b001e30a60f82dso7944900pjf.5 for ; Wed, 01 Jun 2022 18:34:04 -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=Qg8/PLu8Zu5+LZyYhCNcSfO3eQLy/+KrGp2UPo57WrKp2FNzJv6/R5JugOmcoBd8g8 Q6+48+Yth8+d7bNyLXzOKiHvU40oquMdEBZ7+Is4jewIOFdlrcs0Fzwv5umgZnJHWNl1 ipFYFg2KnroRZRt3u4VFI+t01EGLvMR86d82kHFQG4ElGyyJH/X1xTjjmPXVR8PobeST neBFoHW7+p0MTDqFDDc8mvHZiKol8iKBKGlufC1ng1sUUUBQDaypO4EWmyflTxJnFCBa IbCFVQbNTL2dR2xI5sZ+4GqSUDboG5v0uWI2n8iYg5NWkKfuQWDxIejOC8xA0rwdKxAl tfKA== 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=vYTHk3IGWj//PLAjkj6VOtGaL9wQE4P8Ia2XILUFZNhnznDK8x+iF9iGyAmn8g/X6S IYkVENqwIMtNo3HuBT5gpPF2I6w1qOLL0MdcUowir2Myd54FxGJIqE32xXFSrv0VvjbH tmdugfWGpwZfX2CnLdK1W07t4BzWKqDdgnMSXGGVt0V7a2BpLLW2/sp6GGFT+BnnFOoI eGvNAqK8+GqQl4kf68isFag4ozDuuW0oT0i711Qv5hdFvAdMFRusaaf3H/9BN0K0TrG6 uc+EO7j2Vl0MuAm/1N/3Ml199mCgmHevlgoLZT+vD+B5xwpPjsuXkQWq6Di4Yo+eGavd nvGA== X-Gm-Message-State: AOAM532GdbQdbC0xGdpYv/gfqU+LB78YmgAdP1qNxjNkTdLp4gnQbp1W Pel5cixpy66XAmfL2Kn4SNSslCI6eVniDw== X-Received: by 2002:a17:902:a9ca:b0:161:54a6:af3f with SMTP id b10-20020a170902a9ca00b0016154a6af3fmr2358404plr.48.1654133644052; Wed, 01 Jun 2022 18:34:04 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:1eca:8ee3:9269:e00c]) by smtp.gmail.com with ESMTPSA id l191-20020a6391c8000000b003fc5b1db26fsm1962875pge.52.2022.06.01.18.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 18:34:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v6 01/17] target/m68k: Raise the TRAPn exception with the correct pc Date: Wed, 1 Jun 2022 18:33:45 -0700 Message-Id: <20220602013401.303699-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602013401.303699-1-richard.henderson@linaro.org> References: <20220602013401.303699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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" 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)