From patchwork Thu Dec 2 20:48:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519758 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp1167491imb; Thu, 2 Dec 2021 12:52:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKtX7jwdfHWrwQWtsgkheffmNodG5WNHW1zWMV//dGqWOD2WqBL6GC5s7QJdL72mg1Fx0k X-Received: by 2002:ab0:2a11:: with SMTP id o17mr18134266uar.141.1638478344905; Thu, 02 Dec 2021 12:52:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638478344; cv=none; d=google.com; s=arc-20160816; b=R6+gKshCVJMBmKaafwNk6PWqrjEd0aDpaEOSOFVtRrGo95GElHj2rB+MAJD8W3v0zL aMJaAel4wNt9wsS650H/EvaLhjRNlF8xteG+Z6+YbcJC171d9pLoxEc3OSSoFFPxmz4Q a66UyNNWTygOXtOwp7y7CooBYhlX/a2rv9R623k8/jO9Aby3smkNSHKXmG3FtgdChk63 ZwTrY91s8UuAsa93vjxUt72dGsLDUPdZwX39DPYUmsYQBNGBNwwuWAKAWLNmEt63eYb4 Zt9d1KMXXYMQtErGDN9d6+ZLmRyQ6g8Qfb9bRa9HZzcjURmJEp36m/YxGb9memNNI3nX 7bCg== 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=p6wlTrgyamt5pJcbz/NPTMdqMfp2gadP3Gsui6+XSsw=; b=Fnb29gC8Ar/VbxQx8ZK96znr+l44w67bOiDrrerbshBi3KtfUTGwDK5SW0Z1hMrs8f STFHA/9k98aeOCbmbaCGRPjFiyXLQJxOOyeamHcGYJFi9yXYz1lR3SQp5cdBYcUpVWd4 GQQbhgaDAhlHXnGuviRuTDzFB6TgV5urHbNjrTZazN9PyxGxgjVssPbQ0ZAlSLU70jRa N2KdT+mewrgkuSXxOfqRC6VHCRRchQyMa3mUEnc3dyFOZ4BKoO8DWC32r7oV16EU6oP7 H+gy2IxAslGk8pp62T9PlkiEYEyPa3UPH9IQ1efrZRcRvA2HSkPIQiu3W+GBKSzU+1gD E7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HpW4FJKx; 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 a26si1188107vsj.516.2021.12.02.12.52.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Dec 2021 12:52:24 -0800 (PST) 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=HpW4FJKx; 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]:42424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mst44-0005pX-6T for patch@linaro.org; Thu, 02 Dec 2021 15:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mst0r-0008WR-HK for qemu-devel@nongnu.org; Thu, 02 Dec 2021 15:49:05 -0500 Received: from [2607:f8b0:4864:20::1032] (port=53865 helo=mail-pj1-x1032.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mst0p-0005So-HS for qemu-devel@nongnu.org; Thu, 02 Dec 2021 15:49:04 -0500 Received: by mail-pj1-x1032.google.com with SMTP id iq11so667801pjb.3 for ; Thu, 02 Dec 2021 12:49:03 -0800 (PST) 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=p6wlTrgyamt5pJcbz/NPTMdqMfp2gadP3Gsui6+XSsw=; b=HpW4FJKxeHYqJBd1tP9+DQCava5jqPxcFLLU2zL/15wj/v9ouCslBSc/vgJjZmOvSS gYVyqxX0GCh+T8y3zQn6545SjDqNJaVHGoG4ABxIYqR1zpse/21OPQl5zSq+m/YTK7AI T/G7i+zNLlOYbptTf3FnAr39KvCtefF5BBexsFcOz4ChNANeenLRqm5y8Sb5Pe5ajzTc qTFHlLKbxsngTlWBXS8OcGGgvP/MAQi2sYQUz12gipA+CskHlaTbnXlLWB2/nZM4Yasv kdrL+TE8Z1A64ou31gSDxe4n+B7RbUvvB1n6g7+GbIAFk4oZhVw1+OmHbMEhscDrCMgF eGqA== 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=p6wlTrgyamt5pJcbz/NPTMdqMfp2gadP3Gsui6+XSsw=; b=XBwo8LI4HrnFlpEbwHXtR7n7lHqhX3Jp7yprJO7Md9yrU0Y1SnnNMm/ciatZ3WgbxW ttWmr/NRJ1lCmo2/6cugsWdQg2/pbdya8W72eixBd3pRK5jAO776L71A11YZVooWRedN HbJjqXCHY/T+Nh4GhrDTZqMP7lCrDfZhqD3ffy4ULPOiHtzZl4umYyvrU64bsMqNh5bR 5D6iLPSnL0pDk8/5B3GOFg7n728n+FqozkRytyCu2uKrAYKi6V7WBACH0RAemjVKDZKv gNPjPHg8wXGVLB2ZpSr1tneaIgbY5wkB8tPHC89VItRHaiqLq6FrVBWp+9iXOYWh1ZUa AtMA== X-Gm-Message-State: AOAM530YTI2A7Ezoi5Nr2niG5p9i+HWjrAy2+Fy4CL6xfMMwMN9wYclo ptPUN74fdZQfKiuouiqAUg9T3LsvvSLgWg== X-Received: by 2002:a17:90b:390f:: with SMTP id ob15mr8763333pjb.32.1638478142248; Thu, 02 Dec 2021 12:49:02 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id pi17sm3721391pjb.34.2021.12.02.12.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 12:49:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 01/15] target/m68k: Raise the TRAPn exception with the correct pc Date: Thu, 2 Dec 2021 12:48:46 -0800 Message-Id: <20211202204900.50973-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211202204900.50973-1-richard.henderson@linaro.org> References: <20211202204900.50973-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1032 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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. Signed-off-by: Richard Henderson Reviewed-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 790bd558c3..287f24cc60 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -70,7 +70,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 cfbc987ba6..36662de149 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -216,11 +216,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; @@ -303,10 +298,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)