From patchwork Wed Mar 16 05:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 551822 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp3106mag; Tue, 15 Mar 2022 23:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx82rA4bJ3llqJ0I+GNdNyBBVAsv7qmqHhSzbRDBIfnRynX4AlnOTchUCTQ879xV3y6QqVu X-Received: by 2002:a05:622a:148f:b0:2e1:e8de:bff3 with SMTP id t15-20020a05622a148f00b002e1e8debff3mr1360521qtx.555.1647410578592; Tue, 15 Mar 2022 23:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647410578; cv=none; d=google.com; s=arc-20160816; b=EdIExK8XLsMxxU5gcP2xI1vwm2xFO5a/cCjl1ifogzsNhwvFlGJQj0/+ooKUDfVFyp MKoEXiZbhg8qNxyqsUHoCPQTNTIUeLTkyDumFEruq9cK4+cxvEBbUDoWMChVPwGT3R0R 6MODo8x6Kxm1pswiPAXmf1NW7dsAMTiUw0V3L+RuQiEJdkl8ksCkuZRjR+2/c/CSpt0/ 2Im1ojuy+YzSvKnsXJS/40Z8LQJzdLeAYAfPsrzV5wQG2aKix7rhdiruI7uezIpMnlIp rqH1c1U4jzq7MRaskTajuh2yOGIHd8kROS/96FoHAORGNUNBtJ6lFbbINud9eFxCCATF uFMQ== 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=Y5E3xDJc6+sMrDQ5ji+qXAf2mzFdQEZPRXEYBWpijOg=; b=Ut8uguFZ1yRsbxT2m6wfri5izyJWk4sd0K7AzR6oJ0vn+S5PqmT+9ToJ96a73mW/WK qQDyPK3mMHtP/xqG9hLf/8IPcNk679OmoHTarpyPhzEtlyAPuB/PLgM91K1XBMJWUz7d z9RibY5SRvQHTug5G1xH5Jr77VWLAHXhFeyc+4PsugNQddoiZco5ZVVhBUNo7FoN1zWR ZwWFxgiixFlOvyK989WVOe4WGbeO8bpiVTwZa+odnG196AUkLvtrPE/nkQ7HRK6JMinn jumdofKa37p9YIHJDU/tb2aZlkLuRd7yzOrRIGaRePbW+aTBV+3ECP+vq3PIu4J3r6ko Bt+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Q/6+5ZXz"; 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 v1-20020a05622a188100b002e1a40c51e9si230992qtc.370.2022.03.15.23.02.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Mar 2022 23:02:58 -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="Q/6+5ZXz"; 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]:56780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUMkM-00085p-3b for patch@linaro.org; Wed, 16 Mar 2022 02:02:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUMgI-0002DM-4N for qemu-devel@nongnu.org; Wed, 16 Mar 2022 01:58:46 -0400 Received: from [2607:f8b0:4864:20::1029] (port=53155 helo=mail-pj1-x1029.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUMgG-0006R7-JS for qemu-devel@nongnu.org; Wed, 16 Mar 2022 01:58:45 -0400 Received: by mail-pj1-x1029.google.com with SMTP id v4so1322443pjh.2 for ; Tue, 15 Mar 2022 22:58:44 -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=Y5E3xDJc6+sMrDQ5ji+qXAf2mzFdQEZPRXEYBWpijOg=; b=Q/6+5ZXz4w3B27yO6K+ylyzoOIxqes3/hpNbFpIzdXSAdBuCq3Dt6I981mL6p1fk2F rQ7fvR7dKVS/0PcmbjIlqqrPZ+XVJrlptgTMpyPKYyGtjBIQBfBS8Qn/6ZO0NGdrT7uf zQOrZu9jc0Peh9mkE9fM1ETlA3972COEcBLdMb6d2HnPm954J2tNILQQLMqLrT/KeMuF 2Fqu5FCC8zpYQd8aWhDI0O/lu9XxWdYnYWbk2M6hPz86Uabdzn/telQF8lDRR570eNaP ntkacRPA7REN6Uh417LzFh0n9YVXbjq5WBabGVRQlH8zf1EOELes0xy0Wn1OL7sipZ+P Jpew== 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=Y5E3xDJc6+sMrDQ5ji+qXAf2mzFdQEZPRXEYBWpijOg=; b=x63GAkeJA6vrRvvxrD8pdjr76Aui5flFu7HoRBW0jllhHKbDTEtRHVIGLBLiixc+Y/ NawKthHja65hysPINLxSQiTrACvs3M4K9sT1mIaNXTStfWyckZK8v6j5XBivie/U0Jr+ kqND3u9za/RKWe7AWgB65ap4bCyxs1Dwjj699E//20RKvT5wdiXlC59fTuYQU48Kr09C fCywo6vcLaci78J9svzahOkiCEL1FL8YJEYwEWMTve3xm+Ll4oyMzZtyuQwyGeBjfKNw tqTFbzM/3+d09g9Qo8OvFuhlxdZTsPcoX8giWmeYUei2KIs15B1yJKdDo4EQRIf3WRnq aEbA== X-Gm-Message-State: AOAM532sXK7Gy4HGo8IaUF/wMDI3qyIPeYoSStPTZvUj19Y6E/t3o7YX h5Q+JDfqa0ooCryPNzdgQKHmmCmvtcCxCg== X-Received: by 2002:a17:90a:5797:b0:1bc:56a9:f6c8 with SMTP id g23-20020a17090a579700b001bc56a9f6c8mr8648971pji.12.1647410323194; Tue, 15 Mar 2022 22:58:43 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i24-20020a056a00225800b004f6edabc9f4sm1236290pfu.72.2022.03.15.22.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 22:58:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/17] target/m68k: Raise the TRAPn exception with the correct pc Date: Tue, 15 Mar 2022 22:58:24 -0700 Message-Id: <20220316055840.727571-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220316055840.727571-1-richard.henderson@linaro.org> References: <20220316055840.727571-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1029 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 928a18e3cf..a152567624 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -57,7 +57,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 af43c8eab8..af3febdd48 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)