From patchwork Wed Jul 21 06:41:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 483242 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5905961jao; Tue, 20 Jul 2021 23:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFIpE7IMaTV7+1j1W6nSttga/baEYrL/swv8+8XtdLuh2/cOprDwD7Us9lOg9YYKAJXRdf X-Received: by 2002:ac8:5552:: with SMTP id o18mr5514290qtr.51.1626850039435; Tue, 20 Jul 2021 23:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626850039; cv=none; d=google.com; s=arc-20160816; b=xA+i5rZL6yzLvrjYIH9EugeXTzBmvZn6qkzwDRGx98K/hfJ6PiKq60mpoBqtc8kzYB KzweHF5sw+98S3tSMupP7aQHp+utob5S2U5TKXQU7Ba8IUt7h20SaGoZi89ARkRgoVk3 PXs11M1QWkB2nfv+nGF+t+1VV+EA/TMYxcLU8Cw1YG6DByiwXwE1ZSYIv5jweniXO+19 QDS0+JZk/GfBzMXdhy6dr5Mq7+6pbo3O09yyqSVKKNaeE1eWuMZrjs4PNeRZHrpDNbEC 4BK0dVguCYegP3C8dbAnAfynRkf3t5mvIqU7jvXVvdaV8LCmMfy2UZMrKLXcZU6aGfib 2jUg== 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:to:from :dkim-signature; bh=BlPIdpEMHDG0f7nAulWHm2+Z2nPdA6tFMSfI///rGBY=; b=tGSzNQzAlB7hFiADexcg5X403jPFtq6Qb53XUY9+aKdCJenhBYcJBPXz0XFqAZ1jQG kq5oPAONYTXx+5IqHEuOqNWnzm0A8PnS/GRMMZjwft/4gGYqLu33zz6C4xXCo3z9l9Eu 21Y4KrFRQoeCxJ+5UwTDkNHVzNnF5Kt3dTs/Afm4X9sroJ3oleaFQk5DhM0m8R24DpGt v16Dvz1/SARTx6evfMAHNcyKLGO9hVVej/il4RORnaDMssrjj9ZQeTpdBpHaAHslqT/S VZi+xoO6vjdVrnkAnNUpOpa/p/c6LsLNVrSfI/QOS8tjetnZJ/kPplRudjq9ffYsM4X4 wY3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jrKPNI5F; 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 o8si5286819qkp.269.2021.07.20.23.47.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Jul 2021 23:47:19 -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=jrKPNI5F; 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]:53334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m660k-0001tM-N6 for patch@linaro.org; Wed, 21 Jul 2021 02:47:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m65vn-0005A9-Hw for qemu-devel@nongnu.org; Wed, 21 Jul 2021 02:42:11 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:39592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m65vl-0005Vu-Na for qemu-devel@nongnu.org; Wed, 21 Jul 2021 02:42:11 -0400 Received: by mail-pl1-x631.google.com with SMTP id h1so481420plf.6 for ; Tue, 20 Jul 2021 23:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BlPIdpEMHDG0f7nAulWHm2+Z2nPdA6tFMSfI///rGBY=; b=jrKPNI5FIbqUc49RzqJ1LIjPQe1QvmBn9e6VjAwHn61mmR+E4oIWW5Uz6O2i9+DY9/ yr347/UgEh1YD88FcfLiIjrNDmKec9lerYzb7XZ4HJwUgHHthtYvX+UfvZqq6xSax81F 6g11Q4i9Fsh1c8iU/X2bhM7Z/ZtJPWdudldgVwMQ6aL4hlJMH61GU42LfD2PQgLzyfL7 Z0rl/6XMwNiZ0laD/IYc/yKvb+rMDXX/sinPWzQiruNyJR/mVWhCYnkRk2DsHIhZEvlW Onq7E2d/VeAIwc4frpDuXim/Kno5taq9vwEvndD+lRaFqxAKKMQz1OulXPPCxbDZBYKT YiAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BlPIdpEMHDG0f7nAulWHm2+Z2nPdA6tFMSfI///rGBY=; b=m0Hb6PGohQi0UqiCjkJaL/Y3EGgGYTQ7mvMB+NukydavKu3wRCw78Q82SNYGcbsYW1 9HYf1jvraxuF6B6GKGQbZ/Kk/JDs/6OjDLEadlvVIliZ8QqTeSKT3+yZBSp3tOFnMoZS c0PBvaPo263WyeloBwu1LlLhlbLc4CKZQjjea7mfzlrZTvffu9x0zAh/VCbq3aeTGDin KDlY3+6b4H8Y4Pi5/G0Sdx6Uo28tXsW07D7CqfnACgX/Mi2jmV6/AAF7SQVab9S/ILxz hMtlr5IiBWpNyU0nHoPxQPBcSn1/JMSIumLhvJ6gYNqsLJmdGJWT4Co6mB5spNiu23K6 FdAQ== X-Gm-Message-State: AOAM531MI2vHDW+JHHC5aXv//2MXmhIJRLRHrPoXu5E9KSQSInzd6C4X gMoPRPFpMbDc+v1c8oOfEbpzAqp6zyFWuQ== X-Received: by 2002:a17:902:b218:b029:11a:bf7b:1a80 with SMTP id t24-20020a170902b218b029011abf7b1a80mr26397488plr.82.1626849728382; Tue, 20 Jul 2021 23:42:08 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id q17sm21146132pjd.42.2021.07.20.23.42.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 23:42:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 10/23] target/m68k: Drop checks for singlestep_enabled Date: Tue, 20 Jul 2021 20:41:42 -1000 Message-Id: <20210721064155.645508-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721064155.645508-1-richard.henderson@linaro.org> References: <20210721064155.645508-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" GDB single-stepping is now handled generically. Signed-off-by: Richard Henderson --- target/m68k/translate.c | 44 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) -- 2.25.1 Acked-by: Laurent Vivier diff --git a/target/m68k/translate.c b/target/m68k/translate.c index c34d9aed61..c3d281a5f2 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -194,18 +194,6 @@ static void do_writebacks(DisasContext *s) } } -static bool is_singlestepping(DisasContext *s) -{ - /* - * Return true if we are singlestepping either because of - * architectural singlestep or QEMU gdbstub singlestep. This does - * not include the command line '-singlestep' mode which is rather - * misnamed as it only means "one instruction per TB" and doesn't - * affect the code we generate. - */ - return s->base.singlestep_enabled || s->ss_active; -} - /* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ #define DISAS_EXIT DISAS_TARGET_1 /* cpu state was modified dynamically */ @@ -320,20 +308,6 @@ static void gen_exception(DisasContext *s, uint32_t dest, int nr) s->base.is_jmp = DISAS_NORETURN; } -static void gen_singlestep_exception(DisasContext *s) -{ - /* - * Generate the right kind of exception for singlestep, which is - * either the architectural singlestep or EXCP_DEBUG for QEMU's - * gdb singlestepping. - */ - if (s->ss_active) { - gen_raise_exception(EXCP_TRACE); - } else { - gen_raise_exception(EXCP_DEBUG); - } -} - static inline void gen_addr_fault(DisasContext *s) { gen_exception(s, s->base.pc_next, EXCP_ADDRESS); @@ -1522,10 +1496,10 @@ static void gen_exit_tb(DisasContext *s) /* Generate a jump to an immediate address. */ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) { - if (unlikely(is_singlestepping(s))) { + if (unlikely(s->ss_active)) { update_cc_op(s); tcg_gen_movi_i32(QREG_PC, dest); - gen_singlestep_exception(s); + gen_raise_exception(EXCP_TRACE); } else if (translator_use_goto_tb(&s->base, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_i32(QREG_PC, dest); @@ -6193,7 +6167,7 @@ static void m68k_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) dc->ss_active = (M68K_SR_TRACE(env->sr) == M68K_SR_TRACE_ANY_INS); /* If architectural single step active, limit to 1 */ - if (is_singlestepping(dc)) { + if (dc->ss_active) { dc->base.max_insns = 1; } } @@ -6252,17 +6226,17 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) break; case DISAS_TOO_MANY: update_cc_op(dc); - if (is_singlestepping(dc)) { + if (dc->ss_active) { tcg_gen_movi_i32(QREG_PC, dc->pc); - gen_singlestep_exception(dc); + gen_raise_exception(EXCP_TRACE); } else { gen_jmp_tb(dc, 0, dc->pc); } break; case DISAS_JUMP: /* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ - if (is_singlestepping(dc)) { - gen_singlestep_exception(dc); + if (dc->ss_active) { + gen_raise_exception(EXCP_TRACE); } else { tcg_gen_lookup_and_goto_ptr(); } @@ -6272,8 +6246,8 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) * We updated CC_OP and PC in gen_exit_tb, but also modified * other state that may require returning to the main loop. */ - if (is_singlestepping(dc)) { - gen_singlestep_exception(dc); + if (dc->ss_active) { + gen_raise_exception(EXCP_TRACE); } else { tcg_gen_exit_tb(NULL, 0); }