From patchwork Sat Oct 16 18:15:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515882 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp134605imp; Sat, 16 Oct 2021 11:23:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGW1FkF5/qvP+kaGD8ComL+m9taF5SbYXr+BbfGbJgevFJ5gHCF+QJYsBGKtOfBIqwt/Fl X-Received: by 2002:a25:5084:: with SMTP id e126mr19150813ybb.475.1634408618558; Sat, 16 Oct 2021 11:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634408618; cv=none; d=google.com; s=arc-20160816; b=P/Sh3Q9f1OsaeB92HzdGLUdp1AETe0p7z8Z8XMIodjayxg5CFytnNNuU0827pbf4HY YOhNn4fXCIC04r6PsW/RNyo8JZBEzWZKEo78vzpN++3XpoFP8eWRVHZiVQnJmoKduLnX YNtlgJAlfxHRfBmn8C3Jck0eal+9eD1x+4XnkGjeUDn33jTvOCmsssfob5Yb9cXSgh0l kJUWUBioLI/VKJtkiQ41MHOoUlLx++5KbaNWkmia16gPoEz1TQ3gCLe2xwZaDRUy9dL8 u4wcf1z04N3LGf9627FAjcV01An4QOhIbSt9JKYzH+PgIVU+BSSvQkKiPXmj4FxZw2FM Tpdg== 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=5vzsS779Ji0aZH1T0g3pZgPZBGZ0QiFgHfm7fgPItP0=; b=IBkC7J4Mu9XYL2hEDVaYLnTJCPsF0JIrXEK1C+AZZX2uwBkwgIEobwQOmWZewKfBcr WbXAcMSrZdESalyPYcLe4adT1usDWZ0IwlVwlt1Cx7rF1hOhBDaL1XOU1lYBcQ8thn5M i7BbLb5S0yZ5bbYrjjy28UDGQzE30qDnU6z1tPbcPw9wq0rHSj1XRxxS2hRXlVfO/y94 k1eoWlWEREl+9Fxe7mB1Eqy5OMXz8/0VozZHYi5wAjzUvr70Is08kJ2pedwB9BeP9FHx fQxZY8PcmVwXibTlnSFL84d8GuSpqCiGwzenyU/qAAgXiuGVsVXgYIFXUIDUWG3jcfkT gT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HSE2KK68; 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 c16si9819839ybn.85.2021.10.16.11.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Oct 2021 11:23:38 -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=HSE2KK68; 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]:39020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mboLJ-00032w-VD for patch@linaro.org; Sat, 16 Oct 2021 14:23:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mboDY-0008MN-0O for qemu-devel@nongnu.org; Sat, 16 Oct 2021 14:15:36 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mboDR-0001xl-2Q for qemu-devel@nongnu.org; Sat, 16 Oct 2021 14:15:35 -0400 Received: by mail-pj1-x1035.google.com with SMTP id pf6-20020a17090b1d8600b0019fa884ab85so11646367pjb.5 for ; Sat, 16 Oct 2021 11:15:26 -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=5vzsS779Ji0aZH1T0g3pZgPZBGZ0QiFgHfm7fgPItP0=; b=HSE2KK68BwycnfejuVVg7v1VC74eSRR4ebYB2Psrl4pW/bvwCDa2jaCUTGSmCEX8Do SMp5vb/EvKPvjzGoXgGSoc4WBVyQHR/ZvS02LK/FXpoBUZrhI5SporeHcLNC9VClN0A1 N42lYaDxabgOdPbQwM9nwFWgF9lGSPnfzBmYGtoAHuk7U3H9wL6pOody808XFeAFG2UT vDSIa+0G+AXbiD5cdQJhIIFk7PDe/u5J+BjnYiK1XNanwZ1Pf2XApl42ApOPrV/9gtXQ RgGEA9awuOUSCjv+vo5nbXuuY0vGzMVIIt55frMGpbNKibCAoDYqZ0Ro+RfTCzpvA30B DUSQ== 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=5vzsS779Ji0aZH1T0g3pZgPZBGZ0QiFgHfm7fgPItP0=; b=PKaW5/dGmZteDkD7ya+2dqQo8llm+vxlNRcHELFQhoJm7+Ybmr/RrLBLlxCa1k6Ujf MD9pRUlc7ZHHNvoTaeDyuTnAarixO1Fh6Ssjk97yZnKK/H7MOz8UGxv+VgyZKKmBRU9Z MkXmeH6Elj8U0eA6zoNDOkyNe9+4U8H0W2blsAi7HOfuwBIk/BzxaWHOZ+EyTmqKuWOL lCekh6xXcGGI3QxQ/U4FiAaT9Tkz9VTr6tDLcuV2pRF7JASBA+LwZ1IhOMOSCAjSpEH0 5BWNxqbGdaKyOUYcrOGAXD9rGO8rUVm7diiL53H7wWSFDZEsrxbOfwljJ8H6HCbfS0qo yl6w== X-Gm-Message-State: AOAM530JgCtPk33mLTkbYHqcprWD4IYWHBuEDl5kfPMCF329DolW019U s5znFhXvUIDMdyRv5Qs0qr+GOVAMpXA6QQ== X-Received: by 2002:a17:90b:1e4b:: with SMTP id pi11mr22267667pjb.179.1634408125724; Sat, 16 Oct 2021 11:15:25 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id ob5sm5075097pjb.2.2021.10.16.11.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 11:15:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/24] target/m68k: Drop checks for singlestep_enabled Date: Sat, 16 Oct 2021 11:15:00 -0700 Message-Id: <20211016181514.3165661-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211016181514.3165661-1-richard.henderson@linaro.org> References: <20211016181514.3165661-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" GDB single-stepping is now handled generically. Acked-by: Laurent Vivier Signed-off-by: Richard Henderson --- target/m68k/translate.c | 44 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) -- 2.25.1 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 50a55f949c..af43c8eab8 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); }